chore: renamed the structs Vec2, Vec3, Vec4, Mat2, Mat3, Mat4, Point2, Point3 to v2, v3, v4, m2, m3, m4, p2, p3

This commit is contained in:
lisk77 2025-04-17 00:54:09 +02:00
parent 982323f671
commit fd8cf1f278
22 changed files with 430 additions and 430 deletions

View file

@ -8,7 +8,7 @@ fn setup(app: &mut App, renderer: &mut Renderer2D) {
let camera = app.new_entity();
app.add_component(camera, Transform2D::new());
app.add_component(camera, Camera2D::new(Vec2::new(2.0, 2.0), 1.0, 1));
app.add_component(camera, Camera2D::new(v2::new(2.0, 2.0), 1.0, 1));
let e1 = app.new_entity();
@ -42,23 +42,23 @@ fn handle_input(app: &mut App, dt: f32) {
}
fn update_position(input: WinitInputHelper, transform: &mut Transform2D, dt: f32) {
let mut direction = Vec2::ZERO;
let mut direction = v2::ZERO;
if input.key_held(Key::KeyW) {
direction += Vec2::Y;
direction += v2::Y;
}
if input.key_held(Key::KeyA) {
direction -= Vec2::X;
direction -= v2::X;
}
if input.key_held(Key::KeyS) {
direction -= Vec2::Y;
direction -= v2::Y;
}
if input.key_held(Key::KeyD) {
direction += Vec2::X;
direction += v2::X;
}
// If check to prevent division by zero and the comet to fly off into infinity...
if direction != Vec2::ZERO {
if direction != v2::ZERO {
let normalized_dir = direction.normalize();
let displacement = normalized_dir * 777.7 * dt;
transform.translate(displacement);

View file

@ -2,12 +2,12 @@ use comet::prelude::*;
fn setup(app: &mut App, renderer: &mut Renderer2D) {
// Creating a texture atlas from the provided textures in the vector
renderer.set_texture_atlas(vec!["./resources/textures/comet_icon.png".to_string()]);
renderer.set_texture_atlas_by_paths(vec!["./resources/textures/comet_icon.png".to_string()]);
// Creating a camera entity
let cam = app.new_entity();
app.add_component(cam, Transform2D::new());
app.add_component(cam, Camera2D::new(Vec2::new(2.0, 2.0), 1.0, 1));
app.add_component(cam, Camera2D::new(v2::new(2.0, 2.0), 1.0, 1));
// Creating a textured entity
let e0 = app.new_entity();