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