lesson2, projection & view settings
This commit is contained in:
parent
aceadf4aca
commit
82ada8e9e0
1 changed files with 8 additions and 2 deletions
|
@ -20,6 +20,10 @@ int entry(int argc, char **argv) {
|
|||
while (!window.should_close) {
|
||||
reset_temporary_storage();
|
||||
|
||||
draw_frame.projection = m4_make_orthographic_projection(window.width * -0.5, window.width * 0.5, window.height * -0.5, window.height * 0.5, -1, 10);
|
||||
float zoom = 5.3;
|
||||
draw_frame.view = m4_make_scale(v3(1.0/zoom, 1.0/zoom, 1.0));
|
||||
|
||||
float64 now = os_get_current_time_in_seconds();
|
||||
float64 delta_t = now - last_time;
|
||||
last_time = now;
|
||||
|
@ -45,11 +49,13 @@ int entry(int argc, char **argv) {
|
|||
}
|
||||
input_axis = v2_normalize(input_axis);
|
||||
|
||||
player_pos = v2_add(player_pos, v2_mulf(input_axis, 5.0 * delta_t));
|
||||
player_pos = v2_add(player_pos, v2_mulf(input_axis, 100.0 * delta_t));
|
||||
|
||||
Vector2 size = v2(6.0, 8.0);
|
||||
Matrix4 xform = m4_scalar(1.0);
|
||||
xform = m4_translate(xform, v3(player_pos.x, player_pos.y, 0));
|
||||
draw_image_xform(player, xform, v2(.5f, .5f), COLOR_RED);
|
||||
xform = m4_translate(xform, v3(size.x * -0.5, 0.0, 0));
|
||||
draw_image_xform(player, xform, size, COLOR_RED);
|
||||
|
||||
gfx_update();
|
||||
seconds_counter += delta_t;
|
||||
|
|
Reference in a new issue