Add 'example.cpp'
This commit is contained in:
parent
33720fdd76
commit
cc75ef73b6
42
example.cpp
Normal file
42
example.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "olcPixelGameEngine.h"
|
||||
|
||||
using namespace olc;
|
||||
|
||||
class Example : public olc::PixelGameEngine
|
||||
{
|
||||
public:
|
||||
Example()
|
||||
{
|
||||
sAppName = "Example";
|
||||
}
|
||||
|
||||
bool OnUserCreate() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnTextEntryComplete(const std::string& sText)override{
|
||||
std::cout<<"Called."<<std::endl;
|
||||
};
|
||||
|
||||
bool OnUserUpdate(float fElapsedTime) override
|
||||
{
|
||||
Clear(BLACK);
|
||||
if(GetKey(F1).bPressed){
|
||||
TextEntryEnable(true);
|
||||
}
|
||||
if(IsTextEntryEnabled()){
|
||||
DrawString({0,0},TextEntryGetString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Example demo;
|
||||
if (demo.Construct(640, 480, 4, 4))
|
||||
demo.Start();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user