Reorganize vga colors to aid translation
This commit is contained in:
parent
dbf0ad9fa6
commit
c2611baa32
3 changed files with 73 additions and 34 deletions
10
src/main.rs
10
src/main.rs
|
@ -9,7 +9,7 @@ use std::{
|
||||||
cmp::{max, min},
|
cmp::{max, min},
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
use vga_color::*;
|
use vga_color as vga;
|
||||||
|
|
||||||
use crate::sound::SoundType;
|
use crate::sound::SoundType;
|
||||||
|
|
||||||
|
@ -215,8 +215,8 @@ fn main() -> BError {
|
||||||
.with(Position { x: 40, y: 24 })
|
.with(Position { x: 40, y: 24 })
|
||||||
.with(Renderable {
|
.with(Renderable {
|
||||||
glyph: to_cp437('☻'),
|
glyph: to_cp437('☻'),
|
||||||
fg: RGB::named(VGA_YELLOW_BRIGHT),
|
fg: RGB::named(vga::YELLOW_BRIGHT),
|
||||||
bg: RGB::named(VGA_BLACK),
|
bg: RGB::named(vga::BLACK),
|
||||||
})
|
})
|
||||||
.with(Player {
|
.with(Player {
|
||||||
last_moved: Instant::now(),
|
last_moved: Instant::now(),
|
||||||
|
@ -234,8 +234,8 @@ fn main() -> BError {
|
||||||
.with(Position { x: i * 7, y: 20 })
|
.with(Position { x: i * 7, y: 20 })
|
||||||
.with(Renderable {
|
.with(Renderable {
|
||||||
glyph: to_cp437('Ä'),
|
glyph: to_cp437('Ä'),
|
||||||
fg: RGB::named(VGA_RED_BRIGHT),
|
fg: RGB::named(vga::RED_BRIGHT),
|
||||||
bg: RGB::named(VGA_BLACK),
|
bg: RGB::named(vga::BLACK),
|
||||||
})
|
})
|
||||||
.with(LeftMover {})
|
.with(LeftMover {})
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::{vga_color::*, LevelNumber, Player};
|
use crate::vga_color as vga;
|
||||||
|
use crate::{LevelNumber, Player};
|
||||||
use bracket_lib::prelude::*;
|
use bracket_lib::prelude::*;
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
|
|
||||||
|
@ -15,8 +16,8 @@ pub fn draw_sidebar(ecs: &World, ctx: &mut BTerm) {
|
||||||
y2: SIDEBAR_POS_Y + 19,
|
y2: SIDEBAR_POS_Y + 19,
|
||||||
},
|
},
|
||||||
to_cp437(' '),
|
to_cp437(' '),
|
||||||
RGB::named(VGA_YELLOW_BRIGHT),
|
RGB::named(vga::YELLOW_BRIGHT),
|
||||||
RGB::named(VGA_BLUE),
|
RGB::named(vga::BLUE),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Gray number boxes
|
// Gray number boxes
|
||||||
|
@ -29,8 +30,8 @@ pub fn draw_sidebar(ecs: &World, ctx: &mut BTerm) {
|
||||||
y2: SIDEBAR_POS_Y + y + 1,
|
y2: SIDEBAR_POS_Y + y + 1,
|
||||||
},
|
},
|
||||||
to_cp437(' '),
|
to_cp437(' '),
|
||||||
RGB::named(VGA_RED),
|
RGB::named(vga::RED),
|
||||||
RGB::named(VGA_WHITE),
|
RGB::named(vga::WHITE),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,8 +61,8 @@ pub fn draw_sidebar(ecs: &World, ctx: &mut BTerm) {
|
||||||
ctx.print_color(
|
ctx.print_color(
|
||||||
SIDEBAR_POS_X + 3,
|
SIDEBAR_POS_X + 3,
|
||||||
SIDEBAR_POS_Y + 18,
|
SIDEBAR_POS_Y + 18,
|
||||||
RGB::named(VGA_CYAN_BRIGHT),
|
RGB::named(vga::CYAN_BRIGHT),
|
||||||
RGB::named(VGA_RED),
|
RGB::named(vga::RED),
|
||||||
"OPTIONS",
|
"OPTIONS",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -73,8 +74,8 @@ pub fn draw_sidebar(ecs: &World, ctx: &mut BTerm) {
|
||||||
y2: SIDEBAR_POS_Y + 25,
|
y2: SIDEBAR_POS_Y + 25,
|
||||||
},
|
},
|
||||||
to_cp437(' '),
|
to_cp437(' '),
|
||||||
RGB::named(VGA_WHITE),
|
RGB::named(vga::WHITE),
|
||||||
RGB::named(VGA_BLUE),
|
RGB::named(vga::BLUE),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.fill_region(
|
ctx.fill_region(
|
||||||
|
@ -85,8 +86,8 @@ pub fn draw_sidebar(ecs: &World, ctx: &mut BTerm) {
|
||||||
y2: SIDEBAR_POS_Y + 25,
|
y2: SIDEBAR_POS_Y + 25,
|
||||||
},
|
},
|
||||||
to_cp437(' '),
|
to_cp437(' '),
|
||||||
RGB::named(VGA_WHITE_BRIGHT),
|
RGB::named(vga::WHITE_BRIGHT),
|
||||||
RGB::named(VGA_BLUE),
|
RGB::named(vga::BLUE),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 19, "Whip");
|
ctx.print(SIDEBAR_POS_X + 3, SIDEBAR_POS_Y + 19, "Whip");
|
||||||
|
@ -99,8 +100,8 @@ pub fn draw_sidebar(ecs: &World, ctx: &mut BTerm) {
|
||||||
ctx.print_color_right(
|
ctx.print_color_right(
|
||||||
SIDEBAR_POS_X + 14,
|
SIDEBAR_POS_X + 14,
|
||||||
SIDEBAR_POS_Y,
|
SIDEBAR_POS_Y,
|
||||||
RGB::named(VGA_GREEN_BRIGHT),
|
RGB::named(vga::GREEN_BRIGHT),
|
||||||
RGB::named(VGA_BLACK),
|
RGB::named(vga::BLACK),
|
||||||
&format!("{}", ctx.fps),
|
&format!("{}", ctx.fps),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,57 @@
|
||||||
|
//! Definitions for VGA 4-bit colors, like the original Kroz would have used
|
||||||
|
//!
|
||||||
|
//! In the Kroz source, colors are referenced by their index in the 4-bit VGA palette.
|
||||||
|
//! Here they are for reference:
|
||||||
|
//!
|
||||||
|
//! - `0` = `BLACK`
|
||||||
|
//! - `1` = `BLUE`
|
||||||
|
//! - `2` = `GREEN`
|
||||||
|
//! - `3` = `CYAN`
|
||||||
|
//! - `4` = `RED`
|
||||||
|
//! - `5` = `MAGENTA`
|
||||||
|
//! - `6` = `YELLOW`
|
||||||
|
//! - `7` = `WHITE`
|
||||||
|
//! - `8` = `BLACK_BRIGHT`
|
||||||
|
//! - `9` = `BLUE_BRIGHT`
|
||||||
|
//! - `10` = `GREEN_BRIGHT`
|
||||||
|
//! - `11` = `CYAN_BRIGHT`
|
||||||
|
//! - `12` = `RED_BRIGHT`
|
||||||
|
//! - `13` = `MAGENTA_BRIGHT`
|
||||||
|
//! - `14` = `YELLOW_BRIGHT`
|
||||||
|
//! - `15` = `WHITE_BRIGHT`
|
||||||
|
|
||||||
// VGA 4-bit Colors
|
// VGA 4-bit Colors
|
||||||
pub const VGA_BLACK: (u8, u8, u8) = (0, 0, 0);
|
/// Index `0`
|
||||||
pub const VGA_RED: (u8, u8, u8) = (170, 0, 0);
|
pub const BLACK: (u8, u8, u8) = (0, 0, 0);
|
||||||
pub const VGA_GREEN: (u8, u8, u8) = (0, 170, 0);
|
/// Index `1`
|
||||||
pub const VGA_YELLOW: (u8, u8, u8) = (170, 85, 0);
|
pub const BLUE: (u8, u8, u8) = (0, 0, 170);
|
||||||
pub const VGA_BLUE: (u8, u8, u8) = (0, 0, 170);
|
/// Index `2`
|
||||||
pub const VGA_MAGENTA: (u8, u8, u8) = (170, 0, 170);
|
pub const GREEN: (u8, u8, u8) = (0, 170, 0);
|
||||||
pub const VGA_CYAN: (u8, u8, u8) = (0, 170, 170);
|
/// Index `3`
|
||||||
pub const VGA_WHITE: (u8, u8, u8) = (170, 170, 170);
|
pub const CYAN: (u8, u8, u8) = (0, 170, 170);
|
||||||
|
/// Index `4`
|
||||||
|
pub const RED: (u8, u8, u8) = (170, 0, 0);
|
||||||
|
/// Index `5`
|
||||||
|
pub const MAGENTA: (u8, u8, u8) = (170, 0, 170);
|
||||||
|
/// Index `6`
|
||||||
|
pub const YELLOW: (u8, u8, u8) = (170, 85, 0);
|
||||||
|
/// Index `7`
|
||||||
|
pub const WHITE: (u8, u8, u8) = (170, 170, 170);
|
||||||
|
|
||||||
// "Bold" VGA 4-bit Colors
|
// "Bold" VGA 4-bit Colors
|
||||||
pub const VGA_BLACK_BRIGHT: (u8, u8, u8) = (85, 85, 85);
|
/// Index `8`
|
||||||
pub const VGA_RED_BRIGHT: (u8, u8, u8) = (255, 85, 85);
|
pub const BLACK_BRIGHT: (u8, u8, u8) = (85, 85, 85);
|
||||||
pub const VGA_GREEN_BRIGHT: (u8, u8, u8) = (85, 255, 85);
|
/// Index `9`
|
||||||
pub const VGA_YELLOW_BRIGHT: (u8, u8, u8) = (255, 255, 85);
|
pub const BLUE_BRIGHT: (u8, u8, u8) = (85, 85, 255);
|
||||||
pub const VGA_BLUE_BRIGHT: (u8, u8, u8) = (85, 85, 255);
|
/// Index `10`
|
||||||
pub const VGA_MAGENTA_BRIGHT: (u8, u8, u8) = (255, 85, 255);
|
pub const GREEN_BRIGHT: (u8, u8, u8) = (85, 255, 85);
|
||||||
pub const VGA_CYAN_BRIGHT: (u8, u8, u8) = (85, 255, 255);
|
/// Index `11`
|
||||||
pub const VGA_WHITE_BRIGHT: (u8, u8, u8) = (255, 255, 255);
|
pub const CYAN_BRIGHT: (u8, u8, u8) = (85, 255, 255);
|
||||||
|
/// Index `12`
|
||||||
|
pub const RED_BRIGHT: (u8, u8, u8) = (255, 85, 85);
|
||||||
|
/// Index `13`
|
||||||
|
pub const MAGENTA_BRIGHT: (u8, u8, u8) = (255, 85, 255);
|
||||||
|
/// Index `14`
|
||||||
|
pub const YELLOW_BRIGHT: (u8, u8, u8) = (255, 255, 85);
|
||||||
|
/// Index `15`
|
||||||
|
pub const WHITE_BRIGHT: (u8, u8, u8) = (255, 255, 255);
|
||||||
|
|
Loading…
Add table
Reference in a new issue