Compare commits
No commits in common. "eebeb478d2f73135653b49caa937bce4764e4009" and "c3677a3ff441e4270e131ac2a8c3046108ddae58" have entirely different histories.
eebeb478d2
...
c3677a3ff4
|
@ -85,20 +85,19 @@ pub(crate) fn render_to_window(
|
|||
src: &mut [u8],
|
||||
palette: &[Rgb; 256],
|
||||
window_size: IVec2,
|
||||
screen_size: IVec2,
|
||||
scale: usize,
|
||||
off_x: usize,
|
||||
off_y: usize,
|
||||
) {
|
||||
let start = window_size.x as usize * off_y;
|
||||
let end = start + window_size.x as usize * screen_size.y as usize * scale;
|
||||
let end = start + window_size.x as usize * window_size.y as usize * scale;
|
||||
for (y, row) in target[start..end]
|
||||
.chunks_exact_mut(window_size.x as usize * scale)
|
||||
.enumerate()
|
||||
{
|
||||
let y = y as i32;
|
||||
for x in 0..screen_size.x as usize {
|
||||
let p = src[x + y as usize * screen_size.x as usize];
|
||||
for x in 0..window_size.x as usize {
|
||||
let p = src[x + y as usize * window_size.x as usize];
|
||||
|
||||
for scaley in 0..scale {
|
||||
for scalex in 0..scale {
|
||||
|
|
|
@ -104,10 +104,7 @@ pub(crate) fn run_mapedit() {
|
|||
match event {
|
||||
Event::WindowEvent { event, .. } => match event {
|
||||
WindowEvent::KeyboardInput { input, .. } => {
|
||||
match (
|
||||
input.state,
|
||||
input.virtual_keycode.unwrap_or(VirtualKeyCode::F24),
|
||||
) {
|
||||
match (input.state, input.virtual_keycode.unwrap()) {
|
||||
(winit::event::ElementState::Pressed, VirtualKeyCode::Escape) => {
|
||||
*control_flow = ControlFlow::Exit;
|
||||
}
|
||||
|
@ -155,8 +152,8 @@ pub(crate) fn run_mapedit() {
|
|||
},
|
||||
WindowEvent::CursorMoved { position, .. } => {
|
||||
let new_pos = IVec2 {
|
||||
x: position.x as i32 / 2,
|
||||
y: position.y as i32 / 2,
|
||||
x: position.x as i32,
|
||||
y: position.y as i32,
|
||||
};
|
||||
let delta = new_pos - *mouse_pos;
|
||||
if *middle_down {
|
||||
|
@ -236,15 +233,15 @@ pub(crate) fn run_mapedit() {
|
|||
)
|
||||
.unwrap();
|
||||
let mut screen_buffer =
|
||||
vec![TRANSPARENT; size.width as usize * size.height as usize / 4];
|
||||
vec![TRANSPARENT; size.width as usize * size.height as usize];
|
||||
let mut window_buffer = surface.buffer_mut().unwrap();
|
||||
render_to_screen(
|
||||
&mut screen_buffer,
|
||||
&gsa,
|
||||
&tileset,
|
||||
IVec2 {
|
||||
x: size.width as i32 / 2,
|
||||
y: size.height as i32 / 2,
|
||||
x: size.width as i32,
|
||||
y: size.height as i32,
|
||||
},
|
||||
);
|
||||
render_to_screen(
|
||||
|
@ -252,8 +249,8 @@ pub(crate) fn run_mapedit() {
|
|||
&gsa2,
|
||||
&tileset,
|
||||
IVec2 {
|
||||
x: size.width as i32 / 2,
|
||||
y: size.height as i32 / 2,
|
||||
x: size.width as i32,
|
||||
y: size.height as i32,
|
||||
},
|
||||
);
|
||||
render_to_window(
|
||||
|
@ -264,11 +261,7 @@ pub(crate) fn run_mapedit() {
|
|||
x: size.width as i32,
|
||||
y: size.height as i32,
|
||||
},
|
||||
IVec2 {
|
||||
x: size.width as i32 / 2,
|
||||
y: size.height as i32 / 2,
|
||||
},
|
||||
2,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
|
|
|
@ -212,10 +212,6 @@ pub fn run<TGame: 'static>(
|
|||
x: size.width as i32,
|
||||
y: size.height as i32,
|
||||
},
|
||||
IVec2 {
|
||||
x: SCREEN_WIDTH as i32,
|
||||
y: SCREEN_HEIGHT as i32,
|
||||
},
|
||||
*scale,
|
||||
*off_x,
|
||||
*off_y,
|
||||
|
|
Loading…
Reference in New Issue