Commit Graph

186 Commits

Author SHA1 Message Date
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
jacksonmj
a1515b3d5e Shift key for numpad 2014-03-12 00:54:52 +00:00
jacob1
7ce9907f82 fix textbox key repeat issue, fix numpad issue (in two ways) 2014-03-11 12:53:42 -04:00
mniip
43bff37279 fix numpad behavior: movement keys are no longer triggered with numlock on 2014-02-27 20:39:16 +04:00
mniip
55284e6313 Fix most of clipboard-related memory leaks and potential crashes; Fixes jacob#23 2014-02-25 18:44:44 +04:00
mniip
fdfaa3a29b add defines for window resolution
--amend
2013-12-29 20:12:50 +04:00
jacob1
138cb4d757 exception bluescreens print what the exception was, some (probably unnecessary) fixes to fusion that were never merged in, and probably a compiling fix 2013-12-03 22:05:35 -05:00
Simon Robertshaw
a32af1679a Fix Mac OSX readUserPreferences missing off last char of pref data, add clipboard implementations for Mac OS X 2013-11-19 21:23:04 +00:00
mniip
9183fa1755 apparently Ximon hates const; a lot;
added a bunch of const everywhere, had to modify a few functions to be const-compliant
2013-10-30 04:38:13 +04:00
mniip
5d3520d18c fix copy and paste in the same tpt window on SDL/Linux/X11 2013-10-25 00:46:41 +04:00
jacob1
332aa25bf6 save pavg[] in saves, for VIRS, PIPE, and STOR 2013-09-11 20:41:43 -04:00
mniip
8a27363c76 implement X11 clipboard pull 2013-08-29 00:57:08 +04:00
jacob1
5518a6bcd6 fix right modifier keys 2013-07-27 11:21:42 -04:00
jacob1
cc887995c0 fix openGL compiling (most likely), fixes #146 2013-07-17 18:20:50 -04:00
jacob1
3203e597b9 fix piston bugs, fix crashes, don't use bluescreens when compiled with debug mode in visual studio 2013-07-10 16:59:10 -04:00
jacob1
60b1bf5066 forgot to push this commit, SDL should only be included in 1 type of way 2013-06-22 09:36:50 -04:00
jacob1
1588226120 move frameStart to right after the fps is limited (counts everything, including mouse/key functions now) 2013-05-21 23:23:57 -04:00
cracker64
4e9ee3a3a3 Fix incorrect FPS counter, need to count blit too.
2x scale gets a massive *real* fps boost, the fps lied before.
2013-05-21 23:05:27 -04:00
mniip
3979395e65 reenable sighandlers for winderp 2013-05-19 10:02:42 +04:00
mniip
3a640fee3f some more compiling fixes 2013-05-17 18:32:41 +04:00
mniip
9f33cbf79e well, fuck you too, simon 2013-05-05 08:49:36 +04:00
Simon Robertshaw
8ef266c08e Fix compiling with new BSOD in debug mode 2013-05-04 22:41:08 +01:00
Simon Robertshaw
2d8c5a7747 TPT Blue screen of death - try its best to catch some signals (SIGSEGV) and unhandled exception in the game loop 2013-05-04 21:39:43 +01:00
Simon Robertshaw
1575d93d48 Fix compilation issues on Windows with Window Position Loader 2013-05-04 15:00:45 +01:00
jacob1
d4391cc19e set window position before displaying it 2013-05-03 19:11:44 -04:00
mmbob
df14a77124 LoadWindowPosition has a better default position
LoadWindowPosition now positions the window on the nearest monitor if
the window is not inside a monitor.
2013-05-02 13:00:13 -04:00
mmbob
63050715ee Replace __ImageBase. Save + load window position.
Instead of using the __ImageBase global variable, use the
GetModuleHandle(NULL) function to get the exe's HMODULE/HINSTANCE.
Save the window position when the game is closed and restore it when it
is opened.  Defaults to being centered on the desktop.
2013-04-22 13:04:43 -04:00
Simon Robertshaw
9abe51526c Move all GUI source files into gui/ 2013-03-22 14:14:17 +00:00
jacob1
01cd146ee9 fix mac compiling, fix renderer, fix other minor compiling issues 2013-02-14 23:31:31 -05:00
jacob1
b493788b26 fix missing #ifdef statement breaking compiling when not on linux 2013-01-19 11:46:21 -05:00
jacob1
ded94b475d move clipboard functions out of misc.cpp without creating errors 2013-01-18 14:37:24 -05:00