merging various commits and stashes

This commit is contained in:
Kayne Ruse
2013-05-01 21:30:02 +10:00
parent fe04561b26
commit 80004ca8d4
7 changed files with 66 additions and 3 deletions
+29
View File
@@ -0,0 +1,29 @@
#ifndef FRAMERATE_HPP_
#define FRAMERATE_HPP_
#include <ctime>
class FrameRate {
public:
FrameRate() {
frameCount = lastFrameRate = tick = 0;
}
int Calculate() {
frameCount++;
if (clock() - tick >= CLOCKS_PER_SEC) {
lastFrameRate = frameCount;
frameCount = 0;
tick = clock();
}
return lastFrameRate;
}
int GetFrameRate() {
return lastFrameRate;
}
private:
int frameCount;
int lastFrameRate;
int tick;
};
#endif
+9 -1
View File
@@ -31,7 +31,7 @@ InGame::~InGame() {
//-------------------------
void InGame::FrameStart() {
//
frameRate.Calculate();
}
void InGame::FrameEnd() {
@@ -100,3 +100,11 @@ void InGame::KeyUp(SDL_KeyboardEvent const& key) {
break;
}
}
//-------------------------
//Utilities
//-------------------------
void InGame::NewPlayer(int index, std::string avatarName, int x, int y) {
//
}
+10 -1
View File
@@ -4,9 +4,12 @@
#include "base_scene.hpp"
#include "delta.hpp"
#include "player.hpp"
#include "frame_rate.hpp"
#include "player_manager.hpp"
#include "surface_manager.hpp"
#include <string>
class InGame : public BaseScene {
public:
//Public access members
@@ -27,9 +30,15 @@ protected:
virtual void KeyDown (SDL_KeyboardEvent const&);
virtual void KeyUp (SDL_KeyboardEvent const&);
//utilities
void NewPlayer(int index, std::string avatarName, int x, int y);
//members
Delta delta;
FrameRate frameRate;
SurfaceManager surfaceMgr;
PlayerManager playerMgr;
Player* player;
};
+1 -1
View File
@@ -11,7 +11,7 @@ OUTDIR=out
OUT=$(addprefix $(OUTDIR)/,a)
#source
SRC=test_systems.cpp in_game.cpp
SRC=test_systems.cpp in_game.cpp player_manager.cpp
#targets
all: $(OBJ) $(OUT)
+2
View File
@@ -0,0 +1,2 @@
#include "player_manager.hpp"
+11
View File
@@ -0,0 +1,11 @@
#ifndef PLAYERMANAGER_HPP_
#define PLAYERMANAGER_HPP_
#include "player.hpp"
class PlayerManager {
public:
private:
};
#endif
+4
View File
@@ -28,6 +28,7 @@ Player:
PlayerManager:
NewPlayer(index, avatar, x, y)
Update(delta) //all player objects
Synchronize(dataArray) //possible
@@ -48,3 +49,6 @@ Receive:
player update:
PlayerManager.Update(message)
end
-------------------------