-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove SDL2 dependencies: Phase 1 #5458
Conversation
26e80d3
to
453c564
Compare
Just to clarify: is the goal to get rid of SDL altogether, or just separate it from the logic to allow for GUI-less builds? I initially thought the latter, but the |
@AaronVanGeffen SDL2 will still be used, we are just trying to extract the logic so that we can build a stand alone CLI version for servers. The UI context stuff has been designed with SDL2 to be somewhat interchangeable - just so that porting can be done to a platform that SDL2 does not support. |
ad80f0a
to
8368b29
Compare
src/openrct2-cli/Cli.cpp
Outdated
@@ -0,0 +1,30 @@ | |||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2017
src/openrct2-ui/CMakeLists.txt
Outdated
"${CMAKE_CURRENT_LIST_DIR}/*.hpp") | ||
|
||
# Outputs | ||
set (PROJECT openrct2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the space?
|
||
namespace Cursors | ||
namespace OpenRCT2 { namespace Ui |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be on a single line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I intend on changing it to OpenRCT2::Ui
when we can use C++17.
src/openrct2-ui/UiContext.macOS.mm
Outdated
|
||
std::string ShowFileDialog(SDL_Window * window, const FileDialogDesc &desc) override | ||
{ | ||
@autoreleasepool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File uses tabs for indenting
# -Wstrict-overflow is only active when -fstrict-overflow is enabled, but -fstrict-overflow | ||
# is enabled on -O2, -O3, -Os. This should help catch bugs locally before they reach Travis | ||
# As of 2a435bf -Wstrict-overflow=1 passes, but higher values do not. | ||
set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -fstrict-overflow") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't COMMON_COMPILE OPTIONS be added to the c/cxx flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, this was copied from the current one, so if you can improve it - by all means.
Trying to get Cmake to work on macOS:
|
Also:
|
src/openrct2-ui/TextComposition.cpp
Outdated
// _lastKeyPressed = e.key.keysym.sym; | ||
// _keysPressed[e.key.keysym.scancode] = 1; | ||
|
||
GetContext()->GetUiContext()->SetKeysPressed(key, e->key.keysym.scancode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed in 961a4dd.
src/openrct2-ui/UiContext.cpp
Outdated
{ | ||
_lastKeyPressed = keysym; | ||
_keysPressed[scancode] = 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs!
src/openrct2/ui/UiContext.h
Outdated
@@ -119,6 +119,7 @@ namespace OpenRCT2 | |||
virtual void SetCursorTrap(bool value) abstract; | |||
virtual const uint8 * GetKeysState() abstract; | |||
virtual const uint8 * GetKeysPressed() abstract; | |||
virtual void SetKeysPressed(uint32 keysym, uint8 scancode) abstract; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs!
@rwjuk there is a plugin for visual studio that warns you if you try to save a file with mixed tabs and spaces. It's very useful for this project. |
@duncanspumpkin Richard uses macOS and Linux, so a VS plug-in is not an option. |
Actually, Visual Studio just came out on macOS, but I wouldn't personally use it anyway. |
@pizza2004 Visual Studio for Mac is very much a different application entirely so you can't use any extensions for VS in VS for Mac. |
What about a git commit hook script? |
@IntelOrca Obviously, I just thought it was an interesting thing people might like to know. |
855d9fe
to
0fe6667
Compare
ced727b
to
ef225a6
Compare
If I attempt to load a save using the native dialog, no saves are listed. There is also no option to select 'All files' (there used to be). Furthermore, if I click 'Cancel', it will display an error message and force me to select a file, giving me no option to cancel other than forcibly killing the OpenRCT2 process. Edit: this is all on Ubuntu 17.04. |
Fails at the linking step for me
|
@Gymnasiast What OS was this on? |
Tested and working on macOS 10.12
|
This was causing undefined data to appear in _keysPressed which caused shortcuts to be invoked on startup.
9dd49a3
to
8cb24b2
Compare
[ci skip]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it thoroughly, but the features I want for now seem to be working. To not hold it off any longer I'm happy to have it merged as-is, with fixes, if any, merged in develop.
@grahamedgecombe if you're around, can you please also take a look at this? We want to have |
@janisozaur for portable builds set an rpath with |
bd3a6f2
to
cb1a2a0
Compare
With this last commit it appears to work correctly on my system. Moving both the binary and lib from the build dir to the executable dir now works as intended. |
cb1a2a0
to
93cf412
Compare
CMakeLists.txt
Outdated
if (PORTABLE) | ||
install(TARGETS "libopenrct2" LIBRARY DESTINATION "bin") | ||
else () | ||
install(TARGETS "libopenrct2" LIBRARY DESTINATION "usr/local/lib") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DESTINATION here should just be "lib". cmake already adds the prefix, which may not be /usr/local
- e.g. it's /usr
in the Arch package.
Currently this results in libopenrct2.so
being installed in /usr/usr/local/lib
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you think it should be lib
rather than local/lib
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it should be install(TARGETS "libopenrct2" LIBRARY DESTINATION "lib")
.
cmake adds the /usr
or /usr/local
(or whatever) prefix for you - based on the value of CMAKE_INSTALL_PREFIX
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have changed it back to lib
.
Which set rpath to $ORIGIN so it can be run out the box.
93cf412
to
1e550e9
Compare
src/openrct2-ui/CMakeLists.txt
Outdated
@@ -75,6 +75,11 @@ if (WIN32) | |||
# tell it that it is | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__USE_MINGW_ANSI_STDIO=1") | |||
endif () | |||
|
|||
if (PORTABLE) | |||
set(CMAKE_INSTALL_RPATH "$ORIGIN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this get interpreted as "fill with contents of variable named 'ORIGIN'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE uses ${...}
for variables and $ENV{...}
for environment variables. I think this is saw on various internet pages for how to do it in cmake. It works when I build it myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set(CMAKE_INSTALL_RPATH "$ORIGIN")
needs to go before add_executable()
for it to work I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the other frontend also receive the same treatment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janisozaur Derp. Yes, set(CMAKE_INSTALL_RPATH "$ORIGIN")
added for the CLI build.
- Feature: [#1399 (partial), #5177] Add window that displays any missing/corrupt objects when loading a park - Feature: [#5056] Add cheat to own all land. - Feature: [#5133] Add option to display guest expenditure (as seen in RCTC). - Feature: [#5196] Add cheat to disable ride ageing. - Feature: [#5504] Group vehicles into ride groups - Feature: [#5576] Add a persistent 'display real names of guests' setting. - Feature: [#5611] Add support for Android - Feature: [#5706] Add support for OpenBSD - Feature: OpenRCT2 now starts up on the display it was last shown on. - Feature: Park entrance fee can now be set to amounts up to £200. - Improved: Construction rights can now be placed on park entrances. - Improved: Mouse can now be dragged to select scenery when saving track designs - Fix: [#259] Money making glitch involving swamps (original bug) - Fix: [#441] Construction rights over entrance path erased (original bug) - Fix: [#578] Ride ghosts show up in ride list during construction (original bug) - Fix: [#597] 'Finish 5 roller coasters' goal not properly checked (original bug) - Fix: [#667] Incorrect banner limit calculation (original bug) - Fix: [#739] Crocodile Ride (Log Flume) never allows more than five boats (original bug) - Fix: [#837] Can't move windows on title screen to where the toolbar would be (original bug) - Fix: [#1705] Time Twister's Medieval entrance has incorrect scrolling (original bug) - Fix: [#3178, #5456] Paths with non-ASCII characters not handled properly on macOS. - Fix: [#3346] Crash when extra long train breaks down at the back - Fix: [#3479] Building in pause mode creates too many floating numbers, crashing the game - Fix: [#3565] Multiplayer server crash - Fix: [#3681] Steel Twister rollercoaster always shows all track designs - Fix: [#3846, #5749] Crash when testing coaster with a diagonal lift in block brake mode - Fix: [#4054] Sorting rides by track type: Misleading research messages - Fix: [#4055] Sort rides by track type: Sorting rule is not really clear (inconsistent?) - Fix: [#4512] Invisible map edge tiles corrupted - Fix: [#5009] Ride rating calculations can overflow - Fix: [#5253] RCT1 park value conversion factor too high - Fix: [#5400] New Ride window does not focus properly on newly invented ride. - Fix: [#5489] Sprite index crash for car view on car ride. - Fix: [#5730] Unable to uncheck 'No money' in the Scenario Editor. - Fix: [#5750] Game freezes when ride queue linked list is corrupted. - Fix: [#5819] Vertical multi-dimension coaster tunnels drawn incorrectly - Fix: Non-invented vehicles can be used via track designs in select-by-track-type mode. - Fix: Track components added by OpenRCT2 are now usable in older scenarios. - Technical: [#5047] Add ride ratings tests - Technical: [#5458] Begin offering headless build with reduced compile- and run-time dependencies - Technical: [#5755] Title sequence wait periods use milliseconds - Technical: Fix many desync sources
No description provided.