void drawbrick(int x, int y, TextureInfo brick) { GL.TexCoord2(brick.Left, brick.Top); GL.Vertex3((float)x, (float)y, 0.0f); GL.TexCoord2(brick.Right, brick.Top); GL.Vertex3((float)(x + brick.Width), (float)y, 0.0f); GL.TexCoord2(1.0f, 1.0f); GL.TexCoord2(brick.Right, brick.Bottom); GL.Vertex3((float)(x + brick.Width), (float)(y + brick.Height), 0.0f); GL.TexCoord2(0.0f, 1.0f); GL.TexCoord2(brick.Left, brick.Bottom); GL.Vertex3((float)x, (float)(y + brick.Height), 0.0f); }
protected override void Begin() { try { Game.Window.KeyPress += InputEvent; m_field = new Field(Game, 1, Difficulty.Easy); m_field.OnCombo += DoCombo; m_field.OnChain += DoChain; AtlasBuilder builder = new AtlasBuilder(Game); builder.Textures.Add(LoadResized("images/block00.png")); builder.Textures.Add(LoadResized("images/block10.png")); builder.Textures.Add(LoadResized("images/block20.png")); builder.Textures.Add(LoadResized("images/block30.png")); builder.Textures.Add(LoadResized("images/block40.png")); builder.Textures.Add(LoadResized("images/block50.png")); builder.Textures.Add(LoadResized("images/cruiser0.png")); builder.Textures.Add(new LoadingTexture("images/white.png")); using (tex = builder.Build()) { //builder.Dispose(); builder = null; blocks = new TextureInfo[6, 1]; blocks[0, 0] = tex["block00.png"]; blocks[1, 0] = tex["block10.png"]; blocks[2, 0] = tex["block20.png"]; blocks[3, 0] = tex["block30.png"]; blocks[4, 0] = tex["block40.png"]; blocks[5, 0] = tex["block50.png"]; cruiser = tex["cruiser0.png"]; whitepixel = tex["white.png"]; while (true) { HandleInput(); m_field.Cycle(); Game.NextFrame(); } } } finally { Game.Window.KeyPress -= InputEvent; } }
void drawbrick(int x, int y, TextureInfo brick, int size, Color4 tint, int clip) { if (clip > size) clip = size; if (clip <= 0) return; GL.TexCoord2(brick.Left, brick.Top); GL.Color4(tint); GL.Vertex3((float)x, (float)y, 0.0f); GL.TexCoord2(brick.Right, brick.Top); GL.Vertex3((float)(x + size), (float)y, 0.0f); GL.TexCoord2(brick.Right, brick.Top + (brick.Bottom - brick.Top) * clip / size); GL.Vertex3((float)(x + size), (float)(y + clip), 0.0f); GL.TexCoord2(brick.Left, brick.Top + (brick.Bottom - brick.Top) * clip / size); GL.Vertex3((float)x, (float)(y + clip), 0.0f); }