You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
#define OLC_PGE_APPLICATION
|
|
#include "olcPixelGameEngine.h"
|
|
#include "PGEX_SMX.h"
|
|
using namespace olc;
|
|
|
|
class SMX_PGE : public olc::PixelGameEngine
|
|
{
|
|
PGEX_SMX smx;
|
|
bool paused = false;
|
|
int mode = 0;
|
|
vf2d playerPos = { 0,0 };
|
|
public:
|
|
SMX_PGE()
|
|
{
|
|
sAppName = "SMX PGE - Bad Apple";
|
|
}
|
|
|
|
std::vector<Renderable>video;
|
|
int currentFrame{0};
|
|
double elapsedTime{0.f};
|
|
|
|
public:
|
|
bool OnUserCreate() override
|
|
{
|
|
// Called once at the start, so create things here
|
|
const std::string badAppleVideoDir{"badapple"};
|
|
for(int frame=1;frame<=6572;frame++){
|
|
video.emplace_back();
|
|
video[frame-1].Load(std::format("{}/frame{}.png",badAppleVideoDir,frame));
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool OnUserUpdate(float fElapsedTime) override
|
|
{
|
|
Clear(BLACK);
|
|
elapsedTime+=fElapsedTime;
|
|
const int frame{int(std::clamp((elapsedTime-5)/(1/30.f),1.,6573.))};
|
|
DrawSprite({},video[frame-1].Sprite());
|
|
return true;
|
|
}
|
|
};
|
|
|
|
|
|
int main()
|
|
{
|
|
SMX_PGE demo;
|
|
if (demo.Construct(24, 21, 50, 50,false,true))
|
|
demo.Start();
|
|
|
|
return 0;
|
|
}
|
|
|