File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,18 @@ void editor_editing_loop() {
285
285
ye_load_scene (entry_scene );
286
286
}
287
287
288
+ // TODO: this project pref loading should become its own thing
289
+
290
+ // get the p2d gravity and cell size
291
+ float p2d_gravity_x = ye_config_float (SETTINGS , "p2d_gravity_x" , 0.0f );
292
+ float p2d_gravity_y = ye_config_float (SETTINGS , "p2d_gravity_y" , 20.0f );
293
+ int p2d_grid_size = ye_config_int (SETTINGS , "p2d_grid_size" , 250 );
294
+
295
+ // set the gravity
296
+ YE_STATE .engine .p2d_state -> gravity .x = p2d_gravity_x ;
297
+ YE_STATE .engine .p2d_state -> gravity .y = p2d_gravity_y ;
298
+ YE_STATE .engine .p2d_state -> _cell_size = p2d_grid_size ;
299
+
288
300
entity_list_head = ye_get_entity_list_head ();
289
301
290
302
// TODO: remove in future when we serialize editor prefs
Original file line number Diff line number Diff line change @@ -414,6 +414,12 @@ void ye_editor_paint_project_settings(struct nk_context *ctx){
414
414
json_object_set_new (SETTINGS , "p2d_gravity_x" , json_real (gravity_x ));
415
415
json_object_set_new (SETTINGS , "p2d_gravity_y" , json_real (gravity_y ));
416
416
json_object_set_new (SETTINGS , "p2d_grid_size" , json_integer (grid_size ));
417
+
418
+ // edge: when saving actually update in p2d_state
419
+ YE_STATE .engine .p2d_state -> gravity .x = gravity_x ;
420
+ YE_STATE .engine .p2d_state -> gravity .y = gravity_y ;
421
+ YE_STATE .engine .p2d_state -> _cell_size = grid_size ;
422
+
417
423
// save the settings file
418
424
ye_json_write (ye_path ("settings.yoyo" ),SETTINGS );
419
425
Original file line number Diff line number Diff line change @@ -291,6 +291,8 @@ void ye_editor_paint_options(struct nk_context *ctx){
291
291
if (nk_checkbox_label (ctx , "Physics" , (nk_bool * )& dummy_show_physics_overlay )){
292
292
ye_set_overlay_state ("ye_overlay_physics" ,dummy_show_physics_overlay );
293
293
}
294
+ // dumb hack: manual sync it in case scene reload messed with it
295
+ dummy_show_physics_overlay = ye_get_overlay_state ("ye_overlay_physics" );
294
296
295
297
nk_layout_row_dynamic (ctx , 25 , 1 );
296
298
nk_label (ctx , "Visual Debugging:" , NK_TEXT_LEFT );
@@ -572,6 +574,9 @@ void ye_editor_paint_menu(struct nk_context *ctx){
572
574
editor_write_scene_to_disk (ye_path_resources (YE_STATE .runtime .scene_file_path ));
573
575
}
574
576
if (nk_menu_item_label (ctx , "Exit" , NK_TEXT_LEFT )) {
577
+ // OBLITERATE any overlays
578
+ ye_set_all_overlays (false);
579
+
575
580
EDITOR_STATE .mode = ESTATE_WELCOME ;
576
581
577
582
free (EDITOR_STATE .opened_project_path );
You can’t perform that action at this time.
0 commit comments