pixelfont

This commit is contained in:
Llywelwyn 2023-09-25 00:05:26 +01:00
parent 7f9ba34afa
commit 627d33b2d9
4 changed files with 7 additions and 6 deletions

Binary file not shown.

View file

@ -12,5 +12,6 @@ pub mod prelude {
} }
pub const TILESIZE: f32 = 16.0; pub const TILESIZE: f32 = 16.0;
pub const FONTSIZE: f32 = 12.0;
pub const DISPLAYWIDTH: u32 = 100; pub const DISPLAYWIDTH: u32 = 100;
pub const DISPLAYHEIGHT: u32 = 56; pub const DISPLAYHEIGHT: u32 = 56;

View file

@ -3,7 +3,7 @@ use bracket_lib::prelude::*;
use notan::prelude::*; use notan::prelude::*;
use notan::draw::DrawTextSection; use notan::draw::DrawTextSection;
use std::collections::HashMap; use std::collections::HashMap;
use crate::consts::TILESIZE; use crate::consts::{ TILESIZE, FONTSIZE };
#[derive(PartialEq, Copy, Clone)] #[derive(PartialEq, Copy, Clone)]
pub enum CheatMenuResult { pub enum CheatMenuResult {
@ -59,7 +59,7 @@ pub fn draw_cheat_menu(
m - MAGIC MAP REVEAL m - MAGIC MAP REVEAL
g - GOD MODE"#; g - GOD MODE"#;
draw.text(&font, DEBUG_MENU) draw.text(&font, DEBUG_MENU)
.position(3.0 + (offsets.x as f32) * TILESIZE, 3.0 + (offsets.y as f32) * TILESIZE) .position((1.0 + (offsets.x as f32)) * TILESIZE, (1.0 + (offsets.y as f32)) * TILESIZE)
.color(Color::RED) .color(Color::RED)
.size(TILESIZE); .size(FONTSIZE);
} }

View file

@ -6,7 +6,7 @@ use specs::prelude::*;
use specs::saveload::{ SimpleMarker, SimpleMarkerAllocator }; use specs::saveload::{ SimpleMarker, SimpleMarkerAllocator };
use bracket_lib::prelude::*; use bracket_lib::prelude::*;
use std::collections::HashMap; use std::collections::HashMap;
use crate::consts::{ DISPLAYHEIGHT, DISPLAYWIDTH, TILESIZE }; use crate::consts::{ DISPLAYHEIGHT, DISPLAYWIDTH, TILESIZE, FONTSIZE };
#[notan_main] #[notan_main]
fn main() -> Result<(), String> { fn main() -> Result<(), String> {
@ -30,7 +30,7 @@ fn setup(gfx: &mut Graphics) -> State {
.unwrap(); .unwrap();
let data = include_bytes!("../resources/td.json"); let data = include_bytes!("../resources/td.json");
let atlas = create_textures_from_atlas(data, &texture).unwrap(); let atlas = create_textures_from_atlas(data, &texture).unwrap();
let font = gfx.create_font(include_bytes!("../resources/Ubuntu-B.ttf")).unwrap(); let font = gfx.create_font(include_bytes!("../resources/PressStart2P-Regular.ttf")).unwrap();
let mut gs = State { let mut gs = State {
ecs: World::new(), ecs: World::new(),
base_texture: texture, base_texture: texture,
@ -436,7 +436,7 @@ fn draw(app: &mut App, gfx: &mut Graphics, gs: &mut State) {
RunState::Farlook { x, y } => { RunState::Farlook { x, y } => {
draw.text(&gs.font, "RunState::Farlook") draw.text(&gs.font, "RunState::Farlook")
.position(((x + 2) as f32) * TILESIZE, (y as f32) * TILESIZE) .position(((x + 2) as f32) * TILESIZE, (y as f32) * TILESIZE)
.size(TILESIZE); .size(FONTSIZE);
crate::gui::draw_farlook(x, y, &mut draw, &gs.atlas); crate::gui::draw_farlook(x, y, &mut draw, &gs.atlas);
//draw_tooltips(&gs.ecs, ctx, Some((x, y))); TODO: Put this in draw loop //draw_tooltips(&gs.ecs, ctx, Some((x, y))); TODO: Put this in draw loop
} }