}
#private_file seek :: proc (use br: ^BinaryReader, new_pos: u32) -> u32 {
- old_pos :: pos;
+ old_pos := pos;
pos = new_pos;
return old_pos;
}
Color4f32 :: struct { r: f32; g: f32; b: f32; a: f32; }
Quad :: struct {
- pos : V2f = V2f.{ 0f, 0f };
- size : V2f = V2f.{ 0f, 0f };
+ pos : V2f = V2f.{};
+ size : V2f = V2f.{};
- tex_pos : V2f = V2f.{ 0f, 0f };
- tex_size : V2f = V2f.{ 0f, 0f };
+ tex_pos : V2f = V2f.{};
+ tex_size : V2f = V2f.{};
color : Color4f32 = Color4f32.{ 0f, 0f, 0f, 0f };
}
rebuffer_data :: proc (use qr: ^QuadRenderer) {
if !is_data_dirty do return;
- println("Rebuffering DATA!!");
-
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuffer);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, (#type [] void).{
count = quad_data.count * sizeof Quad,
mouse.x = 0;
mouse.y = 0;
- mouse.wheel_ups = ~~0;
- mouse.wheel_downs = ~~0;
+ mouse.wheel_ups = 0;
+ mouse.wheel_downs = 0;
}
process_event :: proc (use state: ^InputState, ev: ^event.Event) {
// @FIXME: This could overflow... if there were 256+ wheel up/down events
// in one frame. Still something that should be considered.
- if is_up do mouse.wheel_ups += ~~1;
- else do mouse.wheel_downs += ~~1;
+ if is_up do mouse.wheel_ups += 1;
+ else do mouse.wheel_downs += 1;
}
}
}
for ^key: keys_just_down do *key = false;
for ^button: mouse.buttons_just_down do *button = false;
- if mouse.wheel_ups > ~~0 do mouse.wheel_ups -= ~~1;
- if mouse.wheel_downs > ~~0 do mouse.wheel_downs -= ~~1;
+ if mouse.wheel_ups > 0 do mouse.wheel_ups -= 1;
+ if mouse.wheel_downs > 0 do mouse.wheel_downs -= 1;
mouse.dx = 0;
mouse.dy = 0;
dude_create_random :: proc () -> Dude {
return Dude.{
- pos = V2f.{ random.float(0.0f, 1200.0f), random.float(0.0f, 1200.0f) },
- vel = V2f.{ random.float(-3.0f, 3.0f), random.float(-3.0f, 3.0f) },
- size = random.float(4.0f, 6.0f),
+ entity = Entity.{
+ pos = V2f.{ random.float(0.0f, 1200.0f), random.float(0.0f, 1200.0f) },
+ vel = V2f.{ random.float(-3.0f, 3.0f), random.float(-3.0f, 3.0f) },
+ size = random.float(4.0f, 6.0f),
+ },
+
color = Dude_Color_Table[random.int() % 3],
// BUG: These should not have to be here but because of the "use entity" in the defintion of Dude, they do.
collided = false;
pos.y += vel.y * dt;
-// if pos.y - size < ~~-half_window_height || pos.y + size >= ~~half_window_height do collided = true;
if !aabb_contains(other_dudes.region, pos) do collided = true;
dude_aabb = dude_get_aabb(dude);
use package core
// BUG: Default values do not work on polymorphic structs.
-V2 :: struct ($T) { x: T; y: T; }
+V2 :: struct ($T) { x: T = 0; y: T = 0; }
V2f :: #type V2(f32);
V2i :: #type V2(i32);