Demos big update

-Added some more math functions
-fixed many memory leaks
-added AABB and BVHTree support to collision.d
 *BVHTree has only incrementally adding entities implemented by now (and bad BottomUp algorithm)
 *ECS Systems use two trees, one for static and one for dynamic entities, dynamic BVH is builded every frame from scratch by now
-BrickBreaker now uses BVHTree to collision detection
 *balls only use tree for checks (they aren't adding to tree)
-fixed bug leading to crash
This commit is contained in:
Mergul 2020-07-17 13:38:41 +02:00
parent 96bbcb9956
commit 64dc099e0a
9 changed files with 973 additions and 70 deletions

View file

@ -117,12 +117,12 @@ struct Launcher
gui_manager.clear();
//launcher.ent
if(this.demo.deinitialize)this.demo.deinitialize();
manager.begin();
manager.update("clean");
manager.end();
if(this.demo.deinitialize)this.demo.deinitialize();
foreach(ref system; manager.systems)
{
if(system.id != CountSystem.system_id && system.id != CleanSystem.system_id)system.disable();
@ -946,12 +946,19 @@ void mainLoop(void* arg)
void quit()
{
import game_core.rendering : TexCoordsManager;
launcher.gui_manager.clear();
Mallocator.dispose(launcher.gui_manager);
if(launcher.demo.deinitialize)launcher.demo.deinitialize();
launcher.manager.destroy();
launcher.manager = null;
TexCoordsManager.destroy();
SDL_Quit();
version(WebAssembly)emscripten_cancel_main_loop();
}
@ -1060,10 +1067,11 @@ int app_main(int argc, char** argv)
}
}
ImFontConfig* config = ImFontConfig_ImFontConfig();
//ImFontConfig* config = ImFontConfig_ImFontConfig();
ImGuiIO* io = igGetIO();
const ushort* font_ranges = ImFontAtlas_GetGlyphRangesDefault(io.Fonts);
ImFontAtlas_AddFontFromFileTTF(io.Fonts,"assets/fonts/Ruda-Bold.ttf", 15.0f, config, font_ranges);
ImFontAtlas_AddFontFromFileTTF(io.Fonts,"assets/fonts/Ruda-Bold.ttf", 15.0f, null, font_ranges);
//ImFontConfig_destroy(config);
setStyle(3);
@ -1139,9 +1147,6 @@ int app_main(int argc, char** argv)
}
}
TexCoordsManager.destroy();
EntityManager.destroy();
return 0;
}