Demo update

-added 'dot' function to vector math
-fixed Circle tool rendering
-fixed some potentiall memory leaks
-added 'collision' module which now separates ShootGrid from SpaceInvaders demo
-separate some systems from demos to 'basic' module to better demos functionality sharing
-slow down snake
-added new graphics
-BrickBreaker demo now works (without blocks breaking and with bugged collision detection)

-some bug fixes
This commit is contained in:
Mergul 2020-07-08 22:09:10 +02:00
parent a0efa4e67d
commit 74179b4fc8
14 changed files with 871 additions and 468 deletions

View file

@ -43,6 +43,7 @@ struct Mouse
struct DemoCallbacks
{
void function() register;
void function() initialize;
void function() deinitialize;
bool function() loop;
@ -130,6 +131,7 @@ struct Launcher
/*launcher.manager.getSystem(CountSystem.system_id).enable();
launcher.manager.getSystem(CleanSystem.system_id).enable();//*/
if(callbacks.register)callbacks.register();
if(callbacks.initialize)callbacks.initialize();
demo = callbacks;
/*this.loop = loop;
@ -240,8 +242,8 @@ struct Launcher
if(location)
{
position += randomCircularSample() * half_size;
if(position.y < 16)position.y = 16;
else if(position.y > 299)position.y = 299;
//if(position.y < 16)position.y = 16;
//else if(position.y > 299)position.y = 299;
*location = position;
}
manager.addEntity(tmpl);
@ -875,8 +877,6 @@ void mainLoop(void* arg)
launcher.renderer.present();
draw_time = launcher.getTime() - draw_time;
//import std.stdio;
//printf("Scalling: %f",launcher.scalling);
if(launcher.tool_show)launcher.tool_circle.draw(&launcher.renderer, (launcher.mouse.position*launcher.scalling)-launcher.render_position, cast(float)launcher.tool_size, launcher.renderer.view_size.y*6*launcher.scalling);
__gshared float plot_time = 0;
@ -1105,11 +1105,13 @@ int app_main(int argc, char** argv)
import demos.simple;
import demos.space_invaders;
import demos.particles;
import demos.brick_breaker;
// launcher.switchDemo(&spaceInvadersStart,&spaceInvadersLoop,&spaceInvadersEnd,&spaceInvadersEvent,SpaceInvaders.tips);
// launcher.switchDemo(&particlesStart,&particlesLoop,&particlesEnd,&particlesEvent,ParticlesDemo.tips);
// launcher.switchDemo(&simpleStart,&simpleLoop,&simpleEnd,&simpleEvent,Simple.tips);
// launcher.switchDemo(getParticlesDemo());
launcher.switchDemo(getSimpleDemo());
// launcher.switchDemo(getSimpleDemo());
launcher.switchDemo(getBrickBreakerDemo());
}
int key_num;