StartMenu.cpp 899 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "client/rendering/gui/StartMenu.h"
  2. StartMenu::StartMenu()
  3. {
  4. }
  5. StartMenu::~StartMenu()
  6. {
  7. }
  8. void StartMenu::render2DTick(Shader& shader, DirectRenderer& dr, float lag)
  9. {
  10. shader.setToIdentity();
  11. shader.updateModelMatrix();
  12. float w = Engine::getScaledWidth();
  13. float h = Engine::getScaledHeight();
  14. Engine::setColorMode();
  15. dr.drawRectangle(0, 0, w, h, 0xFF004B96);
  16. float halfW = w * 0.5;
  17. float halfH = h * 0.5;
  18. float startHalfW = w * 0.25;
  19. float startHalfH = h * 0.25;
  20. dr.drawRectangle(startHalfW, startHalfH, startHalfW + halfW, startHalfH + halfH, 0x30000000);
  21. float textWidth;
  22. float textHeight;
  23. string title = "Cubes Plus Plus";
  24. dr.getStringSize(textWidth, textHeight, title);
  25. Engine::setMixMode();
  26. dr.drawString(startHalfW + (halfW - textWidth) * 0.5, startHalfH + 10, true, title);
  27. }