public void Render(float partialTicks) { var partialAngle = Math.Min(_ticksMax, _ticksLast + (_ticks - _ticksLast) * partialTicks) / _ticksMax * MathHelper.PiOver2; var offX = _size + _offsetX; var offY = _size + _offsetY; var x = _game.Width - offX; _currentY = _game.Height - (float)Math.Sin(partialAngle) * offY; var tex = TextureManager.GetOrRegister(MouseOver && _shown ? "trash_open" : "trash_closed"); GL.BindTexture(TextureTarget.Texture2D, tex); GL.Translate(x, _currentY, 0); GL.Scale(_size, _size, 1); GL.Begin(PrimitiveType.Quads); GL.Color3(1, 1, 1f); VertexUtil.PutQuad(false); GL.End(); GL.Scale(1 / _size, 1 / _size, 1); GL.Translate(-x, -_currentY, 0); }
public void Render(float partialTicks) { var partialTick = _ticksLast + (_ticks - _ticksLast) * partialTicks; var progress = Math.Min(partialTick, _maxTicks) / _maxTicks; GL.Translate(X, Y, 0); GL.Scale(ElementIconSize, ElementIconSize, 1); GL.BindTexture(TextureTarget.Texture2D, Element.TextureId); GL.Begin(PrimitiveType.Quads); GL.Color4(1f, 1, 1, progress); VertexUtil.PutQuad(); GL.End(); GL.Scale(1f / ElementIconSize, 1f / ElementIconSize, 1); GL.Translate(-X, -Y, 0); FontRenderer.DrawTextCentered(X, Y + ElementIconSize / 1.5f + 5, Element.ToString()); }
public void Render(float partialTicks) { var partialAngle = Math.Min(_ticksMax, _ticksLast + (_ticks - _ticksLast) * partialTicks) / _ticksMax * MathHelper.PiOver2; if (partialAngle <= 0.1) { return; } var x = _game.Width - (float)Math.Sin(partialAngle) * _size; GL.BindTexture(TextureTarget.Texture2D, 0); GL.Translate(x, 32, 0); GL.Scale(_size, _game.Height, 1); //render background GL.Begin(PrimitiveType.Quads); GL.Color4(0, 0.75, 1, 0.15f); VertexUtil.PutQuad(false); GL.End(); GL.Begin(PrimitiveType.LineLoop); GL.Color4(0, 0.75, 1, 0.5f); VertexUtil.PutQuad(false); GL.End(); GL.Scale(1 / _size, 1f / _game.Height, 1); //render elements var count = (int)(_size / _iconSize); _lastOver = null; for (int i = 0; i < _elementEntities.Count; i++) { var e = _elementEntities[i]; var x1 = i % count * _iconSize; var y1 = i / count * _iconSize; if (IsPointInRectangle(x + x1, y1 + 32, _iconSize, _iconSize, _lastMouse.X, _lastMouse.Y)) { _lastOver = e; } GL.BindTexture(TextureTarget.Texture2D, e.TextureId); var newSize = _iconSize - _iconGap * 2; GL.Translate(x1 + _iconSize / 2, y1 + _iconSize / 2, 0); GL.Scale(newSize, newSize, 1); GL.Translate(2 / newSize, 2 / newSize, 0); GL.Color3(0, 0, 0); GL.Begin(PrimitiveType.Quads); VertexUtil.PutQuad(); GL.End(); GL.Translate(-2 / newSize, -2 / newSize, 0); GL.Color3(1, 1, 1f); GL.Begin(PrimitiveType.Quads); VertexUtil.PutQuad(); GL.End(); GL.Scale(1f / newSize, 1f / newSize, 1); GL.Translate(-x1 - _iconSize / 2, -y1 - _iconSize / 2, 0); } FontRenderer.DrawTextCentered(128, -16, "DISCOVERED"); GL.Translate(-x, -32, 0); }
public void Render(float partialTicks) { if (IsDead) { return; } float progress; var partialTick = _ticksLast + (_ticks - _ticksLast) * partialTicks; if (partialTick >= _maxTicks - 5) { progress = (float)Math.Cos(Math.Min(5 - _maxTicks - partialTick, 5) / 5f * MathHelper.PiOver2); } else { progress = -(float)Math.Sin(Math.Min(partialTick, 10) / 10f * MathHelper.PiOver2); } var centerX = _game.Width / 2; var centerY = -32 - (CurrentY = 64 * progress); GL.Translate(centerX, centerY, 0); //render toast texture GL.BindTexture(TextureTarget.Texture2D, _toastTextureId); GL.Color4(1f, 1, 1, 1); GL.Scale(256, 64, 1); GL.Begin(PrimitiveType.Quads); VertexUtil.PutQuad(); GL.End(); GL.Scale(1f / 256, 1f / 64, 1); //render icon shadow GL.BindTexture(TextureTarget.Texture2D, _iconTextureId); GL.Color4(0f, 0, 0, 1); GL.Translate(-94.5F, 2, 0); GL.Scale(49, 49, 1); GL.Begin(PrimitiveType.Quads); VertexUtil.PutQuad(); GL.End(); GL.Scale(1f / 49, 1f / 49, 1); GL.Translate(94.5F, -2, 0); //render icon GL.Color4(1f, 1, 1, 1); GL.Translate(-96.5F, 0, 0); GL.Scale(49, 49, 1); GL.Begin(PrimitiveType.Quads); VertexUtil.PutQuad(); GL.End(); GL.Scale(1f / 49, 1f / 49, 1); GL.Translate(96.5F, 0, 0); //render title GL.Color4(0, 0.65f, 1, 1); GL.Scale(0.9f, 0.9f, 1); FontRenderer.DrawTextWithShadow(-67, -28, Title); GL.Scale(1 / 0.9f, 1 / 0.9f, 1); //render text GL.Color4(1f, 1, 1, 1); GL.Scale(0.9f, 0.9f, 1); FontRenderer.DrawTextWithShadow(-67, -4, MessageText); GL.Scale(1 / 0.9f, 1 / 0.9f, 1); GL.Translate(-centerX, -centerY, 0); }