summaryrefslogtreecommitdiff
path: root/Games
AgeCommit message (Collapse)Author
2019-12-24LibGUI+LibDraw: Add "Palette" concept for scoped color themingAndreas Kling
GApplication now has a palette. This palette contains all the system theme colors by default, and is inherited by a new top-level GWidget. New child widgets inherit their parents palette. It is possible to override the GApplication palette, and the palette of any GWidget. The Palette object contains a bunch of colors, each corresponding to a ColorRole. Each role has a convenience getter as well. Each GWidget now has a background_role() and foreground_role(), which are then looked up in their current palette when painting. This means that you no longer alter the background color of a widget by setting it directly, rather you alter either its background role, or the widget's palette.
2019-12-23WindowServer+LibGUI: Implement basic color themingAndreas Kling
Color themes are loaded from .ini files in /res/themes/ The theme can be switched from the "Themes" section in the system menu. The basic mechanism is that WindowServer broadcasts a SharedBuffer with all of the color values of the current theme. Clients receive this with the response to their initial WindowServer::Greet handshake. When the theme is changed, WindowServer tells everyone by sending out an UpdateSystemTheme message with a new SharedBuffer to use. This does feel somewhat bloated somehow, but I'm sure we can iterate on it over time and improve things. To get one of the theme colors, use the Color(SystemColor) constructor: painter.fill_rect(rect, SystemColor::HoverHighlight); Some things don't work 100% right without a reboot. Specifically, when constructing a GWidget, it will set its own background and foreground colors based on the current SystemColor::Window and SystemColor::Text. The widget is then stuck with these values, and they don't update on system theme change, only on app restart. All in all though, this is pretty cool. Merry Christmas! :^)
2019-12-20Build: clean up build system, use one shared Makefilejoshua stein
Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler.
2019-12-09LibGUI: Make GMenu inherit from CObjectAndreas Kling
This is primarily to make it possible to pass a GMenu* where a CObject* is expected.
2019-12-02WindowServer: Port to the new IPC systemAndreas Kling
This patch introduces code generation for the WindowServer IPC with its clients. The client/server endpoints are defined by the two .ipc files in Servers/WindowServer/: WindowServer.ipc and WindowClient.ipc It now becomes significantly easier to add features and capabilities to WindowServer since you don't have to know nearly as much about all the intricate paths that IPC messages take between LibGUI and WSWindow. The new system also uses significantly less IPC bandwidth since we're now doing packed serialization instead of passing fixed-sized structs of ~600 bytes for each message. Some repaint coalescing optimizations are lost in this conversion and we'll need to look at how to implement those in the new world. The old CoreIPC::Client::Connection and CoreIPC::Server::Connection classes are removed by this patch and replaced by use of ConnectionNG, which will be renamed eventually. Goodbye, old WindowServer IPC. You served us well :^)
2019-09-22LibCore: Remove ObjectPtr in favor of RefPtrAndreas Kling
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
2019-09-22LibCore: Make CObject reference-countedAndreas Kling
Okay, I've spent a whole day on this now, and it finally kinda works! With this patch, CObject and all of its derived classes are reference counted instead of tree-owned. The previous, Qt-like model was nice and familiar, but ultimately also outdated and difficult to reason about. CObject-derived types should now be stored in RefPtr/NonnullRefPtr and each class can be constructed using the forwarding construct() helper: auto widget = GWidget::construct(parent_widget); Note that construct() simply forwards all arguments to an existing constructor. It is inserted into each class by the C_OBJECT macro, see CObject.h to understand how that works. CObject::delete_later() disappears in this patch, as there is no longer a single logical owner of a CObject.
2019-09-21LibGUI: Convert custom widgets and subclasses to ObjectPtrAndreas Kling
2019-09-21GButton: Convert most code to using ObjectPtr for GButtonAndreas Kling
2019-09-21LibGUI: Convert GWindow to ObjectPtrAndreas Kling
2019-09-21LibCore: Remove CTimer::create() overloads in favor of construct()Andreas Kling
2019-09-21LibGUI: Convert GWidget to ObjectPtrAndreas Kling
2019-09-21LibGUI: Convert GLabel to ObjectPtrAndreas Kling
2019-09-20LibCore: Convert CTimer to ObjectPtrAndreas Kling
2019-09-14LibGUI: Simplify GCommonActions a bitAndreas Kling
Use the same callback signature as GAction so we can just forward it to GAction instead of chaining callbacks.
2019-09-05Snake: Added GCommonActionsrhin123
2019-09-05Minesweeper: Added GCommonActionsrhin123
2019-08-27Minesweeper: Reorganize menus a bitAndreas Kling
Move some of the "Game" menu into the app menu, and add a separate menu for the difficulty setting.
2019-08-27Snake: Merge "Game" menu into the app menuAndreas Kling
2019-08-12Minesweeper: Make the SquareButtons non-checkableAndreas Kling
We manage the checked state of these buttons manually in the code, and we don't want the user to interfere with it, which would be possible if we put them in checkable state.
2019-07-29Minesweeper: refactor on_square_clicked and flood_markDrew Stratford
Both on_square_clicked and flood_mark were very similar so I've introduced the on_square_clicked_impl function which is now called by on_square_clicked and flood_fill.
2019-07-29Minesweeper: updated flood_fill to use QueueDrew Stratford
2019-07-29Minesweeper: make Field::flood_fill iterativeDrew Stratford
This change uses an iterative traversal to avoid stack overflows in, the previously recursive, flood_fill.
2019-07-28WindowServer+LibGUI: Pass window icons as shared buffers rather than paths.Andreas Kling
Now that we support more than 2 clients per shared buffer, we can use them for window icons. I didn't do that previously since it would have made the Taskbar process unable to access the icons. This opens up some nice possibilities for programmatically generated icons.
2019-07-23LibGUI: Get rid of GWindow::should_exit_event_loop_on_close().Andreas Kling
This behavior and API was extremely counter-intuitive since our default behavior was for applications to never exit after you close all of their windows. Now that we exit the event loop by default when the very last GWindow is deleted, we don't have to worry about this.
2019-07-20GWidget: Add set_preferred_size(width, height) overload.Andreas Kling
It was annoying to always write set_preferred_size({ width, height }). :^)
2019-07-18LibDraw: Introduce (formerly known as SharedGraphics.)Andreas Kling
Instead of LibGUI and WindowServer building their own copies of the drawing and graphics code, let's it in a separate LibDraw library. This avoids building the code twice, and will encourage better separation of concerns. :^)
2019-07-11Minesweeper: Remove use of copy_ref().Andreas Kling
2019-07-03AK: Add String::number() for creating a String from a number.Andreas Kling
Instead of manually doing String::format("%d"/"%u") everywhere, let's have a String API for this. It's just a wrapper around format() for now, but it could be made more efficient in the future.
2019-07-01Minesweeper: Move configuration reading to FieldJookia
This makes more sense as it's where configuration writing happens.
2019-07-01Minesweeper: Allow single-click chordingJookia
This is how other Minesweeper games I've played usually behave. Single-click chording can be disabled from the menu or config file.
2019-06-30Meta: Removed all gitignore in the source tree only keeping the root oneVAN BOSSUYT Nicolas
2019-06-30GUI: Use Win2K-like "warm gray" color instead of the older colder gray.Andreas Kling
Someone suggested this a long time ago and I never got around to it. So here we go, here's the warm gray! I have to admit I like it better. :^)
2019-06-27Snake: Use NonnullRefPtrVector.Andreas Kling
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-06-07Meta: Tweak .clang-format to not wrap braces after enums.Andreas Kling
2019-06-07Games: Run clang-format on everything.Andreas Kling
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-05-19Minesweeper: Make things a little more friendly at the startRobin Burchell
Rather than having the first click hit a bomb, if the first click would hit a bomb, instead, reset the game board. This is a (sort of) feature of Windows minesweeper, and IMO makes playing a bit more fun :-)
2019-05-13Fix "make clean" not deleting app binaries.Andreas Kling
2019-05-11Fix some more victims of the new default layout spacing.Andreas Kling
2019-05-06Minesweeper: Flag unflagged mines on win.Andreas Kling
2019-05-02Minesweeper: Fix lag when changing the field size.Andreas Kling
Use a number of techniques to avoid freezing the UI for too long. - Keep reusing the same widgets for the squares once they've been created. - Temporarily disable widget updates. - Avoid some redundant work on each run of reset().
2019-04-28Minesweeper: Add considering feature, where middle clicking marks with '?'Andreas Kling
This is useful in the harder modes, for trying out different possibilities.
2019-04-26Minesweeper: Implement some feature requests.Andreas Kling
Someone was playing this game and suggested a number of improvements so here we go trying to address them: - Add "chording" support, where you can click a numbered square using both mouse buttons simultaneously to sweep all non-flagged adjacent squares. - Mis-flagged squares are now revealed as such on game over, with a special "bad flag" icon. - The game timer now shows tenths of seconds. It also doesn't start until you click the first square. - Add the three difficulty modes from the classic Windows version.
2019-04-26Games: Use Makefile.common here too.Andreas Kling
2019-04-21Snake+Minesweeper: Exit process when game window is closed.Andreas Kling
2019-04-20Snake: Show the highest score achieved so far (in this session.)Andreas Kling
2019-04-20LibGUI+Minesweeper: Add GWindow::set_resizable().Andreas Kling
2019-04-20Snake: Add a window icon. :^)Andreas Kling