@@ -92,9 +92,12 @@ editor_create_game_world(te_editor* editor, te_game_manager* game_manager) {
9292
9393 // Prepare stats widget.
9494 editor -> game_world_stats_widget = text_widget_create ();
95- widget_set_relative_position (text_widget_get_widget (editor -> game_world_stats_widget ), (vec2 ){0.01f , 0.01f });
96- widget_set_relative_size (text_widget_get_widget (editor -> game_world_stats_widget ), (vec2 ){0.4f , 0.2f });
97- widget_set_is_serialization_allowed (text_widget_get_widget (editor -> game_world_stats_widget ), false);
95+ widget_set_relative_position (
96+ text_widget_get_widget (editor -> game_world_stats_widget ), (vec2 ){0.01f , 0.01f });
97+ widget_set_relative_size (
98+ text_widget_get_widget (editor -> game_world_stats_widget ), (vec2 ){0.4f , 0.2f });
99+ widget_set_is_serialization_allowed (
100+ text_widget_get_widget (editor -> game_world_stats_widget ), false);
98101 text_widget_set_is_multiline (editor -> game_world_stats_widget , true);
99102 editor -> time_since_stats_update_sec = 10.0f ;
100103
@@ -103,7 +106,8 @@ editor_create_game_world(te_editor* editor, te_game_manager* game_manager) {
103106 text_widget_set_text_own (editor -> game_world_stats_widget , stats_text , text_len );
104107
105108 // Spawn stats widget.
106- world_spawn_widget (editor -> game_world , text_widget_get_widget (editor -> game_world_stats_widget ));
109+ world_spawn_widget (
110+ editor -> game_world , text_widget_get_widget (editor -> game_world_stats_widget ));
107111}
108112
109113void
@@ -115,29 +119,36 @@ editor_on_game_tick(void* game_instance, te_game_manager* game_manager, float de
115119
116120 // Update stats.
117121 editor -> time_since_stats_update_sec += delta_time_sec ;
118- if (editor -> game_world_stats_widget != NULL && editor -> time_since_stats_update_sec >= 2.0f ) {
122+ if (editor -> game_world_stats_widget != NULL
123+ && editor -> time_since_stats_update_sec >= 2.0f ) {
119124 editor -> time_since_stats_update_sec = 0.0f ;
120125
121126 te_renderer * renderer = game_manager_get_renderer (game_manager );
122127 const unsigned int fps = renderer_get_fps (renderer );
123128 const unsigned int fps_limit = renderer_get_fps_limit (renderer );
124129
125- const unsigned int process_mem = (unsigned int )(memory_usage_get_process_used_memory () / 1024 / 1024 );
126- const unsigned int total_used_mem = (unsigned int )(memory_usage_get_total_used_memory () / 1024 / 1024 );
127- const unsigned int total_mem = (unsigned int )(memory_usage_get_total_memory () / 1024 / 1024 );
130+ const unsigned int process_mem =
131+ (unsigned int )(memory_usage_get_process_used_memory () / 1024 / 1024 );
132+ const unsigned int total_used_mem =
133+ (unsigned int )(memory_usage_get_total_used_memory () / 1024 / 1024 );
134+ const unsigned int total_mem =
135+ (unsigned int )(memory_usage_get_total_memory () / 1024 / 1024 );
128136
129137 const char * fmt = "FPS: %u (limit: %u)\nRAM used (MB): %u (%u/%u)" ;
130138#if defined(ENGINE_ASAN_ENABLED )
131139 fmt = "FPS: %u (limit: %u)\nRAM used (MB): %u (%u/%u) (ASan enabled)" ;
132140#endif
133141
134- int len = snprintf (NULL , 0 , fmt , fps , fps_limit , process_mem , total_used_mem , total_mem );
142+ int len =
143+ snprintf (NULL , 0 , fmt , fps , fps_limit , process_mem , total_used_mem , total_mem );
135144 if (len < 0 ) {
136145 log_error ("snprintf error" );
137146 abort ();
138147 }
139148 char * src_text = malloc (sizeof (char ) * (size_t )(len + 1 ));
140- snprintf (src_text , (size_t )len + 1 , fmt , fps , fps_limit , process_mem , total_used_mem , total_mem );
149+ snprintf (
150+ src_text , (size_t )len + 1 , fmt , fps , fps_limit , process_mem , total_used_mem ,
151+ total_mem );
141152
142153 unsigned int text_len ;
143154 wchar_t * stats_text = wchar_from_char (src_text , & text_len );
@@ -149,7 +160,8 @@ editor_on_game_tick(void* game_instance, te_game_manager* game_manager, float de
149160
150161void
151162editor_on_keyboard_button_pressed (
152- void * game_instance , struct te_game_manager * game_manager , enum te_keyboard_button button , te_keyboard_modifiers modifiers ) {
163+ void * game_instance , struct te_game_manager * game_manager , enum te_keyboard_button button ,
164+ te_keyboard_modifiers modifiers ) {
153165 (void )game_manager ;
154166 (void )modifiers ;
155167
@@ -159,7 +171,8 @@ editor_on_keyboard_button_pressed(
159171
160172void
161173editor_on_keyboard_button_released (
162- void * game_instance , struct te_game_manager * game_manager , enum te_keyboard_button button , te_keyboard_modifiers modifiers ) {
174+ void * game_instance , struct te_game_manager * game_manager , enum te_keyboard_button button ,
175+ te_keyboard_modifiers modifiers ) {
163176 (void )modifiers ;
164177
165178 te_editor * editor = game_instance ;
@@ -171,21 +184,24 @@ editor_on_keyboard_button_released(
171184}
172185
173186void
174- editor_on_keyboard_input_text (void * game_instance , struct te_game_manager * game_manager , const char * text ) {
187+ editor_on_keyboard_input_text (
188+ void * game_instance , struct te_game_manager * game_manager , const char * text ) {
175189 (void )game_instance ;
176190 (void )game_manager ;
177191 (void )text ;
178192}
179193
180194void
181- editor_on_gamepad_button_pressed (void * game_instance , struct te_game_manager * game_manager , enum te_gamepad_button button ) {
195+ editor_on_gamepad_button_pressed (
196+ void * game_instance , struct te_game_manager * game_manager , enum te_gamepad_button button ) {
182197 (void )game_instance ;
183198 (void )game_manager ;
184199 (void )button ;
185200}
186201
187202void
188- editor_on_gamepad_button_released (void * game_instance , struct te_game_manager * game_manager , enum te_gamepad_button button ) {
203+ editor_on_gamepad_button_released (
204+ void * game_instance , struct te_game_manager * game_manager , enum te_gamepad_button button ) {
189205 (void )game_instance ;
190206
191207 if (button == TE_GB_BUTTON_RIGHT ) {
@@ -195,7 +211,8 @@ editor_on_gamepad_button_released(void* game_instance, struct te_game_manager* g
195211
196212void
197213editor_on_gamepad_axis_moved (
198- void * game_instance , struct te_game_manager * game_manager , enum te_gamepad_axis axis , float new_pos ) {
214+ void * game_instance , struct te_game_manager * game_manager , enum te_gamepad_axis axis ,
215+ float new_pos ) {
199216 (void )game_manager ;
200217
201218 te_editor * editor = game_instance ;
@@ -204,7 +221,8 @@ editor_on_gamepad_axis_moved(
204221
205222void
206223editor_on_mouse_button_pressed (
207- void * game_instance , struct te_game_manager * game_manager , enum te_mouse_button button , bool was_handled_by_widget ) {
224+ void * game_instance , struct te_game_manager * game_manager , enum te_mouse_button button ,
225+ bool was_handled_by_widget ) {
208226 (void )was_handled_by_widget ;
209227 te_editor * editor = game_instance ;
210228
@@ -223,7 +241,8 @@ editor_on_mouse_button_pressed(
223241
224242void
225243editor_on_mouse_button_released (
226- void * game_instance , struct te_game_manager * game_manager , enum te_mouse_button button , bool was_handled_by_widget ) {
244+ void * game_instance , struct te_game_manager * game_manager , enum te_mouse_button button ,
245+ bool was_handled_by_widget ) {
227246 (void )was_handled_by_widget ;
228247 te_editor * editor = game_instance ;
229248
@@ -241,22 +260,26 @@ editor_on_mouse_button_released(
241260}
242261
243262void
244- editor_on_mouse_moved (void * game_instance , struct te_game_manager * game_manager , float x_offset , float y_offset ) {
263+ editor_on_mouse_moved (
264+ void * game_instance , struct te_game_manager * game_manager , float x_offset ,
265+ float y_offset ) {
245266 (void )game_manager ;
246267
247268 te_editor * editor = game_instance ;
248269 editor_camera_on_mouse_moved (editor -> editor_camera , x_offset , y_offset );
249270}
250271
251272void
252- editor_on_mouse_scroll_moved (void * game_instance , struct te_game_manager * game_manager , float offset ) {
273+ editor_on_mouse_scroll_moved (
274+ void * game_instance , struct te_game_manager * game_manager , float offset ) {
253275 (void )game_instance ;
254276 (void )game_manager ;
255277 (void )offset ;
256278}
257279
258280void
259- editor_on_gamepad_connected (void * game_instance , struct te_game_manager * game_manager , const char * gamepad_name ) {
281+ editor_on_gamepad_connected (
282+ void * game_instance , struct te_game_manager * game_manager , const char * gamepad_name ) {
260283 (void )game_manager ;
261284 (void )gamepad_name ;
262285
@@ -273,7 +296,8 @@ editor_on_gamepad_disconnected(void* game_instance, struct te_game_manager* game
273296}
274297
275298void
276- editor_on_input_source_changed (void * game_instance , struct te_game_manager * game_manager , bool is_gamepad_current ) {
299+ editor_on_input_source_changed (
300+ void * game_instance , struct te_game_manager * game_manager , bool is_gamepad_current ) {
277301 (void )game_instance ;
278302 (void )game_manager ;
279303 (void )is_gamepad_current ;
0 commit comments