summaryrefslogtreecommitdiff
path: root/src/devices/screen/draw_rect.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-10-28 20:25:01 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2024-10-28 20:29:12 +1300
commit1a830a3d1b9d99653322d5ae49ea8165de7ed9d0 (patch)
tree798e77b6fcf2438b1c2538a67efe856a2f7cb979 /src/devices/screen/draw_rect.rs
parent03c4b069e1806af256730639cefdae115b24401a (diff)
downloadbedrock-pc-1a830a3d1b9d99653322d5ae49ea8165de7ed9d0.zip
Rewrite emulatorv1.0.0-alpha1
This is a complete rewrite and restructure of the entire emulator project, as part of the effort in locking down the Bedrock specification and in creating much better tooling for creating and using Bedrock programs. This commit adds a command-line argument scheme, an embedded assembler, a headless emulator for use in non-graphical environments, deferred window creation for programs that do not access the screen device, and new versions of phosphor and bedrock-core. The new version of phosphor supports multi-window programs, which will make it possible to implement program forking in the system device later on, and the new version of bedrock-core implements the final core specification.
Diffstat (limited to 'src/devices/screen/draw_rect.rs')
-rw-r--r--src/devices/screen/draw_rect.rs42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/devices/screen/draw_rect.rs b/src/devices/screen/draw_rect.rs
deleted file mode 100644
index 265a87f..0000000
--- a/src/devices/screen/draw_rect.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-use super::*;
-
-impl ScreenDevice {
- pub fn draw_rect(&mut self, colour: u8, layer: ScreenLayer) {
- if let Some([x0, y0, x1, y1]) = self.find_vector_bounding_box() {
- let screen_width = self.dimensions.width as usize;
- let rect_width = x1 - x0 + 1;
- let mut i = x0 + (screen_width * y0);
- let buffer = match layer {
- ScreenLayer::Background => &mut self.background,
- ScreenLayer::Foreground => &mut self.foreground,
- };
- for _ in y0..=y1 {
- buffer[i..i+rect_width].fill(colour);
- i += screen_width;
- }
- }
- }
-
- pub fn draw_rect_1bit(&mut self, params: u8, layer: ScreenLayer) {
- if let Some([x0, y0, x1, y1]) = self.find_vector_bounding_box() {
- let screen_width = self.dimensions.width as usize;
- let rect_width = x1 - x0 + 1;
- let mut i = x0 + (screen_width * y0);
- let sprite = self.sprite_buffer.get_1bit_sprite(params);
- let buffer = match layer {
- ScreenLayer::Background => &mut self.background,
- ScreenLayer::Foreground => &mut self.foreground,
- };
-
- for y in y0..=y1 {
- let row = sprite[y % 8];
- for x in x0..=x1 {
- let colour = row[x % 8];
- if colour != 0xff { buffer[i] = colour }
- i += 1;
- }
- i += screen_width - rect_width;
- }
- };
- }
-}