Commit Graph

216 Commits

Author SHA1 Message Date
Tamás Bálint Misius
3dbf6d7810
Use SDL text input correctly, add basic composition support 2021-04-02 10:21:52 +02:00
Tamás Bálint Misius
36e9fdc39d
Add support for i686-win 2021-03-20 23:02:03 +01:00
Tamás Bálint Misius
93b920a57f
Ignore key events with KMOD_GUI set #2, see previous commit 2021-03-08 21:09:35 +01:00
Tamás Bálint Misius
dbe4e78257
Ignore key events with KMOD_GUI set
As those are probably not meant for us.
2021-03-08 20:42:44 +01:00
Tamás Bálint Misius
4b7e85c2fb
Fix a metric ton of MSVC warnings 2021-02-15 21:24:44 +01:00
Tamás Bálint Misius
3a0331d747
Add SDL_Quit calls back in
These got lost in the migration to Meson; they used to be called
with atexit, but this caused more problems than it should have.
Anyway, it's fine to call these only when we're exiting normally,
since otherwise we have bigger problems than not quitting SDL.
2021-01-06 15:46:39 +01:00
Tamás Bálint Misius
360297c338
Mesonification 2020-12-14 20:16:52 +01:00
Tamás Bálint Misius
a0a0e6c498
Correctly handle SDL_GetCurrentDisplayMode return value 2020-10-11 12:31:52 +02:00
Vladimir
f137bad7f8
Limit redrawing frequency (#693)
Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
2020-10-11 11:58:52 +02:00
Tamás Bálint Misius
bdcf486a8d
Refactor MomentumScroll to be more in line with other interface prefs 2020-10-10 21:57:29 +02:00
Tamás Bálint Misius
efc693bf43
Fix initial mouse position and unsafe SDL_Event union access 2020-08-23 00:25:43 +02:00
Tamás Bálint Misius
6490654733
Fix a few unused result warnings 2020-08-07 01:33:18 +02:00
laurencedeclan
a9f07dc5b0 Data in user data directory (backwards-compatible) 2020-06-10 21:04:08 +02:00
mniip
34c0a94f98 Add a font.cpp merging utility 2020-03-10 02:13:48 +03:00
mniip
6607b7e845 Make font editor more convenient 2020-03-10 01:00:41 +03:00
jacob1
5b4a0bf93b Fix MSVC compile 2019-12-21 16:17:37 -05:00
suve
110250fe6a Guess best scale on startup (#684)
Guess best window scale at startup
2019-12-21 17:39:32 +01:00
Ian Bastos
4383de7ad5 Implement file drop handler (#666) 2019-07-24 00:04:41 -04:00
jacob1
fb06e0028b Add disable-network command line argument 2019-07-23 00:11:26 -04:00
Nuno Miguel
81380acc86 Fix namespace error 2019-04-20 23:12:54 -04:00
Tamás Bálint Misius
e1b3ddcbcb
Nuke using namespace std; 2019-04-20 17:03:23 +02:00
Tamás Bálint Misius
0179cefc78
Flatten include trees 2019-04-20 15:36:11 +02:00
Tamás Bálint Misius
e3fefe30d1
Add option to redirect cout/cerr to files 2019-04-05 20:55:05 +02:00
jacob1
e9011033eb Allow loading window positions on 2nd monitor 2019-03-24 23:17:09 -04:00
Tamás Bálint Misius
5bc3c03082 Change scheme to https everywhere 2019-03-18 23:50:38 -04:00
Tamás Bálint Misius
30c7f6ded7 Rename Download* to Request* and move HTTP stuff inside src/client/http 2019-03-07 22:56:08 -05:00
jacob1
3bb75ca951 Tick Client 10 times a second, makes thumbnails appear way faster 2019-03-03 23:47:54 -05:00
jacob1
45ee6780d9 Recreate window when toggling "altFullscreen" while fullscreen is enabled
Fixes bug where half of the window gets cut off
2019-02-20 22:20:49 -05:00
jacob1
0c6ce20880 Add "Force Integer Scaling" option for fullscreen
Also:
recreate the window when enabling resizable window, same workaround I applied to my mod for jacob1/The-Powder-Toy#24
recreate the window when toggling fullscreen, to work around some bugs where the window is sized incorrectly or the mouse position doesn't match where the cursor is
Don't capture mouse cursor when this is a debug build
2019-02-18 22:18:29 -05:00
wolfy1339
a2bb531c46 Remove inclusion of deprecated C++ headers 2019-01-31 20:09:15 -05:00
jacob1
82bdf4a777 Fix macOS data directory (for real this time, I think) 2019-01-22 00:26:29 -05:00
jacob1
af20029e08 Files for new icon
Still not entirely final, may change android (circle) icon a bit, and not sure if the mac icon works
2019-01-20 12:53:39 -05:00
jacob1
50a88c9c26 Fix whitespace 2019-01-12 12:50:28 -05:00
jacob1
655f4bb6d0 chdir to data directory on mac
May change this later if I decide to go back to using objective-c (or swift?) later to reimplement the rest of the mac features
2019-01-12 12:08:18 -05:00
Tamás Bálint Misius
5a57c37ae9 Make close event trigger consistently 2018-11-20 21:06:59 -05:00
Tamás Bálint Misius
e48bd482f6 Add close event 2018-11-16 23:02:05 -05:00
jacob1
53f6807ea6 make fps update less often in hud 2018-06-04 23:48:40 -04:00
mniip
48a333f0de Fix some scrolling issues 2018-05-30 13:35:44 +03:00
jacob1
7393c577f8 fix double scale firstrun check. We shouldn't need this popup anymore though 2018-05-28 14:02:50 -04:00
jacob1
3ce906b25d even better desktop size detection, now accounts for taskbars / panels 2018-05-28 13:55:49 -04:00
jacob1
a40ab1e50d don't load invalid window positions, only load window pos on first run 2018-05-28 13:33:01 -04:00
jacob1
324602fe26 adjust for window border when loading window position too
fixes window moving up every time on windows, on linux the border size gets reported as 0 so nothing changes there
2018-05-26 17:38:01 -04:00
jacob1
743ec98e3f add resizable window and original fullscreen options 2018-05-25 21:19:44 -04:00
jacob1
58127f355b fix windows / renderer compile (renderer requires sdl for now) 2018-05-25 21:19:44 -04:00
jacob1
841022c907 recenter linux icon 2018-05-25 21:19:44 -04:00
jacob1
002ab799c5 whitespace fixes 2018-05-25 21:19:44 -04:00
jacob1
7ac7eec6cf more sdl2 fixes:
don't recreate window every scale / fullscreen change
better renderer handling, input scaling no longer needed even if window resizing is enabled
load/save window position (replaces old windows code to do this)
calculate initial mouse position on startup because sdl no longer does this for us
2018-05-25 21:19:44 -04:00
jacob1
802ec4d252 remove icon debug stuff 2018-05-25 21:19:44 -04:00
jacob1
bd8550c2d5 fix a few more sdl 2 bugs:
mouse movement captured outside the window when mouse is down
fullscreen now focuses the window (there is a bug where you have to click once to get mouse input, though)
add linux icon, will need to be redone properly because it's offcentered with a black border (mask isn't present)
allow typing ~ into the console + some other fixes
2018-05-25 21:19:44 -04:00
jacob1
e5230b5b9f upgrade to SDL 2
Still currently in process, there are some issues:
Windows version doesn't work, mac version might not work, opengl might not work
Icon doesn't work (on Linux at least)
Lua will need some changes, there are some sdl 1.2 hacks in there
When entering fullscreen, the window loses focus
When holding down mouse out of bounds, mouse move events stop being sent
When letting go of mouse out of bounds, mouseup event doesn't take into account double scale mode
Clicking on startup without moving mouse will draw at 0,0 for a frame
Renderer probably won't compile because USE_SDL doesn't entirely work

... and maybe others

Some nice things were done though:
no more blit2, sdl can do the scaling itself
3d effect removed, no reason to support this joke any longer
No need to support copy/paste ourselves, sdl does it now
text handling done much better now, separate events for key presses and text input
when a new window is shown, all events ignored until next tick (ignore textinput event if window shown from key press event like console)
2018-05-25 21:19:44 -04:00
mniip
d404f4a538 Fix some C++14-isms.
Apparently C++11 is more strict regarding default argument and return
value conversions. Also return brace-initializer construction has had
little support.
2018-05-08 05:48:32 +03:00
mniip
954086fb86 Fixx macos compilation 2018-05-08 03:10:19 +03:00
mniip
f8586ea3a2 Remove ByteString::Stream 2018-05-04 23:10:39 +03:00
mniip
6c9cb174fb Change some uses of String::Stream to StringBuilder 2018-05-02 22:11:41 +03:00
mniip
a121c62c3b Add some helper methods and rewrite some of the string manipulation code 2018-05-02 01:32:04 +03:00
mniip
ff27d69424 Switch from std::string to String/ByteString in most of the code
Also switch SimulationData from weird arrays to std::vector
2018-04-30 21:13:24 +03:00
mniip
c0c550e920 Add a new font editor 2018-04-29 18:49:40 +03:00
jacob1
f2ac8a951c add ctrl+q shortcut to exit the game from anywhere 2018-03-10 16:01:14 -05:00
LBPHacker
be29fad7e8 Add support for window scale modes other than 1 and 2
Window scale can now be anything between 1 and 10 (suggest something other than 10 for maximum scale?). This required a number of subtle changes:

 * made blit2 (PowderToySDL.cpp) handle scale modes correctly (it really only handled scale:2 correctly before)
 * replaced `bool scale` with `int scale` everywhere in the options view/model/controller
 * replaced the _large screen_ checkbox with a _window scale_ textbox in the options view

The new scale is only checked and applied when the options view is closed. There's no reason to not apply it live, I just chose not to.

This commit does *not* make TPT able to figure out an optimal scale mode at first run. It still suggests using scale:2 if it makes sense though.

I had doubts about using a second loop in blit2 but it doesn't seem to be an issue. If there's a more optimal way of going about what blit2 does, I haven't figured it out.

(Sublime seems to have eaten a few trailing spaces, hence there are a few seemingly identical pairs of lines in the diff.)
2017-11-23 12:24:34 -05:00
wolfy1339
87f3ada7b0 Remove stuff from Config.h that doesn't belong 2017-11-23 00:12:48 -05:00
jacob1
d5347b0906 Fix test error 2017-02-26 14:02:38 -05:00
jacob1
b01e7a6a36 put #ifdef around denormal functions, they only exist when using SSE/SSE3 2017-02-20 19:15:41 -05:00
jacob1
ac8c01ae57 ensure floating point denormals aren't used, they can massively lag the air sim 2017-02-19 19:29:41 -05:00
jacob1
c1fad5ebf9 linux compiling fix 2016-10-14 09:30:29 -04:00
jacob1
9e33906858 VS 2015 compiling fixes
note, wiki guide still doesn't work unless you also have vs2013 installed
2016-10-13 22:32:52 -04:00
Simon Robertshaw
86b83798f7 More graceful exit when X11 is not available on Linux 2016-08-07 13:17:17 +01:00
jacob1
f0f104097d finish / fix ecb08952e5
must have accidentally reverted Keys.h halfway through making it?
2016-07-23 19:15:07 -04:00
jacob1
ecb08952e5 Add SDL_keysym.h, Use official SDL constants 2016-07-19 22:42:10 -04:00
wolfy1339
b65e94900e Use C++ includes (#308)
Replaces stdio.h, stdlib.h, string.h, math.h, time.h, limits.h and othters with their C++ equivalents.
2016-07-17 23:37:24 -04:00
jacob1
bc1dd6748c Fix double screen mode fail 2016-07-13 00:15:57 -04:00
Simon Robertshaw
6cfaeb9c5c OpenGL UI fixes for on OS X/all platforms
- Reinitialise textures after SDL_SetVideoMode
 - Fix header includes and remove GLEW setup on OSX
2016-07-12 21:31:29 +01:00
Simon Robertshaw
b66ca770da Performance optimisation for blitting loops and depth3d 2016-07-12 19:48:58 +01:00
jacob1
8146598967 fix blank screen when hitting "Cancel" on double screen dialog 2016-07-10 17:38:19 -04:00
jacob1
ce55c8e58b Fix --opengl-render option. Please NEVER use this option though 2016-05-14 09:44:49 -04:00
jacob1
6b6bd67a9f extra debugging thing for visual studio
I think this prevents random "exited with code 3" errors, but I can't remember ...
2016-04-23 11:39:06 -04:00
jacob1
623d9ca4b9 save double scale mode setting on exit 2016-04-02 00:39:51 -04:00
jacob1
aa99258101 more cleanup so that 3D can stay a more permanent thing 2016-04-02 00:10:15 -04:00
jacob1
30e82851bc Fixes to 3D mode (mostly fixes it on OS X) 2016-04-01 22:06:21 -04:00
jacob1
4c066cd7a7 another blind compile fix 2016-03-31 22:50:03 -04:00
jacob1
46d096206f Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience 2016-03-31 22:08:04 -04:00
jacob1
926f556bcc fix compile error 2016-01-31 22:59:29 -05:00
jacob1
36e8f6d900 show confirm dialog for double screen mode in case of false detections 2016-01-31 22:30:39 -05:00
jacob1
4e484ae2a4 compiler fixes, apparently using [] as intended is ambiguous ... 2016-01-26 00:24:14 -05:00
jacob1
b0ce2ee615 only automatically use scale 2 if there is a little more space than required (just in case) 2015-09-01 12:39:58 -04:00
jacob1
9f9fef6cad Add new function ParseServerReturn, try to properly display all http errors
Also fix crash with invalid ptsave link, and fix some cases where it wouldn't ever tell you it errored
2015-08-29 13:14:17 -04:00
jacob1
732e5b8730 fix some very minor memory leaks 2015-06-30 19:06:18 -04:00
Aditya Vaidya
13cc593d13 Fixed most spelling errors in code. 'originaly' is read as 'original Y', so not a typo 2015-05-18 15:16:01 -05:00
jacob1
cee08b2024 On first run, set scale to 2 if screen size is large enough 2015-05-14 23:22:20 -04:00
mniip
4fa02965bf Clean up the EngineProcess loop 2015-02-04 04:13:51 +03:00
jacob1
b7fe998252 fix mouse coords at startup being 0,0, fix glitch that could make background windows fade completely to black 2015-01-31 14:09:50 -05:00
jacob1
b1a3c404b6 fix platform / sconscript flag specific warnings, --no-warnings no longer defaults to true 2015-01-16 23:39:42 -05:00
jacob1
dce874484a fix all the gcc warnings in the element files (except one in PSTN) + all the unused variable warnings 2015-01-10 22:43:33 -05:00
jacob1
6eedc7a7a6 new linux icon: 48x48 (really displayed at 44x36) instead of 16x16
really it's the same icon, it's also not the best, but the best I could make it look
2015-01-09 22:40:48 -05:00
jacksonmj
236ff08da9 Fix some problems noted in http://www.viva64.com/en/b/0298/
I've left some of the less important items, like SearchView.cpp "'then' statement is equivalent to the 'else' statement", and RequestBroker::Request::~Request, because I don't feel like spending a few days entirely rewriting those files at the moment (which is what I'd end up doing if I started fixing minor problems and refactoring...)

GameSave::readOPS - not changed. At some point we may have to move to a larger type for element IDs (probably two or four bytes), but PT_NUM isn't likely to be raised to the maximum value of that type immediately, so this check will be needed then. There should be an elements[partsData[i]].Enabled check in there too, but it might be a bit difficult - I'm not sure how to access a Simulation object from GameSave::readOPS...

Notes on changes:

Graphics::textsize, Element_FRZW::Element_FRZW - typos

Button::Draw - the extra case was originally used to invert the icon (draw it in black instead of in white) when the button was clicked. However, the icon colour is now automatically set depending on the background colour. (Note similar conditions "if(Enabled) { if(isButtonDown || (isTogglable && toggle)) " near the start of the function - same logic but in a different place, setting icon colour indirectly).

Simulation::transform_save - unused redundant function, everything uses GameSave::Transform which does much the same thing.

PreviewView::NotifySaveChanged - should be height==YRES/2, it's checking whether the preview image is the correct size, and resizing it if it isn't.

Element_FWRK::update - no idea why that line was there, even though it was my commit that originally added it...
2014-12-25 17:09:35 +00:00
jacob1
6463d04f6c fix a few of the most spammy warnings (there are still hundreds of warnings though)
TODO: actually fix all the warnings
2014-10-23 00:42:13 -04:00
jacob1
89eb6bbd03 fix small ClipboardPush error that shouldn't ever happen 2014-07-04 19:16:38 -04:00
jacob1
6749c2547f New SConscript (hopefully better)
Fixes a lot of bugs, also almost all options are no longer needed and are just auto-detected
2014-06-08 19:33:58 -04:00
Simon Robertshaw
197a70c2e6 Fix Clipboard for renderer build, ensure MacOS and Windows clipboard funcs return std::string 2014-03-16 11:35:53 +00:00
jacksonmj
c6d6011337 An ugly fix for numpad, since it seems event.key.keysym.mod isn't entirely reliable for some unknown reason
Partial revert of 7ce9907f82
2014-03-12 15:05:54 +00:00
jacksonmj
1ca63b3813 Add more key definitions 2014-03-12 15:04:16 +00:00