Commit Graph

210 Commits

Author SHA1 Message Date
Andreas Kling
cf750b5d3f Chess: Fix button size in the piece promotion dialog
Fixes #4865.
2021-01-09 15:05:31 +01:00
Andreas Kling
9d6198b683 Everywhere: Colour => Color
The system language is US English. :^)
2021-01-09 14:03:06 +01:00
Andreas Kling
fedf561f57 Everywhere: Use GUI::CommonActions::make_about_action() 2021-01-04 23:51:49 +01:00
Linus Groh
306aff80d0 LibGUI: Remove Widget's unused m_{foreground,background}_color
...as well as the few remaining references to set_foreground_color().

These properties are not being used for rendering anymore, presumably
because they completely mess up theming - assigning random white and
gray backgrounds just doesn't work with dark themes.
I've chosen to not replace most of the few remaining uses of this
broken functionality with custom palette colors (the closest
replacement is background_role) for now (except for Minesweeper where
squares with mines are painted red again now), as no one has actually
complained about them being broken, so it must look somewhat decent
(some just look right anyway). :^)

Examples of this are the taskbar buttons, which apparently had a
DarkGray foreground color for minimized windows once - this has since
been replaced with bold/regular font. Another one is the Profiler's
ProfileTimelineWidget, which is supposed to have a white background -
which it didn't have for quite some time, it's grey now (with the
default theme, that is). Doesn't look bad either.
2021-01-02 23:31:22 +01:00
Linus Groh
cf2c215def Conway: Distribute leftover space equally on all sides
This draws the universe centered rather than just putting all leftover
space on the right and bottom sides until the window is large enough to
be completely filled with cells again.
2021-01-01 23:34:25 +01:00
Brendan Coles
d1d729370e Games: Add Conway 2021-01-01 22:51:37 +01:00
Stephan Unverwerth
b4d1390714 LibGFX: Move default_xxx_font() methods from Font to FontDatabase
When we have an abstract font class it makes no sense to keep
these methods in the Font class.
2020-12-30 20:40:30 +01:00
Andreas Kling
7dc5a3ead8 LibGUI: Rewrite layout system in terms of min and max sizes
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.

Box layout now works in 3 passes:

    1) Set all items (widgets/spacers) to their min-size
    2) Distribute remaining space evenly, respecting max-size
    3) Place widgets one after the other, adding spacing in between

I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)

This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
2020-12-30 01:36:41 +01:00
Tom
99d6b3b80b Chess: Use the hourglass cursor while waiting for the ChessEngine 2020-12-22 23:37:25 +01:00
Brendan Coles
0cc970bd07 Breakout: Add player lives game mechanic and pause functionality 2020-12-21 00:16:42 +01:00
William Marlow
39364bdda4 Build: Embed application icons directly in the executables.
New serenity_app() targets can be defined which allows application
icons to be emedded directly into the executable. The embedded
icons will then be used when creating an icon for that file in
LibGUI.
2020-12-21 00:12:59 +01:00
Brendan Coles
172707a945 Chess: Prevent board changes when waiting for ChessEngine to move 2020-12-17 19:45:05 +01:00
Brendan Coles
9d4a0ec50a Games: Add Pong 2020-12-16 17:12:46 +01:00
Brendan Coles
d8c533f588 Breakout: use pledge and unveil 2020-12-15 14:12:55 +01:00
Brendan Coles
e3114667bc Breakout: randomize ball start trajectory and velocity 2020-12-15 14:12:37 +01:00
Itamar
9a9d655abe Chess: Add LibCore as a dependency
This fixes Dynamic Loader crash because of an unresolved LibCore symbol
2020-12-14 23:05:53 +01:00
AnicJov
e119d7d6b9 Chess: Added ability to put markings on the board
With this patch you can use right-click to mark a square on the board.
You can add modifier keys to the click to change to alternate color
(with CTRL) or secondary color (with Shift). If you right-click and
drag from one square to another you will create an arrow. The
markings go away as soon as you left-click on the board or the board
state changes.

Note: The arrows sometimes look weird, and horizontal ones get cut
      off. They also don't account for alpha. This is not a bug in
      Chess code, rather, likely in the fill_path() function that's
      used to draw the arrows. If anyone might know what's up with
      that I urge you to take a look. :)
2020-12-10 20:40:51 +01:00
AnicJov
f631e73519 Chess: Added abilty to import PGN files
This patch allows the user to load games using PGN files. The parsing
is not complete and has a bunch of work left to be done, but it's
okay for our use case here. It can load all of the games our PGN
exporter can save. As the Chess program impoves so can the PGN parser.
2020-12-10 20:40:51 +01:00
AnicJov
4d9837d792 Chess: Add ability to replay moves
This patch allows the user to go back and forward in move history
to replay moves from the game. This is view-only however, and as soon
as a move is made the board returns to it's current state. This will
work well for replaying games loaded in with PGN files, once that's
implemented.
2020-12-10 20:40:51 +01:00
AnicJov
cf8fce368a Chess: Added ability to copy board state as FEN
You can now copy the board state as Forsyth-Edwards Notation. You can
then paste this into other chess programs/games, or into ours when
it gets implemented.
2020-12-10 20:40:51 +01:00
AnicJov
b000a884c8 Chess: Change keyboard shortcuts
Use some better keyboard shortcuts that make more sense and are more
common, instead of random function keys.
2020-12-10 20:40:51 +01:00
AnicJov
fe1628746c Chess: Add ability to export game as PGN file
This patch adds an option to the menubar for exporting the current
game as a PGN file. This file can then be read by other chess
programs (and ours eventually) to replay the game or analyze it.
The implementation is mostly PGN spec compliant, however the code
could use some more work. Particularly the `const_cast`s...
But it's a start. :^)

Fixup: Chess: Fixed hard-coded home path in unveil() call

Fixup: Chess: Removed castling flags from Move struct

The castling detection logic is done inside Move::to_algebraic()
now, removing the need for is_castle_short and is_castle_long flags
inside of the Move struct.
2020-12-06 15:51:34 +01:00
AnicJov
01b62cc7f4 Chess: Added ability to resign and flip the board
This patch adds options to the app's menubar to resign the game and
flip the board.
2020-12-06 15:51:34 +01:00
AnicJov
694f68ab86 Chess: Change default piece set
As much as I like the "test" piece set, I think "stelar7" is a much
better first impression for anyone opening the Chess game, so I
consider it a much more sensible default.
2020-12-06 15:51:34 +01:00
John Brehm
6914cf830d
Games: Added level select and aditional level to Breakout (#4302)
Added a level select menu which is shown when the game start where
either of the 2 available levels may be selected.
2020-12-02 23:49:42 +01:00
Andreas Kling
626c17d284 Breakout: Add simple menu and about dialog :^) 2020-11-10 14:32:45 +01:00
Andreas Kling
51e7c6e348 Breakout: Set the window icon 2020-11-10 14:32:45 +01:00
Andreas Kling
8c88bf31ed Breakout: Turn off double-buffering 2020-11-10 14:32:45 +01:00
Andreas Kling
959038d410 Breakout: Change ball x velocity depending on where it hits paddle
This makes the game less deterministic and more fun. The "physics"
definitely feel a little goofy, and I'm sure they can be greatly
improved, but still it's already better. :^)
2020-11-10 14:32:45 +01:00
Andreas Kling
844c2e1f3b Breakout: Stop paddle movement when resetting it 2020-11-10 14:32:45 +01:00
Andreas Kling
d05d519b0d Breakout: Use floating point coordinates 2020-11-10 14:32:45 +01:00
Andreas Kling
0bf927a824 Breakout: Use the pending new ball rect for brick collision testing
Otherwise the ball will bounce one frame *after* hitting a brick.
2020-11-09 13:34:27 +01:00
Andreas Kling
8e4e77fcf4 Breakout: Add a very simple breakout game :^)
Made with HackStudio! This needs some love to feel like a proper game,
but the basics are here.
2020-11-09 13:34:27 +01:00
Brendan Coles
e558f6b184 Minesweeper+Snake: load config file before calling unveil() 2020-11-04 19:36:27 +01:00
Brendan Coles
9f8a8e07c2 Games: Use pledge and unveil 2020-11-02 13:16:01 +01:00
Brendan Coles
7c5e488de2 Games: Use GUI::Icon::default_icon to set application icon 2020-11-01 10:29:27 +01:00
Andreas Kling
982e066100 LibGfx: Move FontDatabase from LibGUI to LibGfx
Not sure why I put this into LibGUI in the first place.
2020-10-31 13:56:21 +01:00
Brendan Coles
e569f7fd1c Applications: Use application icons for dialog windows 2020-10-31 13:48:15 +01:00
Till Mayer
2ac734b7a8 Solitaire: Play animation when starting a new game 2020-10-26 21:36:40 +01:00
Till Mayer
ef458f7b66 Solitaire: Refactor CardStack layout code 2020-10-26 21:36:40 +01:00
Andreas Kling
05ff75c321 Snake: Use the system default fixed-width font
Instead of looking one up by name.
2020-10-26 11:33:27 +01:00
Andreas Kling
9d347352a1 LibGfx+LibGUI+Clients: Make fonts findable by their qualified name
The qualified name of a font is "<Family> <Size> <Weight>". You can
get the QN of a Font via the Font::qualified_name() API, and you can
get any system font by QN from the GUI::FontDatabase. :^)
2020-10-25 21:18:18 +01:00
Linus Groh
82956a08b3 LibCore: Rename File::ShouldCloseFile{Description => Descriptor}
From https://youtu.be/YNSAZIW3EM0?t=1474:

"Hmm... I don't think that name is right! From the perspective of
userspace, this is a file descriptor. File description is what the
kernel internally keeps track of, but as far as userspace is concerned,
he just has a file descriptor. [...] Maybe that name should be changed."

Core::File even has a member of this enum type... called
m_should_close_file_descriptor - so let's just rename it :^)
2020-10-25 13:59:41 +01:00
asynts
80e23d1b98 Games: Use new format functions. 2020-10-17 23:20:31 +02:00
Linus Groh
bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
Ben Wiederhake
fa62c5595e Meta+Games: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Peter Elliott
e46b4e0865 Minesweeper: Fix inverted Single-Click Chording setting
This was introduced by 705cee528a,
where the '!' was copied from the previous implementation, but the
behavior was not
2020-09-18 09:42:26 +02:00
thankyouverycool
a49e0fa5d4 Base: Create /res/icons/solitaire/ and relocate solitaire assets 2020-08-27 15:38:02 +02:00
Ben Wiederhake
9f7ec33180 Meta: Force semi-colon after MAKE_AK_NONXXXABLE()
Before, we had about these occurrence counts:
COPY: 13 without, 33 with
MOVE: 12 without, 28 with

Clearly, 'with' was the preferred way. However, this introduced double-semicolons
all over the place, and caused some warnings to trigger.

This patch *forces* the usage of a semi-colon when calling the macro,
by removing the semi-colon within the macro. (And thus also gets rid
of the double-semicolon.)
2020-08-27 10:12:04 +02:00
Peter Elliott
274be68102 Chess: Allow resizing Chess using resize_aspect_ratio(1,1) 2020-08-23 01:05:22 +02:00