diff --git a/src/items.rs b/src/items.rs index 66638b3..d30dabc 100644 --- a/src/items.rs +++ b/src/items.rs @@ -54,7 +54,7 @@ impl ItemBase for StunGun { } fn get_description(&self) -> String { - return "Stun your enemies! Just don't point it at yourself.".to_string(); + return "Stun your enemies!\nJust don't point it at yourself.".to_string(); } fn get_texture(&self) -> &Texture2D { @@ -106,7 +106,7 @@ impl ItemBase for AirBag { } fn get_description(&self) -> String { - return "Its.. a bag. Filled with air. Duh".to_string(); + return "Its.. a bag.\nFilled with air. Duh".to_string(); } fn get_texture(&self) -> &Texture2D { @@ -210,7 +210,7 @@ impl ItemBase for Flippers { } fn get_description(&self) -> String { - return "Swim faster, and look stupid at the same time!".to_string(); + return "Swim faster, and look stupid\nat the same time!".to_string(); } fn get_texture(&self) -> &Texture2D { diff --git a/src/logic/shop/mainui.rs b/src/logic/shop/mainui.rs index 1b25b42..759da23 100644 --- a/src/logic/shop/mainui.rs +++ b/src/logic/shop/mainui.rs @@ -135,6 +135,18 @@ pub fn render_shop( height: 250.0, }; + // Get the hovered item + let hovered_item: &dyn ItemBase; + if hovering_stun_gun { + hovered_item = stun_gun_buy_ui.get_item(); + } else if hovering_air_bag { + hovered_item = air_bag_buy_ui.get_item(); + } else if hovering_flashlight { + hovered_item = flashlight_buy_ui.get_item(); + } else { + hovered_item = flippers_buy_ui.get_item(); + } + // Draw background box draw_handle.draw_rectangle_rec(box_bounds, Color::WHITE); draw_handle.draw_rectangle_lines_ex(box_bounds, 3, Color::BLACK); @@ -145,10 +157,16 @@ pub fn render_shop( x: box_bounds.x + (box_bounds.width / 2.0) - 40.0, y: box_bounds.y + 10.0, }, - Vector2 { - x: 80.0, - y: 80.0 - }, + Vector2 { x: 80.0, y: 80.0 }, + Color::BLACK, + ); + + // Render item description + draw_handle.draw_text( + &hovered_item.get_description(), + box_bounds.x as i32 + 10, + box_bounds.y as i32 + 100, + 30, Color::BLACK, ); }