1234567891011121314151617181920212223242526272829303132 |
- #include "Game.h"
- #include "rendering/Renderer.h"
- #include "rendering/wrapper/GLFWWrapper.h"
- #include "utils/String.h"
- Game::Game(const Controller& c, const Clock& fps, const Clock& tps) : controller(c), fps(fps), tps(tps) {
- }
- float w = 0;
- void Game::tick() {
- w += 5;
- }
- void Game::render(float lag, Renderer& renderer) const {
- renderer.translateTo(0.0f, 0.0f).scale(2.0f).translate(100.0f, 240.0f).rotate(w + 5 * lag).translate(-100.0f, -240.0f).update();
- u64 time = GLFWWrapper::getTimeNanos();
- for(uint i = 0; i < 60; i++) {
- renderer.drawString(0, i * 10, "Das is&037t ein Test. Das is&077t ein Test. Das is&737t ein Test.");
- }
- time = GLFWWrapper::getTimeNanos() - time;
-
- renderer.translateTo(0.0f, 0.0f).scale(2.0f).update();
- String s;
- s.append((int) time).append(" ").append(fps.getUpdatesPerSecond());
- renderer.drawString(100, 10, s);
- (void) lag;
- }
- bool Game::isRunning() const {
- return true;
- }
|