Merge branch 'master' into assets
This commit is contained in:
commit
4073923edf
14
src/items.rs
14
src/items.rs
@ -1,12 +1,14 @@
|
|||||||
use raylib::texture::Texture2D;
|
use raylib::{math::Rectangle, prelude::RaylibDrawHandle, texture::Texture2D};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::resources::GlobalResources;
|
||||||
|
|
||||||
pub trait ItemBase {
|
pub trait ItemBase {
|
||||||
fn get_cost(&self) -> u32;
|
fn get_cost(&self) -> u32;
|
||||||
fn get_level(&self) -> u8;
|
fn get_level(&self) -> u8;
|
||||||
fn get_name(&self) -> String;
|
fn get_name(&self) -> String;
|
||||||
fn get_description(&self) -> String;
|
fn get_description(&self) -> String;
|
||||||
fn get_texture(&self) -> &Texture2D;
|
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||||
@ -57,7 +59,7 @@ impl ItemBase for StunGun {
|
|||||||
return "Stun your enemies!\nJust 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 {
|
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn get_level(&self) -> u8 {
|
fn get_level(&self) -> u8 {
|
||||||
@ -109,7 +111,7 @@ impl ItemBase for AirBag {
|
|||||||
return "Its.. a bag.\nFilled with air. Duh".to_string();
|
return "Its.. a bag.\nFilled with air. Duh".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_texture(&self) -> &Texture2D {
|
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn get_level(&self) -> u8 {
|
fn get_level(&self) -> u8 {
|
||||||
@ -161,7 +163,7 @@ impl ItemBase for Flashlight {
|
|||||||
return "See better for longer".to_string();
|
return "See better for longer".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_texture(&self) -> &Texture2D {
|
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn get_level(&self) -> u8 {
|
fn get_level(&self) -> u8 {
|
||||||
@ -213,7 +215,7 @@ impl ItemBase for Flippers {
|
|||||||
return "Swim faster, and look stupid\nat the same time!".to_string();
|
return "Swim faster, and look stupid\nat the same time!".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_texture(&self) -> &Texture2D {
|
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
fn get_level(&self) -> u8 {
|
fn get_level(&self) -> u8 {
|
||||||
|
@ -26,8 +26,11 @@ impl Screen for PauseMenuScreen {
|
|||||||
game_core: &mut GameCore,
|
game_core: &mut GameCore,
|
||||||
) -> Option<GameState> {
|
) -> Option<GameState> {
|
||||||
let mouse_position = draw_handle.get_mouse_position();
|
let mouse_position = draw_handle.get_mouse_position();
|
||||||
draw_handle.clear_background(Color::GRAY);
|
// draw_handle.clear_background(Color::GRAY);
|
||||||
// TODO: Maybe we can stick some art here?
|
// // TODO: Maybe we can stick some art here?
|
||||||
|
|
||||||
|
// Render the background
|
||||||
|
draw_handle.draw_texture(&game_core.resources.shop_background, 0, 0, Color::WHITE);
|
||||||
|
|
||||||
// If escape is pressed again, return to the previous render state
|
// If escape is pressed again, return to the previous render state
|
||||||
if draw_handle.is_key_pressed(KeyboardKey::KEY_ESCAPE) {
|
if draw_handle.is_key_pressed(KeyboardKey::KEY_ESCAPE) {
|
||||||
|
Reference in New Issue
Block a user