This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
neofx-zoom-plusplus/src/Game.h

79 lines
1.7 KiB
C
Raw Normal View History

2009-12-13 18:49:36 +01:00
/*
* Game.h
*
* Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ZOOM_GAME_H_
#define ZOOM_GAME_H_
#include "Renderer.h"
2009-12-24 03:24:53 +01:00
2009-12-14 13:54:34 +01:00
#include <boost/shared_ptr.hpp>
#include <string>
2009-12-13 18:49:36 +01:00
namespace Zoom {
2009-12-14 13:54:34 +01:00
class Level;
2009-12-13 18:49:36 +01:00
class Triangle;
class Game {
public:
2009-12-15 22:42:49 +01:00
enum Input {
FORWARD = (1 << 0),
BACKWARD = (1 << 1),
LEFT = (1 << 2),
RIGHT = (1 << 3)
};
2009-12-24 02:47:35 +01:00
Game();
2009-12-13 18:49:36 +01:00
2009-12-14 13:54:34 +01:00
bool loadLevel(const std::string &name);
2009-12-24 02:47:35 +01:00
void resize(int width, int height);
2009-12-15 22:42:49 +01:00
void setInput(unsigned input) {
this->input = input;
2009-12-15 22:42:49 +01:00
}
2009-12-26 03:19:49 +01:00
bool doesCollide(const vmml::vec3f &move) const;
2009-12-17 19:12:13 +01:00
void turn(float x, float y);
2009-12-13 18:49:36 +01:00
void run(int delta);
void render();
private:
2009-12-26 03:19:49 +01:00
static const float PLAYER_SPEED;
static const float PLAYER_RADIUS;
2009-12-13 18:49:36 +01:00
Renderer renderer;
2009-12-14 13:54:34 +01:00
boost::shared_ptr<Level> level;
2009-12-24 20:38:40 +01:00
std::vector<TriangleRecord> triangles;
2009-12-13 18:49:36 +01:00
2009-12-15 22:42:49 +01:00
vmml::vec3f playerPos;
2009-12-17 19:12:13 +01:00
vmml::mat4f playerRotY;
float playerRotX;
2009-12-15 22:42:49 +01:00
unsigned input;
2009-12-15 22:42:49 +01:00
float lightPos;
2009-12-13 18:49:36 +01:00
};
}
#endif /* ZOOM_GAME_H_ */