added touch

This commit is contained in:
Nilton Constantino
2026-01-14 09:05:55 +00:00
parent eca053829b
commit 25fdfdb299
4 changed files with 35 additions and 37 deletions
+1
View File
@@ -10,6 +10,7 @@ pub struct Color(pub u16);
impl Color {
pub const INDIGO: Self = Self::rgb(32, 32, 64);
pub const GRAY: Self = Self::rgb(64, 64, 64);
pub const BLACK: Self = Self::rgb(0, 0, 0); // 0x0000
pub const WHITE: Self = Self::rgb(255, 255, 255); // 0xFFFF
pub const RED: Self = Self::rgb(255, 0, 0); // 0xF800
+3 -4
View File
@@ -16,7 +16,7 @@ pub struct TileBank {
/// Agora guardamos índices de 0 a 15 (4 bits por pixel simulados em 8 bits)
pub pixel_indices: Vec<u8>,
/// 256 paletas, cada uma com 16 cores (RGB565 como u16)
pub palettes: [[u16; 16]; 256],
pub palettes: [[Color; 16]; 256],
}
impl TileBank {
@@ -26,7 +26,7 @@ impl TileBank {
width,
height,
pixel_indices: vec![0; width * height], // Índice 0 = Transparente
palettes: [[0; 16]; 256],
palettes: [[Color::BLACK; 16]; 256],
}
}
@@ -56,7 +56,6 @@ impl TileBank {
return Color::COLOR_KEY;
}
let raw_color = self.palettes[palette_id as usize][pixel_index as usize];
Color::from_raw(raw_color)
self.palettes[palette_id as usize][pixel_index as usize]
}
}