Unittests and demos update

-fixed bug in EntityManager
-added better support for non-betterC unittests
-added many new unittests
-slightly improved JUnit xml output
-fixed WASM compile script
-added new textures
-fixed model texture coordinaes in demos
-some minor bug fixes in demo
TODO: demos cpu usage in non-betterC mode
This commit is contained in:
Mergul 2020-04-16 22:16:20 +02:00
parent 46530ff45b
commit 84e04191c8
13 changed files with 453 additions and 51 deletions

View file

@ -38,9 +38,7 @@ struct Snake
EntityTemplate* apple_tmpl;
EntityTemplate* snake_tmpl;
Texture snake_texture;
Texture wall_texture;
Texture apple_texture;
Texture texture;
bool move_system = true;
bool draw_system = true;
@ -85,15 +83,16 @@ struct Snake
void drawMap()
{
const float px = 1.0/512.0;
foreach(x; 0 .. map_size)
{
foreach(y; 0 .. map_size)
{
switch(element(ivec2(x,y)).type)
{
case MapElement.Type.apple:launcher.renderer.draw(apple_texture, vec2(x*32,y*32), vec2(32,32), vec4(0,0,1,1), 0, 0 , 0);break;
case MapElement.Type.snake:launcher.renderer.draw(snake_texture, vec2(x*32,y*32), vec2(32,32), vec4(0,0,1,1), 0, 0 , 0);break;
case MapElement.Type.wall:launcher.renderer.draw(wall_texture, vec2(x*32,y*32), vec2(32,32), vec4(0,0,1,1), 0, 0 , 0);break;
case MapElement.Type.apple:launcher.renderer.draw(texture, vec2(x*32,y*32), vec2(32,32), vec4(0,32*px,16*px,16*px), 0, 0 , 0);break;
case MapElement.Type.snake:launcher.renderer.draw(texture, vec2(x*32,y*32), vec2(32,32), vec4(0,48*px,16*px,16*px), 0, 0 , 0);break;
case MapElement.Type.wall:launcher.renderer.draw(texture, vec2(x*32,y*32), vec2(32,32), vec4(0,0,1,1), 0, 0 , 0);break;
default:break;
}
}
@ -444,14 +443,8 @@ void snakeStart()
{
snake = Mallocator.make!Snake;
snake.snake_texture.create();
snake.snake_texture.load("assets/textures/buckler.png");
snake.apple_texture.create();
snake.apple_texture.load("assets/textures/buckler.png");
snake.wall_texture.create();
snake.wall_texture.load("assets/textures/buckler.png");
snake.texture.create();
snake.texture.load("assets/textures/atlas.png");
launcher.manager.beginRegister();
@ -503,10 +496,6 @@ void snakeStart()
void snakeEnd()
{
snake.wall_texture.destroy();
snake.apple_texture.destroy();
snake.snake_texture.destroy();
//launcher.manager.freeTemplate(simple.tmpl);
Mallocator.dispose(snake);
}