Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#331 - Add ability to define window position in Start call #332

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions olcPixelGameEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ namespace olc
public:
olc::rcode Construct(int32_t screen_w, int32_t screen_h, int32_t pixel_w, int32_t pixel_h,
bool full_screen = false, bool vsync = false, bool cohesion = false);
olc::rcode Start();
olc::rcode Start(const olc::vi2d& vWindowPosition);

public: // User Override Interfaces
// Called once on application startup, use to load your resources
Expand Down Expand Up @@ -1991,12 +1991,12 @@ namespace olc
}

#if !defined(PGE_USE_CUSTOM_START)
olc::rcode PixelGameEngine::Start()
olc::rcode PixelGameEngine::Start(const olc::vi2d& vWindowPosition = { 30, 30 })
{
if (platform->ApplicationStartUp() != olc::OK) return olc::FAIL;

// Construct the window
if (platform->CreateWindowPane({ 30,30 }, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
if (platform->CreateWindowPane(vWindowPosition, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
olc_UpdateWindowSize(vWindowSize.x, vWindowSize.y);

// Start the thread
Expand Down Expand Up @@ -6130,12 +6130,12 @@ namespace olc {
std::atomic<bool>* Platform_GLUT::bActiveRef{ nullptr };

//Custom Start
olc::rcode PixelGameEngine::Start()
olc::rcode PixelGameEngine::Start(const olc::vi2d& vWindowPosition = {30, 30})
{
if (platform->ApplicationStartUp() != olc::OK) return olc::FAIL;

// Construct the window
if (platform->CreateWindowPane({ 30,30 }, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
if (platform->CreateWindowPane(vWindowPosition, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
olc_UpdateWindowSize(vWindowSize.x, vWindowSize.y);

if (platform->ThreadStartUp() == olc::FAIL) return olc::FAIL;
Expand Down Expand Up @@ -6540,12 +6540,12 @@ namespace olc

//Emscripten needs a special Start function
//Much of this is usually done in EngineThread, but that isn't used here
olc::rcode PixelGameEngine::Start()
olc::rcode PixelGameEngine::Start(const olc::vi2d& vWindowPosition = { 30, 30 })
{
if (platform->ApplicationStartUp() != olc::OK) return olc::FAIL;

// Construct the window
if (platform->CreateWindowPane({ 30,30 }, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
if (platform->CreateWindowPane(vWindowPosition, vWindowSize, bFullScreen) != olc::OK) return olc::FAIL;
olc_UpdateWindowSize(vWindowSize.x, vWindowSize.y);

// Some implementations may form an event loop here
Expand Down