summaryrefslogtreecommitdiff
path: root/Userland/Games/Snake
AgeCommit message (Collapse)Author
2023-01-26LibGfx: Remove `try_` prefix from bitmap creation functionsTim Schumacher
Those don't have any non-try counterpart, so we might as well just omit it.
2023-01-07LibGUI+Userland: Rename `try_load_from_gml()` -> `load_from_gml()` :^)Sam Atkins
It's the only one, so the `try` prefix is unnecessary now.
2023-01-06LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)Sam Atkins
Rip that bandaid off! This does the following, in one big, awkward jump: - Replace all uses of `set_main_widget<Foo>()` with the `try` version. - Remove `set_main_widget<Foo>()`. - Rename the `try` version to just be `set_main_widget` because it's now the only one. The majority of places that call `set_main_widget<Foo>()` are inside constructors, so this unfortunately gives us a big batch of new `release_value_but_fixme_should_propagate_errors()` calls.
2023-01-01Snake: Make initialization from GML fallibleSam Atkins
Replace the C_OBJECT factory functions with a custom try_create() which loads the various bitmaps. Any failures there are now propagated.
2022-12-23Snake: Use a statusbar to display the current and high scoreTimothy Flynn
The food bitmaps would sometimes be placed underneath the score text, which was a bit hard to see. Use a statusbar like we do in other games like Solitaire. Note the default height change of the Snake window is to make the inner game widget fit exactly 20x20 cells.
2022-12-23Snake: Convert the game window to GMLTimothy Flynn
Unfortunately, GML widget registration requires a non-fallible construct method to create the widget. So this does a bit of manual error checking when loading the food bitmaps.
2022-12-23Snake: Move GUI into Snake namespace and rename SnakeGame to GameTimothy Flynn
The former is required for GML, and the latter is to avoid the verbosity and redundancy of Snake::SnakeGame (and matches most other games in the system).
2022-12-23Snake: Save configured base color to Snake's configuration fileTimothy Flynn
2022-12-19Snake: Ignore default keydown eventsBaitinq
Before this patch, all key down events except arrow keys or WASD were not propagated, so keyboard shortcuts in the application didn't work. This patch fixes this :))
2022-12-19Snake: Add snake color chooser game menu actionBaitinq
This patch makes use of a new "set_snake_base_color()" function to change the snake's base color to the picked value.
2022-12-19Snake: Don't hardcode the snake painting logicBaitinq
This patch adds a m_snake_base_color variable which dictates the color of the head of the snake and from which the rest of the snake color's are derived from by darkening the base color.
2022-12-19Snake: Add pause/continue game menu actionBaitinq
This patch adds an action in the Snake's game menu that allows for easy pausing/unpausing of the game state. In order to do this, the commit adds new pause()/start() functions in the SnakeGame class ;)
2022-12-14Snake: Make a factory function for SnakeGame and propagate errorsAndreas Kling
This fixes a whopping 29 FIXMEs. :^)
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-10-25Userland: Let applications make use of make_command_palette_action()demostanis
2022-10-21Snake: Add more emoji as in-game food graphicsXexxa
2022-10-20Snake: Use emoji for in-game food graphicsXexxa
2022-10-03Userland: Tighten promises by removing 'proc' where it isn't usedTimothy Flynn
This is a partial revert of commit 7af5eef. After 97d15e9, the 'proc' promise is not needed for operations using getsid(). This also fixes launching several applications in which 7af5eef added the 'proc' promise only in the second call to pledge().
2022-10-03SystemServer+LoginServer+Userland: Switch to sid-based socketsPeter Elliott
This commit does three things atomically: - switch over Core::Account+SystemServer+LoginServer to sid based socket names. - change socket names with %uid to %sid. - add/update necessary pledges and unveils. Userland: Switch over servers to sid based sockets Userland: Properly pledge and unveil for sid based sockets
2022-10-02Snake: Show message box on game overmatcool
Previously the game would immediately reset on game over, but now it'll pause the game and show a message box with your score.
2022-09-29AK+Everywhere: Replace "protocol" with "scheme" url helpersnetworkException
URL had properly named replacements for protocol(), set_protocol() and create_with_file_protocol() already. This patch removes these function and updates all call sites to use the functions named according to the specification. See https://url.spec.whatwg.org/#concept-url-scheme
2022-08-14Everywhere: Replace hardcoded anon's uid in unveil path with `%uid`Lucas CHOLLET
2022-08-14LibCore+LaunchServer: Move portal directory to `/tmp/user/%uid`Lucas CHOLLET
The `/tmp/user` directory is owned by root, this solution prevents malicious users to interfere with other users' portals. This commit also moves `launch`'s portal in the user directory.
2022-07-19LaunchServer+SystemServer: Move the portal to a user-specific directoryLucas CHOLLET
Various changes are needed to support this: - The directory is created by Core::Account on login (and located in /tmp). - Service's sockets are now deleted on exit (to allow re-creation) - SystemServer needs to handle SIGTERM to correctly destroy services.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-18Games: Add reload icon to 'New Game' actionsLinus Groh
2022-02-16Games: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-02-11LibConfig: Rename pledge_domains(String) => pledge_domain(String)Vitaly Dyachkov
pledge_domains() that takes only one String argument was specifically added as a shortcut for pledging a single domain. So, it makes sense to use singular here.
2022-01-13Snake: Add link to help pages in menuDavid Lindbom
2021-12-18Snake: Convert to try_create_default_iconAstraeus-
2021-11-28Everywhere: Use default execpromises argument for Core::System::pledgeBrian Gianforcaro
2021-11-27Snake: TRY() all the things in serenity_main() :^)Pedro Pereira
2021-11-24Snake: Replace construct() with TRY(try_create()) patternPedro Pereira
2021-11-23Snake: Port to LibMainPedro Pereira
Simplified two pledge() and two unveil() by using TRY().
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-09-13Everywhere: Use my fancy new serenityos.org email :^)Mustafa Quraish
2021-08-30Snake: Use AK::get_random_uniform() instead of rand()Andreas Kling
2021-08-28Snake: Remove wpath and cpath pledgesLuke Wilde
With the move to LibConfig, these are no longer needed.
2021-08-27Snake: Use LibConfig instead of Core::ConfigFileMustafa Quraish
2021-08-22Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to opennetworkException
This patch brings the ConfigFile helpers for opening lib, app and system configs more inline with the regular ConfigFile::open functions.
2021-08-22Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writingnetworkException
2021-07-21Userland: Add GUI::Window::add_menu() and use it everywhereAndreas Kling
Applications previously had to create a GUI::Menubar object, add menus to it, and then call GUI::Window::set_menubar(). This patch introduces GUI::Window::add_menu() which creates the menubar automatically and adds items to it. Application code becomes slightly simpler as a result. :^)
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-05-20LibGfx: Remove Gfx::FontDatabase::default_bold_fixed_width_font()Andreas Kling
Ask for a bold_variant() of the default_fixed_width_font() instead.
2021-05-13Userland: Tighten a *lot* of pledges! :^)Andreas Kling
Since applications using Core::EventLoop no longer need to create a socket in /tmp/rpc/, and also don't need to listen for incoming connections on this socket, we can remove a whole bunch of pledges!