I have a main.cpp file
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
#include "supp.cpp"
class renderer: public DrawFunctions
{
public:
bool OnUserCreate() override
{
FillScreen(olc::Pixel(255 , 255 , 255));
DrawAxes(olc::Pixel(0 , 0 , 0));
return true;
}
bool OnUserUpdate(float fElapsedTime) override
{
return true;
}
};
And another file named supp.cpp
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
class DrawFunctions : public olc::PixelGameEngine
{
public:
void FillScreen(olc::Pixel pixel_type)
{
for (int i=0 ; i<ScreenHeight() ; i++)
{
for (int j=0 ; j<ScreenWidth() ; j++)
{
Draw(j , i , pixel_type);
}
}
}
void DrawAxes(olc::Pixel pixel_type)
{
for (int i = 0 ; i<ScreenHeight() ; i++)
{
Draw((int)(ScreenWidth() / 2) , i , pixel_type);
}
for (int j = 0 ; j<ScreenWidth() ; j++)
{
Draw(j , (int)(ScreenHeight() / 2) , pixel_type);
}
}
};
why does this not work ?