Common update:
-added VBo batch rendering (current default, no render mode switch yet) -fixed camera positioning calculation -fixed buffer issue with WebGL -added viewport scalling (at least 300 pixels height). Pixels are scalled if screen is bigger. -center demos gameplay area -added fullpage html template for Emscripten build
This commit is contained in:
parent
7c263d3ed4
commit
8381ac166b
7 changed files with 61 additions and 40 deletions
|
|
@ -90,9 +90,9 @@ struct Snake
|
|||
{
|
||||
switch(element(ivec2(x,y)).type)
|
||||
{
|
||||
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;
|
||||
case MapElement.Type.apple:launcher.renderer.draw(texture, vec2(x*16,y*16), vec2(16,16), vec4(0,32*px,16*px,16*px), 0, 0 , 0);break;
|
||||
case MapElement.Type.snake:launcher.renderer.draw(texture, vec2(x*16,y*16), vec2(16,16), vec4(0,48*px,16*px,16*px), 0, 0 , 0);break;
|
||||
case MapElement.Type.wall:launcher.renderer.draw(texture, vec2(x*16,y*16), vec2(16,16), vec4(0,0,1,1), 0, 0 , 0);break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
|
|
@ -520,8 +520,8 @@ void snakeTool(vec2 position, Tool tool, int size)
|
|||
position.x += (randomf - 0.5) * size;
|
||||
position.y += (randomf - 0.5) * size;
|
||||
ivec2 ipos;
|
||||
ipos.x = cast(int)(position.x / 32);
|
||||
ipos.y = cast(int)(position.y / 32);
|
||||
ipos.x = cast(int)(position.x / 16);
|
||||
ipos.y = cast(int)(position.y / 16);
|
||||
*ilocation = ipos;
|
||||
if(snake.element(ipos).type != MapElement.Type.empty)return;
|
||||
}
|
||||
|
|
@ -540,6 +540,8 @@ void snakeEvent(SDL_Event* event)
|
|||
|
||||
bool snakeLoop()
|
||||
{
|
||||
launcher.render_position = (vec2(launcher.window_size.x,launcher.window_size.y)*launcher.scalling - vec2(288,288)) * 0.5;
|
||||
|
||||
/*if(launcher.show_demo_wnd)
|
||||
{
|
||||
igSetNextWindowPos(ImVec2(800 - 260, 30), ImGuiCond_Once, ImVec2(0,0));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue