public void Draw(GLContext glContext) { var verts = background.TextureVertices(1f, fuelStation.position + position); var(fuel_verts, fuel_uvs) = CalculateFuelVertices(); background.Bind(); glContext.DrawQuad(verts, Globals.QUAD_UV); fuel.Bind(); glContext.DrawQuad(fuel_verts, fuel_uvs); border.Bind(); glContext.DrawQuad(verts, Globals.QUAD_UV); }
protected override void RenderSelf(GLContext glContext) { glContext.SetColor(0xff, 0xff, 0xff, 0xff); startMenuBackgroundTexture.Bind(); glContext.DrawQuad(startMenuBackgroundTexture.TextureVertices(), Globals.QUAD_UV); buttons.ForEach(button => button.Draw(glContext)); }
protected override void RenderSelf(GLContext glContext) { glContext.SetColor(0xff, 0xff, 0xff, 0xff); backgroundTexture.Bind(); var verts = backgroundTexture.TextureVertices(); glContext.DrawQuad(verts, Globals.QUAD_UV); }
protected override void RenderSelf(GLContext glContext) { if (tutorialIndex >= tutorialTextures.Length) { return; } tutorialTextures[tutorialIndex].Bind(); glContext.DrawQuad(tutorialTextures[tutorialIndex].TextureVertices(), Globals.QUAD_UV); }
protected override void RenderSelf(GLContext glContext) { glContext.SetColor(0xff, 0xff, 0xff, 0xff); topBackground.Bind(); glContext.DrawQuad(topBackground.TextureVertices(1, offset: new Vector2(0, -2 * Globals.TILE_SIZE)), Globals.QUAD_UV); DrawTileGrid(glContext); fuelStation.Draw(glContext); fuelStation2.Draw(glContext); drillProgressIndicator.Draw(glContext); player.Draw(glContext); visibility.Draw(glContext); }
//------------------------------------------------------------------------------------------------------------------------ // RenderSelf() //------------------------------------------------------------------------------------------------------------------------ protected override void RenderSelf(GLContext glContext) { if (game != null) { Vector2[] bounds = GetExtents(); float maxX = float.MinValue; float maxY = float.MinValue; float minX = float.MaxValue; float minY = float.MaxValue; for (int i = 0; i < 4; i++) { if (bounds[i].x > maxX) { maxX = bounds[i].x; } if (bounds[i].x < minX) { minX = bounds[i].x; } if (bounds[i].y > maxY) { maxY = bounds[i].y; } if (bounds[i].y < minY) { minY = bounds[i].y; } } bool test = (maxX < game.RenderRange.left) || (maxY < game.RenderRange.top) || (minX >= game.RenderRange.right) || (minY >= game.RenderRange.bottom); if (test == false) { if (blendMode != null) { blendMode.enable(); } _texture.Bind(); glContext.SetColor((byte)((_color >> 16) & 0xFF), (byte)((_color >> 8) & 0xFF), (byte)(_color & 0xFF), (byte)(_alpha * 0xFF)); glContext.DrawQuad(GetArea(), _uvs); glContext.SetColor(1, 1, 1, 1); _texture.Unbind(); if (blendMode != null) { BlendMode.NORMAL.enable(); } } } }
public void DrawTileGrid(GLContext glContext) { var playerY = (int)(player.y / Globals.TILE_SIZE); var startY = Mathf.Max(playerY - Settings.Instance.RenderDistance, 0); var endY = Mathf.Min(playerY + Settings.Instance.RenderDistance, TilesVertical - 1); for (var i = 0; i < TilesHorizontal; i++) { for (var j = startY; j <= endY; j++) { float[] verts = { i *Globals.TILE_SIZE, j *Globals.TILE_SIZE, i *Globals.TILE_SIZE + Globals.TILE_SIZE, j *Globals.TILE_SIZE, i *Globals.TILE_SIZE + Globals.TILE_SIZE, j *Globals.TILE_SIZE + Globals.TILE_SIZE, i *Globals.TILE_SIZE, j *Globals.TILE_SIZE + Globals.TILE_SIZE }; Settings.Instance.Tiles.TypeToTile[tilesBackground[i, j]].Texture.Bind(); glContext.DrawQuad(verts, Globals.QUAD_UV); if (tiles[i, j] == ObjectType.Player) { continue; } Settings.Instance.Tiles.TypeToTile[tiles[i, j]].Texture.Bind(); glContext.DrawQuad(verts, Globals.QUAD_UV); } } }
//------------------------------------------------------------------------------------------------------------------------ // Render() //------------------------------------------------------------------------------------------------------------------------ override protected void RenderSelf(GLContext glContext) { if (_invalidate) { _texture.UpdateGLTexture(); _invalidate = false; } _texture.Bind(); glContext.SetColor((byte)((_color >> 16) & 0xFF), (byte)((_color >> 8) & 0xFF), (byte)(_color & 0xFF), _alpha); glContext.DrawQuad(_bounds, _uvs); _texture.Unbind(); }
public void Draw(GLContext glContext) { float width = visibilityTexture.width * scaleX; float height = visibilityTexture.height * scaleY; float offsetX = Globals.TILE_SIZE / 2f; float offsetY = Globals.TILE_SIZE / 2f; float[] verts = { x - width / 2f + offsetX, y - height / 2f + offsetY, x + width / 2f + offsetX, y - height / 2f + offsetY, x + width / 2f + offsetX, y + height / 2f + offsetY, x - width / 2f + offsetX, y + height / 2f + offsetY }; glContext.SetColor(0xff, 0xff, 0xff, (byte)(Alpha * 0xff)); visibilityTexture.Bind(); glContext.DrawQuad(verts, Globals.QUAD_UV); glContext.SetColor(0xff, 0xff, 0xff, 0xff); }
//------------------------------------------------------------------------------------------------------------------------ // RenderSelf() //------------------------------------------------------------------------------------------------------------------------ override protected void RenderSelf(GLContext glContext) { if (game != null) { Vector2[] bounds = GetExtents(); float maxX = float.MinValue; float maxY = float.MinValue; float minX = float.MaxValue; float minY = float.MaxValue; for (int i = 0; i < 4; i++) { if (bounds[i].x > maxX) { maxX = bounds[i].x; } if (bounds[i].x < minX) { minX = bounds[i].x; } if (bounds[i].y > maxY) { maxY = bounds[i].y; } if (bounds[i].y < minY) { minY = bounds[i].y; } } bool test = (maxX < 0) || (maxY < 0) || (minX >= game.width) || (minY >= game.height); if (test == false) { _texture.Bind(); glContext.SetColor((byte)((_color >> 16) & 0xFF), (byte)((_color >> 8) & 0xFF), (byte)(_color & 0xFF), (byte)(_alpha * 0xFF)); glContext.DrawQuad(GetArea(), _uvs); glContext.SetColor(1, 1, 1, 1); _texture.Unbind(); } } }
protected override void RenderSelf(GLContext glContext) { var uvs = new[] { currentUV.x, currentUV.y, currentUV.x + uvSize.x, currentUV.y, currentUV.x + uvSize.x, currentUV.y + uvSize.y, currentUV.x, currentUV.y + uvSize.y }; var verts = new[] { 0, 0, texture.width *uvSize.x *scaleX, 0, texture.width *uvSize.x *scaleX, texture.height *uvSize.y *scaleY, 0, texture.height *uvSize.y *scaleY }; texture.Bind(); glContext.SetColor((byte)((Color >> 16) & 0xFF), (byte)((Color >> 8) & 0xFF), (byte)(Color & 0xFF), (byte)((Color >> 24) & 0xFF)); glContext.DrawQuad(verts, uvs); glContext.SetColor(1, 1, 1, 1); texture.Unbind(); }