Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added 1 version of all sprites, cutting sprites, and hide cursor #50

Merged
merged 4 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/runty8-editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ impl Clipboard {
*sprite_pixel = clipboard_pixel;
}
}
fn cut_sprite(&mut self, sprite: &mut Sprite) {
self.data = sprite.to_owned();
for sprite_pixel in sprite.iter_mut() {
*sprite_pixel = 0;
}
}
}

fn handle_key_combo(
Expand All @@ -165,6 +171,12 @@ fn handle_key_combo(

clipboard.paste_into(sprite);
}
KeyComboAction::Cut => {
let sprite = resources.sprite_sheet.get_sprite_mut(selected_sprite);
notification.alert("CUT 1 X 1 SPRITES".to_owned());

clipboard.cut_sprite(sprite);
}
KeyComboAction::FlipVertically => {
let sprite = resources.sprite_sheet.get_sprite_mut(selected_sprite);

Expand Down Expand Up @@ -211,6 +223,7 @@ fn save(notification: &mut notification::State, resources: &Resources) {
enum KeyComboAction {
Copy,
Paste,
Cut,
FlipVertically,
FlipHorizontally,
Undo,
Expand Down Expand Up @@ -251,6 +264,7 @@ impl ElmApp for Editor {
key_combos: KeyCombos::new()
.push(KeyComboAction::Copy, Key::C, &[Key::Control])
.push(KeyComboAction::Paste, Key::V, &[Key::Control])
.push(KeyComboAction::Cut, Key::X, &[Key::Control])
.push(KeyComboAction::Undo, Key::Z, &[Key::Control])
.push(KeyComboAction::Redo, Key::Y, &[Key::Control])
.push(KeyComboAction::Save, Key::S, &[Key::Control])
Expand Down
4 changes: 0 additions & 4 deletions src/runty8-editor/src/editor_assets/map.ppm

This file was deleted.

4 changes: 0 additions & 4 deletions src/runty8-editor/src/editor_assets/sprite_sheet.ppm

This file was deleted.

16 changes: 8 additions & 8 deletions src/runty8-editor/src/editor_assets/sprite_sheet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
0000000007000000007000000007000000007000000007000000000000000000000000000D00000000D00000000D00000000D00000000D000000000000000000
000000000008A800008A998000A4998008A44A800A444A000888A800000888000777770077DDD77077D7D77077D7D77077DDD770777777707777777066666660
0777770077DD7770777D7770777D777077DDD7707777777077777770666666600777770077DDD7707777D77077D7777077DDD770777777707777777066666660
0777770077DDD770777DD7707777D77077DDD7707777777077777770666666600000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0777770077DDD770777DD7707777D77077DDD7707777777077777770666666600077700000777000007770000077700077777770700000707777777000000000
70707070000000007000007000000000700000700000000070707070000000000070700000707070007070700077777070777770077777700007770000000000
00007000000007000000007007777777707777707007770070007000000000000077700007000700700000707000007070000070070007000077700000000000
00777000077777007777777077777770777777700777770000777000000000007777777070000070700000707000007070000070700000707777777000000000
77777770777777707777777077777770777777707777777077777770000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000E00000000E0000000000000000E00000000E0000000EE00000000000000000000000000000000000000000000000000000000000000000
00000000000100000017100000177100001777100017777100177110000117100001000000171000010001001700071001000100001710000001000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000FF0FF00FF000FF0FF000FF0FF000FF0FF000FF00FF0FF00000000000000000000000FF0000FF0F00FF000F00FF000F0000FF0F000000FF000000000
000000000000FF000000FFF00000F00000FFF0000FFFF0000FFF000000000000000000000FFFFFF00F0000F00FFFFFF0000000000F0F0F0000F0F0F000000000
000000000FFFFFF00F0000F00F0000F00F0000F00F0000F00FFFFFF0000000000000000000000000007007000007700000077000007007000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
70007777011D07770111077701110777700077777777777777777777777777770000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000FF00000FFF00000FFF00000FFF0F0000000F00000FFF0000000000
Expand Down
2 changes: 2 additions & 0 deletions src/runty8-event-loop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub fn event_loop(
};

let mut current_time = instant::now();

winit_window(&window).set_cursor_visible(false);
// TODO: Initial render.
// EDIT: Actually I think this handles itself through the Tick from Init? Maybe? Not sure.
// => Test it
Expand Down