summaryrefslogtreecommitdiff
path: root/src/client.h
AgeCommit message (Collapse)AuthorFilesLines
2024-10-08Added convenient and efficient Timer classThorbjørn Lindeijer1-20/+0
The Timer is efficient because it does not depend on incrementing a counter to keep track of time, nor does it call SDL_GetTicks every time its state is checked (this happens once per frame instead). Along with global functions Time::absoluteTimeMs() and Time::deltaTimeMs(), this replaces previous globals tick_time, cur_time and get_elapsed_time(). For now, there is still a fixed 100 times per second logic call rate, but the new Time::deltaTimeMs() function should allow getting rid of this.
2024-03-22Added support for scaling the outputThorbjørn Lindeijer1-1/+2
* Added "Scale" user option, which can either by "Auto" or an explicit scaling factor. Its maximum value depends on the current resolution. The "Auto" factor is based on keeping the logical resolution on at least 800x600, wheres the maximum scale is based on keeping the logical resolution on at least 640x480. * Enabled support for High DPI. This means the rendering target can now have a different resolution than the window size, which can happen on macOS, Windows and Wayland. The resulting scale is multiplied by the above user-controlled scale. Currently, this looks ugly for non-integer scales, which are not used on macOS and can only be configured on some Wayland compositors. Has not been tested on Windows. * Simplified OpenGL initialization (moved out of _beginDraw). * Made sure _beginDraw/_endDraw sets a clip area also for SDLGraphics.
2024-03-08Removed SDL2_gfx dependencyThorbjørn Lindeijer1-3/+12
Since the upgrade to SDL2 it was only used for framerate limiting, which I've replicated in a small helper class. Also reduced the framerate limit while minimized from 100 to 10 FPS.
2024-03-06General code cleanupsThorbjørn Lindeijer1-12/+12
* Use final for all message handlers, Client, LocalPlayer, Being::getType, Being::setPosition and Being::setMap. (avoids some warnings about virtual dispatch in constructors) * Use auto in more places * Use emplace_back instead of push_back in some places * Use default member initializers * Less else after return * Removed superfluous .c_str() * Removed type aliases that are only used once * Removed more unused includes
2024-03-02Exit with error when invalid server type is passed on CLIThorbjørn Lindeijer1-1/+2
Also made it exit with error when there is an unknown option or missing argument.
2024-03-02Added support for -y / --server-type parameterThorbjørn Lindeijer1-1/+2
Usually this would be guessed correctly by the port, but now it is also possible to just specify the server type and the port will be derived from there, unless a default port is given in the branding file. Closes #56
2024-02-27Added VSync and windowed fullscreen optionsThorbjørn Lindeijer1-7/+7
The configuration and setup UI were adjusted to the new options. This also fixes issues in applying new video settings. Default resolution was changed from 800x600 to 1280x720. VSync is enabled by default while FPS limit was disabled. Display aspect ratio for the resolution options. I had to work around some macOS issues: * Don't change window size when it appears to be "maximized", since it just changes the rendering area while leaving the window maximized. * Unset fullscreen display mode temporarily to allow changing resolutions, otherwise the rendering area no longer matches the screen and mouse input is also off. * Removed SDL_WINDOW_ALLOW_HIGHDPI for now because it causes issues on macOS, since we're not actually handling the scaling factor. A Video class and an SDLGraphics subclass were split off from Graphics. This setup has Less duplication and leaves the OpenGLGraphics and SDLGraphics better separated. Fixes #57 Fixes #58
2024-02-09C++11: Use default member initializersThorbjørn Lindeijer1-15/+6
This patch is not exhaustive.
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer1-3/+3
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2024-01-25Ported to SDL2Thorbjørn Lindeijer1-9/+4
2012-02-18Added notification sound on receiving whisperThorbjørn Lindeijer1-0/+9
One of the sound channels is reserved for notification sounds, of which the volume can be configured separately. Currently, the only notification sound that is played is for receiving whispers. That can be extended later. The newmessage.ogg sound used currently is the one for receiving a message with the Psi instant messenger. Parts of this patch are based on the new message notification in ManaPlus. Reviewed-by: Erik Schilling
2012-02-09Allow changing fullscreen resolution without restartThorbjørn Lindeijer1-1/+10
Unified Graphics:setFullscreen and Graphics:resize into a single Graphics:changeVideoMode function that tries to restore the existing mode when changing to the new mode didn't work, and exists with an error when that also fails. Split up handling of SDL_VIDEORESIZE and the adapting to new resolution in the Client class, so that the second part could also be called when changing resolution fullscreen mode. The Video tab in the Setup window now also filters out any modes smaller than 640x480 since the game won't properly adapt to that resolution anyway. Reviewed-by: Yohann Ferreira
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-22Allow resizing of the game in windowed modeThorbjørn Lindeijer1-0/+4
Window positions are semi-smartly corrected as a result of the resize. Not supported when using OpenGL on Windows for now. Reviewed-by: Yohann Ferreira
2011-05-01Fixed my fix on the get_elapsed_time function.Yohann Ferreira1-3/+1
My apologies.
2011-04-30De-dustify the get_elapsed-time function documentation a bit.Yohann Ferreira1-3/+12
Trivial.
2011-04-18A bit of cleanup in the way the Client pops up error dialogsThorbjørn Lindeijer1-7/+15
No point in using mCurrentDialog for the OkDialog, since it will clean up after itself, as was pointed out in many places throughout the code. Now there are two convenience functions for popping up the OkDialog and having it change to a specified state afterwards. This also gets rid of the 4 different ActionListener classes that existed solely for this purpose. Reviewed-by: Yohann Ferreira
2011-04-09Renamed Listener to EventListenerThorbjørn Lindeijer1-2/+2
Makes it clear what kind of listener it is, since there are other listener classes as well. Acked-by: Jared Adams
2011-04-09Removed the Mana namespaceThorbjørn Lindeijer1-2/+2
It's just an annoyance when it's only applied to a few classes. Either we place everything in this namespace or nothing, and at the moment I don't see any rationale for placing everything in a Mana namespace. Acked-by: Jared Adams
2011-04-09Moved Channels to Mana::Event::ChannelThorbjørn Lindeijer1-1/+1
Acked-by: Jared Adams
2010-11-13Replace config listeners with the event systemChuck Miller1-3/+3
Reviewed-by: Jared Adams
2010-11-02Adding double-click to server dialog and world select dialogStefan Dombrowski1-0/+6
This resolves http://bugs.manasource.org/view.php?id=259 Reviewed-by: Thorbjorn
2010-11-01Merge branch '0.5' of gitorious.org:mana/manaYohann Ferreira1-0/+2
Conflicts: src/being.cpp src/client.cpp src/commandhandler.cpp src/gui/setup_video.cpp src/gui/socialwindow.cpp src/gui/viewport.cpp src/gui/widgets/browserbox.cpp src/gui/widgets/itemcontainer.cpp src/imageparticle.cpp src/localplayer.cpp src/localplayer.h src/map.cpp src/net/tmwa/beinghandler.cpp src/particle.cpp src/particle.h src/player.cpp src/player.h
2010-10-18Add portable support for windows version.Andrei Karas1-0/+2
Add portable option to windows installer. Reviewed-by: Thorbjorn
2010-05-21Merge branch '1.0'Thorbjørn Lindeijer1-4/+4
Conflicts: src/beingmanager.cpp src/beingmanager.h src/client.cpp src/localplayer.cpp
2010-05-21Fix some issues found by CppcheckJared Adams1-4/+4
2010-05-01Add chat logging.Andrei Karas1-0/+1
Add option in players setup page. Add command line option. Signed-off-by: Jared Adams <jaxad0127@gmail.com>
2010-04-19Add afk mode for player.Andrei Karas1-0/+1
Add variable cur_time for current time. Add command /away [text] Reviewed by: Bertram
2010-02-28Make the gui more themeable and distribute two themesJared Adams1-0/+4
The older gray theme and the new wood theme are available as themes. The gray theme needs some new graphics for hilights. Add a theme option for branding and add path/to/branding/data to the PhysFS search path. Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Chuck Miller
2010-02-27Some cleanup and compile fixJared Adams1-2/+2
Reviewed-by: Thorbjørn Lindeijer
2010-02-27Corrected some variables names after recent renamingThorbjørn Lindeijer1-1/+1
With help from Jared. Reviewed-by: Jared Adams
2010-02-27Added m prefix to Client's member variablesThorbjørn Lindeijer1-19/+19
Reviewed-by: Jared Adams
2010-02-25Add support for platform specifig config/data directories #84Bernd Wachter1-5/+9
Reviewed-by: Jared Adams
2010-02-24Added the possibility to pass a branding file by command line. Reviewed-by: ↵Philipp Sehmisch1-0/+1
Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
2010-02-21Made tick counter and framerate limiter work during login sequenceThorbjørn Lindeijer1-0/+212
Much code was moved from main() to the new Client::exec(). This new event loop now integrates with the Game class, so that the tick counter and framerate limiter apply universally. The Client class is also responsible for some things that used to be global variables. Mantis-issue: ...