change order of members in asc_behavior_create_args so that you can just specify the func without designators

Mon, 16 Jun 2025 20:58:51 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 16 Jun 2025 20:58:51 +0200
changeset 156
bd15eeaa88c0
parent 155
b598b4eb4b44
child 157
d6c2f028d8c9

change order of members in asc_behavior_create_args so that you can just specify the func without designators

make/gcc.mk file | annotate | diff | comparison | revisions
src/ascension/behavior.h file | annotate | diff | comparison | revisions
test/snake/snake.c file | annotate | diff | comparison | revisions
--- a/make/gcc.mk	Mon Jun 16 20:24:47 2025 +0200
+++ b/make/gcc.mk	Mon Jun 16 20:58:51 2025 +0200
@@ -3,6 +3,6 @@
  #
 
  CFLAGS =
- DEBUG_CFLAGS = -g -Wall -Wextra -Werror
+ DEBUG_CFLAGS = -g -Wall -Wextra -Werror -Wno-missing-field-initializers
  RELEASE_CFLAGS = -O3 -DNDEBUG
  LDFLAGS =
\ No newline at end of file
--- a/src/ascension/behavior.h	Mon Jun 16 20:24:47 2025 +0200
+++ b/src/ascension/behavior.h	Mon Jun 16 20:58:51 2025 +0200
@@ -49,14 +49,14 @@
 
 struct asc_behavior_create_args {
     /**
+     * The function that is invoked when the behavior is triggered.
+     */
+    asc_behavior_func func;
+    /**
      * The function that is invoked when the behavior is destroyed.
      */
     asc_behavior_destroy_func destroy_func;
     /**
-     * The function that is invoked when the behavior is triggered.
-     */
-    asc_behavior_func func;
-    /**
      * Pointer to additional custom data.
      */
     void *data;
--- a/test/snake/snake.c	Mon Jun 16 20:24:47 2025 +0200
+++ b/test/snake/snake.c	Mon Jun 16 20:58:51 2025 +0200
@@ -103,7 +103,7 @@
     asc_ink_rgb(255, 255, 255);
     AscSceneNode *node = asc_text(.name = "FPS Counter");
     asc_behavior_add(node, .func = update_fps_counter, .interval = asc_seconds(1));
-    asc_behavior_add(node, .func = tie_fps_counter_to_corner);
+    asc_behavior_add(node, tie_fps_counter_to_corner);
     asc_ui_add_node(node);
 }
 

mercurial