Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dev/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ namespace olc
return keyboard;
}

olc::hw::Touch& PGEWindow::GetTouch() {
return touch;
}

const olc::vi2d& PGEWindow::ScreenSize()
{
return GetScreen().Size();
Expand Down
1 change: 1 addition & 0 deletions dev/src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ namespace olc
// Input devices are handled by a regular olc::Window, but for convenience...
olc::hw::Mouse& GetMouse();
olc::hw::Keyboard& GetKeyboard();
olc::hw::Touch& GetTouch();

// Returns the current size of the "screen" in pixels
const olc::vi2d& ScreenSize();
Expand Down
2 changes: 1 addition & 1 deletion examples/olcPGE3_Touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Example_Touch : public olc::PixelGameEngine

// All "touches" get given a unique ID and are tracked by the OS. This ID
// could be anything, so we never really want to work with t directly.
auto touches = touch.GetTouchIDs();
auto touches = GetTouch().GetTouchIDs();

// Display total number of touches
draw.String({ 2.0f, 2.0f }, "Touch Points: " + std::to_string(touches.size()), olc::Colour::WHITE);
Expand Down
5 changes: 5 additions & 0 deletions olcPixelGameEngine3.h
Original file line number Diff line number Diff line change
Expand Up @@ -4401,6 +4401,7 @@ namespace olc
// Input devices are handled by a regular olc::Window, but for convenience...
olc::hw::Mouse& GetMouse();
olc::hw::Keyboard& GetKeyboard();
olc::hw::Touch& GetTouch();

// Returns the current size of the "screen" in pixels
const olc::vi2d& ScreenSize();
Expand Down Expand Up @@ -20194,6 +20195,10 @@ namespace olc
return keyboard;
}

olc::hw::Touch& PGEWindow::GetTouch() {
return touch;
}

const olc::vi2d& PGEWindow::ScreenSize()
{
return GetScreen().Size();
Expand Down
Loading