SpaceShip demo update

-added wave shooted upon death of boss tower
-cleanup code a little bit
-moved to new entityAdding method
-fixed bug with changeing demos
This commit is contained in:
Mergul 2020-05-28 16:11:27 +02:00
parent 7a0ddf7494
commit 9af1cee60b
8 changed files with 368 additions and 297 deletions

View file

@ -96,6 +96,7 @@ struct Launcher
void switchDemo(void function() start, bool function() loop, void function() end, void function(SDL_Event*) event, void function(vec2, Tool, int) tool, const (char)* tips)
{
gui_manager.clear();
//launcher.ent
if(this.end)this.end();
@ -262,7 +263,7 @@ void mainLoop(void* arg)
if(launcher.tool && launcher.tool_repeat != 0 && launcher.mouse.left && !igIsWindowHovered(ImGuiHoveredFlags_AnyWindow) && !igIsWindowFocused(ImGuiFocusedFlags_AnyWindow))
{
float range = 500.0 / cast(float)launcher.tool_repeat;
launcher.repeat_time += launcher.delta_time * 100;
launcher.repeat_time += launcher.delta_time;
while(launcher.repeat_time > range)
{
launcher.repeat_time -= range;
@ -463,7 +464,7 @@ void mainLoop(void* arg)
if(launcher.show_demo_wnd)
{
igSetNextWindowPos(ImVec2(launcher.window_size.x - 260, 30), ImGuiCond_Once, ImVec2(0,0));
igSetNextWindowSize(ImVec2(250, 250), ImGuiCond_Once);
igSetNextWindowSize(ImVec2(250, 500), ImGuiCond_Once);
if(igBegin("Demo",&launcher.show_demo_wnd,0))
{
ImDrawList* draw_list = igGetWindowDrawList();
@ -745,8 +746,8 @@ int main(int argc, char** argv)
{
import demos.simple;
import demos.space_invaders;
launcher.switchDemo(&spaceInvadersStart,&spaceInvadersLoop,&spaceInvadersEnd,&spaceInvadersEvent,&spaceInvadersTool,SpaceInvaders.tips);
// launcher.switchDemo(&simpleStart,&simpleLoop,&simpleEnd,&simpleEvent,&simpleTool,Simple.tips);
// launcher.switchDemo(&spaceInvadersStart,&spaceInvadersLoop,&spaceInvadersEnd,&spaceInvadersEvent,&spaceInvadersTool,SpaceInvaders.tips);
launcher.switchDemo(&simpleStart,&simpleLoop,&simpleEnd,&simpleEvent,&simpleTool,Simple.tips);
}
int key_num;