|
|
|
#define OLC_PGE_APPLICATION
|
|
|
|
#include "pixelGameEngine.h"
|
|
|
|
#define OLC_PGEX_SPLASHSCREEN
|
|
|
|
#include "splash.h"
|
|
|
|
#define OLC_SOUNDWAVE
|
|
|
|
#include "soundwaveEngine.h"
|
|
|
|
#include "tiles.h"
|
|
|
|
|
|
|
|
using namespace olc;
|
|
|
|
|
|
|
|
class Map{
|
|
|
|
public:
|
|
|
|
std::string filename;
|
|
|
|
Map(std::string fname) {
|
|
|
|
this->filename=fname;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class Animation{
|
|
|
|
public:
|
|
|
|
Decal*spr;
|
|
|
|
int frames=1;
|
|
|
|
int width=0;
|
|
|
|
Animation(Decal*spr,int width){
|
|
|
|
this->frames=spr->sprite->width/width;
|
|
|
|
this->width=width;
|
|
|
|
this->spr=spr;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class Object{
|
|
|
|
public:
|
|
|
|
Animation*spr;
|
|
|
|
vi2d pos;
|
|
|
|
int frameIndex=0;
|
|
|
|
Object(vi2d pos,Animation*spr) {
|
|
|
|
this->spr;
|
|
|
|
this->pos;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class SeasonI : public PixelGameEngine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SeasonI()
|
|
|
|
{
|
|
|
|
sAppName = "Season I: Winters of Loneliness";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
int frameCount=0;
|
|
|
|
float elapsedTime=0;
|
|
|
|
const float TARGET_RATE = 1/60.0;
|
|
|
|
int MAP_WIDTH;
|
|
|
|
int MAP_HEIGHT;
|
|
|
|
Map*CURRENT_MAP;
|
|
|
|
Map*MAP_ONETT;
|
|
|
|
|
|
|
|
std::vector<std::vector<TILE*>> MAP;
|
|
|
|
std::vector<Object*> OBJECTS;
|
|
|
|
|
|
|
|
bool OnUserCreate() override
|
|
|
|
{
|
|
|
|
SetPixelMode(Pixel::ALPHA);
|
|
|
|
ConsoleCaptureStdOut(true);
|
|
|
|
// Called once at the start, so create things here
|
|
|
|
|
|
|
|
MAP_ONETT=new Map("map0");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OnUserUpdate(float fElapsedTime) override
|
|
|
|
{
|
|
|
|
while (elapsedTime>TARGET_RATE) {
|
|
|
|
elapsedTime-=TARGET_RATE;
|
|
|
|
updateGame();
|
|
|
|
}
|
|
|
|
drawGame();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateGame(){
|
|
|
|
|
|
|
|
};
|
|
|
|
void drawGame(){
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
void LoadMap(Map*map) {
|
|
|
|
std::ifstream f("assets/maps/"+map->filename);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
SeasonI demo;
|
|
|
|
if (demo.Construct(256, 224, 4, 4))
|
|
|
|
demo.Start();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|