src/camera.c

changeset 287
359eaf2a8bd2
parent 262
b47de42f4598
child 288
8796f03aac26
--- a/src/camera.c	Sun Nov 16 21:12:20 2025 +0100
+++ b/src/camera.c	Sun Nov 16 22:00:13 2025 +0100
@@ -30,6 +30,7 @@
 #include "ascension/camera.h"
 
 void asc_camera_init_(AscCamera *camera, struct asc_camera_init_args args) {
+    memset(camera, 0, sizeof(AscCamera));
     if (args.type == ASC_CAMERA_ORTHO) {
         asc_rect rect = args.ortho.rect;
         if (rect.size.width <= 0 || rect.size.height <= 0) {
@@ -41,8 +42,7 @@
         // TODO: implement
         asc_wprintf("Camera type PERSPECTIVE is not yet implemented.");
     } else {
-        // at least zero all the bytes (law of the least surprise)
-        memset(camera, 0, sizeof(AscCamera));
+        asc_error("Illegal argument for asc_camera_init(): type = %d", args.type);
     }
     camera->viewport_update_func = args.viewport_update_func;
     camera->projection_update_func = args.projection_update_func;

mercurial