|
|
@ -2,38 +2,23 @@ |
|
|
|
|
|
|
|
|
|
|
|
using namespace olc; |
|
|
|
using namespace olc; |
|
|
|
|
|
|
|
|
|
|
|
#define WIDTH 640 |
|
|
|
|
|
|
|
#define HEIGHT 480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Example : public olc::PixelGameEngine |
|
|
|
class Example : public olc::PixelGameEngine |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
Example() |
|
|
|
Example() |
|
|
|
{ |
|
|
|
{ |
|
|
|
sAppName = "Example"; |
|
|
|
sAppName = "PGEIDE"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
olc::Key last; |
|
|
|
|
|
|
|
bool OnUserCreate() override |
|
|
|
bool OnUserCreate() override |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::cout<<"Test"<<std::endl; |
|
|
|
std::cout<<"Created: "<<ScreenWidth()<<"x"<<ScreenHeight()<<std::endl; |
|
|
|
ConsoleShow(olc::Key::A); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool OnUserUpdate(float fElapsedTime) override |
|
|
|
bool OnUserUpdate(float fElapsedTime) override |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::cout<<"Test 4"<<std::endl; |
|
|
|
|
|
|
|
ConsoleCaptureStdOut(true); |
|
|
|
|
|
|
|
std::cout<<"Test 2"<<std::endl; |
|
|
|
|
|
|
|
ConsoleCaptureStdOut(false); |
|
|
|
|
|
|
|
std::cout<<"Test 3"<<std::endl; |
|
|
|
|
|
|
|
std::cout<<"A"<<std::endl; |
|
|
|
|
|
|
|
Clear(BLACK); |
|
|
|
|
|
|
|
DrawString({0,0},std::to_string(last)); |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -42,49 +27,21 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GetAnyKeyPress(olc::Key pressed)override{ |
|
|
|
void GetAnyKeyPress(olc::Key pressed)override{ |
|
|
|
last=pressed; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
enum Direction{ |
|
|
|
int main(int argc, char** argv) |
|
|
|
RIGHT, |
|
|
|
|
|
|
|
DOWN, |
|
|
|
|
|
|
|
LEFT, |
|
|
|
|
|
|
|
UP |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Data{ |
|
|
|
|
|
|
|
int x,y; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::vector<int> testList; |
|
|
|
|
|
|
|
std::cout<<"Test"<<std::endl; |
|
|
|
|
|
|
|
testList.push_back(1); |
|
|
|
|
|
|
|
testList.push_back(1); |
|
|
|
|
|
|
|
testList.push_back(1); |
|
|
|
|
|
|
|
testList.push_back(1); |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
testList.erase(testList.begin()); |
|
|
|
|
|
|
|
std::cout<<testList.size()<<std::endl; |
|
|
|
|
|
|
|
Example demo; |
|
|
|
Example demo; |
|
|
|
if (demo.Construct(640, 480, 4, 4)) |
|
|
|
rcode code; |
|
|
|
|
|
|
|
if (argc==3){ |
|
|
|
|
|
|
|
code=demo.Construct(std::stoi(argv[1]), std::stoi(argv[2]), 1, 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
code=demo.Construct(1920, 1080, 1, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (code!=FAIL){ |
|
|
|
|
|
|
|
std::cout<<"Run"<<std::endl; |
|
|
|
demo.Start(); |
|
|
|
demo.Start(); |
|
|
|
|
|
|
|
} |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|