summaryrefslogtreecommitdiff
path: root/Userland/Demos
AgeCommit message (Collapse)Author
2021-08-10Mandelbrot: Only recalculate missing areas after panningsin-ack
We can reuse the areas that we have from before and just recalculate the areas that are fresh. This makes panning super smooth. :^)
2021-08-10Mandelbrot: Add panningsin-ack
Adds the ability to use the middle-mouse click to pan the current view.
2021-08-10Mandelbrot: Add mousewheel zoomingsin-ack
This allows the user to zoom in with a up scroll of the mousewheel and zoom out with a down scroll.
2021-08-10Mandelbrot: Use a GUI::Frame to paint intosin-ack
This allows us to have a frame border which looks nicer.
2021-08-08WidgetGallery: Change model update() functions to invalidate()sin-ack
These functions reload the whole model contents and thus can be moved to invalidate(), which saves us from the need to manually call update() on them.
2021-08-06Everywhere: Replace Model::update() with Model::invalidate()sin-ack
Most of the models were just calling did_update anyway, which is pointless since it can be unified to the base Model class. Instead, code calling update() will now call invalidate(), which functions identically and is more obvious in what it does. Additionally, a default implementation is provided, which removes the need to add empty implementations of update() for each model subclass. Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-08-03Everywhere: Replace most cases of exit() with Application::quit()Timothy
Application::quit() is nicer for most cases where exit() is used. Cases where exit() is used intentionally for early termination are left intact.
2021-08-01Demos: Remove unused header includesBrian Gianforcaro
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-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-17WidgetGallery: Pledge threadMarcus Nilsson
This is needed to use the file picker dialog.
2021-07-17WidgetGallery: Remove unused includeMarcus Nilsson
2021-07-08AK+Userland: Add generic `AK::abs()` function and use itDaniel Bertalan
Previously, in LibGFX's `Point` class, calculated distances were passed to the integer `abs` function, even if the stored type was a float. This caused the value to unexpectedly be truncated. Luckily, this API was not used with floating point types, but that can change in the future, so why not fix it now :^) Since we are in C++, we can use function overloading to make things easy, and to automatically use the right version. This is even better than the LibC/LibM functions, as using a bit of hackery, they are able to be constant-evaluated. They use compiler intrinsics, so they do not depend on external code and the compiler can emit the most optimized code by default. Since we aren't using the C++ standard library's trick of importing everything into the `AK` namespace, this `abs` function cannot be exported to the global namespace, as the names would clash.
2021-07-05Fire: Make the main widget a GUI::FrameAndreas Kling
2021-07-04WindowServer: Make most remaining WindowServer IPC calls asyncAndreas Kling
The only remaining sync call from client to server is now the call that switches a window's backing store. That one actually relies on the synchronization to hand over ownership of the backing stores, so it has to stay synchronous for now.
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-06-07CatDog: Enhance the speech bubble artificial intelligenceBrian Gianforcaro
Enable cat dog to greet you, and help you with yak shave sessions.
2021-06-06AK+Everywhere: Disallow constructing Functions from incompatible typesAli Mohammad Pur
Previously, AK::Function would accept _any_ callable type, and try to call it when called, first with the given set of arguments, then with zero arguments, and if all of those failed, it would simply not call the function and **return a value-constructed Out type**. This lead to many, many, many hard to debug situations when someone forgot a `const` in their lambda argument types, and many cases of people taking zero arguments in their lambdas to ignore them. This commit reworks the Function interface to not include any such surprising behaviour, if your function instance is not callable with the declared argument set of the Function, it can simply not be assigned to that Function instance, end of story.
2021-05-29Everywhere: Use s.unverwerth@serenityos.org :^)Stephan Unverwerth
2021-05-21Revert "Userland: static vs non-static constexpr variables"Linus Groh
This reverts commit 800ea8ea969835297dc7e7da345a45b9dc5e751a. Booting the system no longer worked after these changes.
2021-05-21Userland: static vs non-static constexpr variablesLenny Maiorani
Problem: - `static` variables consume memory and sometimes are less optimizable. - `static const` variables can be `constexpr`, usually. - `static` function-local variables require an initialization check every time the function is run. Solution: - If a global `static` variable is only used in a single function then move it into the function and make it non-`static` and `constexpr`. - Make all global `static` variables `constexpr` instead of `const`. - Change function-local `static const[expr]` variables to be just `constexpr`.
2021-05-21LibGfx: Add missing TextAlignment::BottomLeftLinus Groh
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-20LibGfx: Remove Gfx::FontDatabase::default_bold_font()Andreas Kling
Instead use default_font().bold_variant() in cases where we want a bold variant of the default font. :^)
2021-05-19CatDog: Don't show context menu when clicking outside of widgetMarcus Nilsson
The context menu for CatDog was shown when right clicking anywhere on the screen because of global cursor tracking being enabled. Also fix event not being passed by reference. Fixes #7285
2021-05-193DFileViewer: Move `Demos/GLTeapot` to `Applications/3DFileViewer`Erik Biederstadt
Also changes the category to `Graphics`
2021-05-19GLTeapot: Adds a help menu to the GLTeapot demoErik Biederstadt
Having a help menu maintains better consistency with the other GUI apps on the system.
2021-05-19GLTeapot: Adds additional error checking when loading filesErik Biederstadt
- If the 3D file contains no vertices then an error is raised - If the file is not an OBJ file then an error is raised
2021-05-19GLTeapot: Add the ability to open 3D filesErik Biederstadt
This change makes it possible for the GLTeapot demo to open any OBJ file.
2021-05-18CatDog: Remove global menu and add context menuMarcus Nilsson
There was no way to close catdog since it relied on global menus, this adds a context menu for opening the about dialog and quitting. Fixes #7252
2021-05-18Mandelbrot: Export images in a fixed resolutionGunnar Beutner
This makes the exported image independent from the current window size and just always exports it at 1920x1080.
2021-05-18Mandelbrot: Keep the aspect ratio when (re-)sizing the windowGunnar Beutner
Previously the initial aspect ratio was incorrect and there was nothing to ensure that the aspect ratio is kept when resizing the window.
2021-05-18Mandelbrot: Add support for exporting the current imageGunnar Beutner
Unfortunately this means unveil() won't work - at least until we get something like FilePickerServer.
2021-05-18Mandelbrot: Implement color smoothing with gradientsGunnar Beutner
This removes the color banding that happens for some of the "outer" areas which all have the same iteration count.
2021-05-18Mandelbrot: Maintain aspect ratio when selecting a regionGunnar Beutner
This makes sure the aspect ratio of the widget and the selection match. Otherwise you'd end up with distorted images when zooming in.
2021-05-17Demos: Add Mandelbrot demoGunnar Beutner
This adds a very rudimentary Mandelbrot viewer. It supports zooming and pretty much nothing else. Not even color smoothing or super sampling.
2021-05-16GLTeapot: Add support for loading OBJ files containing extra informationErik Biederstadt
If the OBJ loader encounters a file with vertex normals or texture coordinates then it will no longer crash.
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!
2021-05-13LibGfx+Demos: Make Matrix4x4 a true alias for Matrix<4,T>Stephan Unverwerth
Matrix4x4 was defined as a derived class of Matrix<N,T> before. Furthermore, some code was duplicated and it was overall just messy. This commit turns Matrix4x4 into a simple alias for Matrix<4,T>.
2021-05-13LibGfx: Make Matrix class consistently row-majorStephan Unverwerth
Matrix elements were interpreted in different ways. This makes it definitely row-major, allowing initialization via initializer list in a standard scientific order. Also matrix multiplication now happens in the correct order and accessing elements happens as m_elements[row][column].
2021-05-12Everywhere: Add Alt shortcuts to remaining top-level menusLinus Groh
Not sure why some menus did have one and others didn't, even in the same application - now they all do. :^) I added character shortcuts to some menu actions as well.
2021-05-12Everywhere: Rename app_menu to file_menu, continuedLinus Groh
These were missed in 4b0098e.
2021-05-12LibCore+Everywhere: Move OpenMode out of IODeviceAli Mohammad Pur
...and make it an enum class so people don't omit "OpenMode".
2021-05-11GLTeapot: Use glGenLists() a bit to demonstrate that it worksAli Mohammad Pur
2021-05-09Demos: Implement basic Lambertian lighting for the GLTeapotMathieu Gaillard
The teapot now looks more realistic
2021-05-09Demos: Add indexed meshes in GLTeapot DemosMathieu Gaillard
Improved the basic Wavefront OBJ loader to index vertices. Uses less memory for the same mesh.
2021-05-09Demos: GLTeapot: Enable depth testing in demoStephan Unverwerth
2021-05-09CatDog: Help the user debug their programsGunnar Beutner
This adds helpful speech bubbles to CatDog. CatDog just wants to help, that's all.
2021-05-09CatDog: Rename root_widget to catdog_widgetGunnar Beutner