2024-02-18 10:38:05 +00:00
|
|
|
mod raylib;
|
|
|
|
|
|
|
|
fn main() {
|
2024-02-18 11:08:29 +00:00
|
|
|
let screen = raylib::Vector2::<u32> { x: 800, y: 600 };
|
|
|
|
let mut pos = raylib::Vector2::<u32> {
|
2024-02-18 10:38:05 +00:00
|
|
|
x: screen.x / 2,
|
|
|
|
y: screen.y / 2
|
|
|
|
};
|
|
|
|
raylib::init_window(screen.x, screen.y, "Hello, raylib");
|
|
|
|
raylib::set_target_fps(60);
|
|
|
|
|
|
|
|
while !raylib::window_should_close() {
|
|
|
|
raylib::begin_drawing();
|
|
|
|
raylib::clear_background(raylib::colors::BLACK);
|
|
|
|
|
|
|
|
if raylib::is_key_down(raylib::Key::W) {
|
|
|
|
pos.y -= 10;
|
|
|
|
} else if raylib::is_key_down(raylib::Key::S) {
|
|
|
|
pos.y += 10;
|
|
|
|
} else if raylib::is_key_down(raylib::Key::A) {
|
|
|
|
pos.x -= 10;
|
|
|
|
} else if raylib::is_key_down(raylib::Key::D) {
|
|
|
|
pos.x += 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
raylib::draw_rect(pos.x, pos.y, 100, 100, raylib::colors::RED);
|
|
|
|
raylib::end_drawing();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|