Merge branch 'master' into assets

This commit is contained in:
wm-c 2021-04-25 15:14:01 -04:00
commit 4073923edf
2 changed files with 13 additions and 8 deletions

View File

@ -1,12 +1,14 @@
use raylib::texture::Texture2D;
use raylib::{math::Rectangle, prelude::RaylibDrawHandle, texture::Texture2D};
use serde::{Deserialize, Serialize};
use crate::resources::GlobalResources;
pub trait ItemBase {
fn get_cost(&self) -> u32;
fn get_level(&self) -> u8;
fn get_name(&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)]
@ -57,7 +59,7 @@ impl ItemBase for StunGun {
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!()
}
fn get_level(&self) -> u8 {
@ -109,7 +111,7 @@ impl ItemBase for AirBag {
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!()
}
fn get_level(&self) -> u8 {
@ -161,7 +163,7 @@ impl ItemBase for Flashlight {
return "See better for longer".to_string();
}
fn get_texture(&self) -> &Texture2D {
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle) {
todo!()
}
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();
}
fn get_texture(&self) -> &Texture2D {
fn get_texture(&self, draw_handle: &RaylibDrawHandle, resources: &GlobalResources, dest: Rectangle) {
todo!()
}
fn get_level(&self) -> u8 {

View File

@ -26,8 +26,11 @@ impl Screen for PauseMenuScreen {
game_core: &mut GameCore,
) -> Option<GameState> {
let mouse_position = draw_handle.get_mouse_position();
draw_handle.clear_background(Color::GRAY);
// TODO: Maybe we can stick some art here?
// draw_handle.clear_background(Color::GRAY);
// // 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 draw_handle.is_key_pressed(KeyboardKey::KEY_ESCAPE) {