|
|
@ -965,6 +965,8 @@ namespace olc |
|
|
|
int32_t GetDrawTargetHeight() const; |
|
|
|
int32_t GetDrawTargetHeight() const; |
|
|
|
// Returns the currently active draw target
|
|
|
|
// Returns the currently active draw target
|
|
|
|
olc::Sprite* GetDrawTarget() const; |
|
|
|
olc::Sprite* GetDrawTarget() const; |
|
|
|
|
|
|
|
//Returns whether or not this is running on mobile.
|
|
|
|
|
|
|
|
bool IsMobile(); |
|
|
|
// Resize the primary screen sprite
|
|
|
|
// Resize the primary screen sprite
|
|
|
|
void SetScreenSize(int w, int h); |
|
|
|
void SetScreenSize(int w, int h); |
|
|
|
// Specify which Sprite should be the target of drawing functions, use nullptr
|
|
|
|
// Specify which Sprite should be the target of drawing functions, use nullptr
|
|
|
@ -1240,11 +1242,15 @@ namespace olc |
|
|
|
void olc_Terminate(); |
|
|
|
void olc_Terminate(); |
|
|
|
void olc_Reanimate(); |
|
|
|
void olc_Reanimate(); |
|
|
|
bool olc_IsRunning(); |
|
|
|
bool olc_IsRunning(); |
|
|
|
|
|
|
|
bool olc_IsMobile(); |
|
|
|
|
|
|
|
|
|
|
|
// At the very end of this file, chooses which
|
|
|
|
// At the very end of this file, chooses which
|
|
|
|
// components to compile
|
|
|
|
// components to compile
|
|
|
|
virtual void olc_ConfigureSystem(); |
|
|
|
virtual void olc_ConfigureSystem(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool mobile; |
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Items Here are to be deprecated, I have left them in for now
|
|
|
|
// NOTE: Items Here are to be deprecated, I have left them in for now
|
|
|
|
// in case you are using them, but they will be removed.
|
|
|
|
// in case you are using them, but they will be removed.
|
|
|
|
// olc::vf2d vSubPixelOffset = { 0.0f, 0.0f };
|
|
|
|
// olc::vf2d vSubPixelOffset = { 0.0f, 0.0f };
|
|
|
@ -1884,6 +1890,10 @@ namespace olc |
|
|
|
Sprite* PixelGameEngine::GetDrawTarget() const |
|
|
|
Sprite* PixelGameEngine::GetDrawTarget() const |
|
|
|
{ return pDrawTarget; } |
|
|
|
{ return pDrawTarget; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool PixelGameEngine::IsMobile() { |
|
|
|
|
|
|
|
return mobile; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int32_t PixelGameEngine::GetDrawTargetWidth() const |
|
|
|
int32_t PixelGameEngine::GetDrawTargetWidth() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (pDrawTarget) |
|
|
|
if (pDrawTarget) |
|
|
@ -3364,6 +3374,8 @@ namespace olc |
|
|
|
|
|
|
|
|
|
|
|
bool PixelGameEngine::olc_IsRunning() |
|
|
|
bool PixelGameEngine::olc_IsRunning() |
|
|
|
{ return bAtomActive; } |
|
|
|
{ return bAtomActive; } |
|
|
|
|
|
|
|
bool PixelGameEngine::olc_IsMobile() |
|
|
|
|
|
|
|
{ return mobile; } |
|
|
|
|
|
|
|
|
|
|
|
void PixelGameEngine::olc_Terminate() |
|
|
|
void PixelGameEngine::olc_Terminate() |
|
|
|
{ bAtomActive = false; } |
|
|
|
{ bAtomActive = false; } |
|
|
@ -3637,6 +3649,7 @@ namespace olc |
|
|
|
// Need a couple of statics as these are singleton instances
|
|
|
|
// Need a couple of statics as these are singleton instances
|
|
|
|
// read from multiple locations
|
|
|
|
// read from multiple locations
|
|
|
|
std::atomic<bool> PixelGameEngine::bAtomActive{ false }; |
|
|
|
std::atomic<bool> PixelGameEngine::bAtomActive{ false }; |
|
|
|
|
|
|
|
bool PixelGameEngine::mobile{ false }; |
|
|
|
olc::PixelGameEngine* olc::PGEX::pge = nullptr; |
|
|
|
olc::PixelGameEngine* olc::PGEX::pge = nullptr; |
|
|
|
olc::PixelGameEngine* olc::Platform::ptrPGE = nullptr; |
|
|
|
olc::PixelGameEngine* olc::Platform::ptrPGE = nullptr; |
|
|
|
olc::PixelGameEngine* olc::Renderer::ptrPGE = nullptr; |
|
|
|
olc::PixelGameEngine* olc::Renderer::ptrPGE = nullptr; |
|
|
@ -5952,12 +5965,14 @@ namespace olc |
|
|
|
// Move
|
|
|
|
// Move
|
|
|
|
if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) |
|
|
|
if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
ptrPGE->mobile=true; |
|
|
|
ptrPGE->olc_UpdateMouse(e->touches->targetX, e->touches->targetY); |
|
|
|
ptrPGE->olc_UpdateMouse(e->touches->targetX, e->touches->targetY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Start
|
|
|
|
// Start
|
|
|
|
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) |
|
|
|
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
ptrPGE->mobile=true; |
|
|
|
ptrPGE->olc_UpdateMouse(e->touches->targetX, e->touches->targetY); |
|
|
|
ptrPGE->olc_UpdateMouse(e->touches->targetX, e->touches->targetY); |
|
|
|
ptrPGE->olc_UpdateMouseState(0, true); |
|
|
|
ptrPGE->olc_UpdateMouseState(0, true); |
|
|
|
} |
|
|
|
} |
|
|
@ -5965,6 +5980,7 @@ namespace olc |
|
|
|
// End
|
|
|
|
// End
|
|
|
|
if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) |
|
|
|
if (eventType == EMSCRIPTEN_EVENT_TOUCHEND) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
ptrPGE->mobile=true; |
|
|
|
ptrPGE->olc_UpdateMouseState(0, false); |
|
|
|
ptrPGE->olc_UpdateMouseState(0, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -5975,8 +5991,10 @@ namespace olc |
|
|
|
static EM_BOOL mouse_callback(int eventType, const EmscriptenMouseEvent* e, void* userData) |
|
|
|
static EM_BOOL mouse_callback(int eventType, const EmscriptenMouseEvent* e, void* userData) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//Mouse Movement
|
|
|
|
//Mouse Movement
|
|
|
|
if (eventType == EMSCRIPTEN_EVENT_MOUSEMOVE) |
|
|
|
if (eventType == EMSCRIPTEN_EVENT_MOUSEMOVE) { |
|
|
|
|
|
|
|
ptrPGE->mobile=false; |
|
|
|
ptrPGE->olc_UpdateMouse(e->targetX, e->targetY); |
|
|
|
ptrPGE->olc_UpdateMouse(e->targetX, e->targetY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Mouse button press
|
|
|
|
//Mouse button press
|
|
|
|