summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
AgeCommit message (Collapse)Author
2021-05-06Codechange: add DrawString(Multiline) that accepts std::string&rubidium42
2021-04-30Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.Peter Nelson
2021-04-30Codechange: Simplify calling of DrawCharCentered()Peter Nelson
2021-03-10Codechange: rework codeflow introduced in 098d5b22 (#8837)Patric Stout
It didn't sit well to me, how I wrote the commit initially. First casting a variable into another, only to write it back into the originally feels wrong. This flow makes a bit more sense to me.
2021-03-10Add: make modal windows update more smoothPatric Stout
Basically, modal windows had their own thread-locking for what drawing was possible. This is a bit nonsense now we have a game-thread. And it makes much more sense to do things like NewGRFScan and GenerateWorld in the game-thread, and not in a thread next to the game-thread. This commit changes that: it removes the threads for NewGRFScan and GenerateWorld, and just runs the code in the game-thread. On regular intervals it allows the draw-thread to do a tick, which gives a much smoother look and feel. It does slow down NewGRFScan and GenerateWorld ever so slightly as it spends more time on drawing. But the slowdown is not measureable on my machines (with 700+ NewGRFs / 4kx4k map and a Debug build). Running without a game-thread means NewGRFScan and GenerateWorld are now blocking.
2021-03-10Fix #8711: having gui_zoom lower than zoom_min causes crashes (#8835)Patric Stout
gui_zoom was never clamp'd between zoom_min/zoom_max. zoom_min controls how zoomed-in we load sprites. For a value of 1, no quad-sizes sprites are loaded. If gui_zoom would be 0, meaning it wants quad-sized sprites to display, it was printing random stuff to the screen, which could or could not result in crashes.
2021-03-08Codechange: remove the unused lock around BlitterPatric Stout
2021-02-28Add: settings to limit your fast-forward game speedPatric Stout
By default this setting is set to 2500% normal game speed.
2021-02-22Codechange: Allow video drivers to handle the cursor themselves.Michael Lutz
2021-02-19Codechange: use std::chrono to track time in modal windowsPatric Stout
Adding to _realtime_ticks in a random place is a bit of a hack, and by using modern C++, we can avoid this hack.
2021-02-14Feature: Automatic UI and font zoom levels when supported by the OS.Michael Lutz
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott
2020-12-15Add: [Emscripten] use "relative mouse mode" with SDL2Patric Stout
This mode doesn't wrap the mouse constantly, but requests SDL to lock the mouse pointer. This is needed, as with Emscripten you are not allowed to change the mouse poisition (only to lock it into place).
2020-06-09Cleanup: Give `SetDirtyBlocks` a more descriptive name.TechGeekNZ
2020-06-07Cleanup: Add undocumented parameter to GetSpriteSize.TechGeekNZ
2020-01-07Add: Filled polygon drawing functionNiels Martin Hansen
2019-12-23Add: a TextColour flag to ignore colour changes from stringsglx
2019-11-25Fix: Do not refer to a function in the documentation that was removed years ↵stormcone
ago (#7844) The 'DoDrawString' was removed with this commit: f11300d
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-09-29Fix: Some typos found using codespellJMcKiern
2019-04-29Codechange: Remove PauseModeByteCharles Pigott
2019-04-29Codechange: Set ZoomLevel's base type to byte instead of using ZoomLevelByteCharles Pigott
2019-04-18Codechange: use std::vector for _resolutionsglx
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-09Codechange: Replace AutoDeleteSmallVector with direct std::vector use in ↵Michael Lutz
text layout code.
2019-04-09Codechange: Store text layout runs directly as values in a std::vector ↵Michael Lutz
instead of heap allocated. This reduces memory allocations and heap fragmentation.
2019-04-06Codechange: Use platform independent C++11 function for sleeping on a thread.Michael Lutz
2019-04-06Codechange: Replace custom mutex code with C++11 mutex'es.Michael Lutz
A conforming compiler with a valid <mutex>-header is expected. Most parts of the code assume that locking a mutex will never fail unexpectedly, which is generally true on all common platforms that don't just pretend to be C++11. The use of condition variables in driver code is checked.
2019-03-28Fix: MSVC warnings (#7423)glx22
2019-03-26Codechange: Replaced SmallVector::[Begin|End]() with std alternativesHenry Wilson
2019-03-26Codechange: Replaced SmallVector::Include() with include()Henry Wilson
2019-03-26Codechange: Replace SmallVector::Length() with std::vector::size()Henry Wilson
2019-03-20Remove: ENABLE_NETWORK switchPatric Stout
This switch has been a pain for years. Often disabling broke compilation, as no developer compiles OpenTTD without, neither do any of our official binaries. Additionaly, it has grown so hugely in our codebase, that it clearly shows that the current solution was a poor one. 350+ instances of "#ifdef ENABLE_NETWORK" were in the code, of which only ~30 in the networking code itself. The rest were all around the code to do the right thing, from GUI to NewGRF. A more proper solution would be to stub all the functions, and make sure the rest of the code can simply assume network is available. This was also partially done, and most variables were correct if networking was disabled. Despite that, often the #ifdefs were still used. With the recent removal of DOS, there is also no platform anymore which we support where networking isn't working out-of-the-box. All in all, it is time to remove the ENABLE_NETWORK switch. No replacement is planned, but if you feel we really need this option, we welcome any Pull Request which implements this in a way that doesn't crawl through the code like this diff shows we used to.
2019-02-24Fix #7266: Reorder reinitialization of caches when changing font zoom level. ↵PeterN
(#7273)
2019-02-23Feature: Add option to adjust font size separately from GUI size. (#7003)Greg Carlin
Adds an option in the "Game Options" next to "Interface Size" called "Font Size". Available options are normal, double, and quad.
2019-01-25Fix #7007: deadlock when launched with -n switchglx
2018-10-31Doc: Lots and lots of doxymentation fixesCharles Pigott
2018-06-24Fix: Poor contrast in cargo dest flow legend window cargo labels.Jonathan G Rennison
Select foreground colour depending on the brightness of the background. Previously all cargo labels were rendered using black text, even the background cargo colour was dark/black. As an example: FIRS coal was black text on a black background.
2018-04-29Remove: WinCE supportPatric Stout
2016-08-15(svn r27628) -Codechange: Prepare for drawing cursors consisting of multiple ↵frosch
sprites.
2016-08-15(svn r27627) -Codechange: Deduplicate some cursor magic into SetMouseCursorBusy.frosch
2015-08-10(svn r27381) -Fix: Warnings due to C++11 requirements for explicit narrowing ↵michi_cc
conversions in initializer lists.
2015-07-26(svn r27340) -Fix [FS#6338]: Silence warning by moving _string_colourmap to ↵frosch
a file no its own. (Cif)
2015-06-28(svn r27324) -Fix: Remove corner-case optimisation for line drawing, which ↵frosch
failed for dashed lines. (noticed by adf88)
2015-06-28(svn r27323) -Fix: Spelling.frosch
2015-06-28(svn r27322) -Fix: Clipping of inclined lines did not account for the ↵frosch
'horizontal width' being bigger than the 'real width'. (adf88)
2015-02-28(svn r27172) -Fix [FS#6238] (r27167): Apparently Windows randomly drops ↵frosch
SetCursorPos calls. According to internet due to incorrect/missing synchronisation in threads accessing the event queue.
2015-02-22(svn r27167) -Fix: [SDL, Windows] Right-mouse-button scrolling ↵frosch
scrolled/jumped way to far, when OpenTTD lagged during mouse event processing.
2015-02-01(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ↵frosch
ScaleGUITrad().