Commit Graph

174 Commits

Author SHA1 Message Date
Xavier Del Campo Romero 6b54e9be32 Implement GUI line edit 2022-09-20 17:34:25 +02:00
Xavier Del Campo Romero 6867fb76c1 gui: Implement gui_deinit 2022-09-20 17:34:25 +02:00
Xavier Del Campo Romero 635d950efd Implement net component 2022-09-20 17:34:21 +02:00
Xavier Del Campo Romero 42b976af1b Implement FindENET.cmake
This library will be later used for networking over UDP/IPv4 in future
commits.
2022-09-20 17:22:45 +02:00
Xavier Del Campo Romero 87b4ef3a15 Remap calls to pad/mouse/keyboard to input 2022-09-20 16:56:30 +02:00
Xavier Del Campo Romero 14df82ee4d Implement input component
It is required to redirect keyboard input (both physical or not) when
a GUI line edit is focused. This means other components cannot be
activated on key presses.

Therefore, this new component is meant as a higher-level abstraction
compared to the `keyboard`/`pad`/`mouse` components, which:

- Implements the same APIs provided by `keyboard`, `mouse` and `pad`.
- Returns the same results as the APIs above if no GUI element is
focused, no input otherwise.

Note: replacing calls to `keyboard`/`pad`/`mouse` with `input` will be
implemented in a future commit.
2022-09-20 13:52:14 +02:00
Xavier Del Campo Romero a01b22de74 keyboard: Add new public functions
These will be used by future commits.
2022-09-20 13:52:14 +02:00
Xavier Del Campo Romero ee37be47b9 Minor code style fixes 2022-09-20 13:51:08 +02:00
Xavier Del Campo Romero 244ddd07c1 sdl-1.2: Remap missing keyboard keys 2022-09-20 12:30:06 +02:00
Xavier Del Campo Romero cd96d3a9de keyboard_key.h: add more keys 2022-09-20 12:29:45 +02:00
Xavier Del Campo Romero 985a1d4fd7 sdl-1.2: Remap SDLK_ESCAPE to KEYBOARD_KEY_ESC 2022-09-16 20:35:04 +02:00
Xavier Del Campo Romero 92359fc964 mouse.c: Reduce threshold 2022-09-16 20:33:39 +02:00
Xavier Del Campo Romero 95ae0911ff Split CMakeLists.txt for src 2022-09-16 20:29:47 +02:00
Xavier Del Campo Romero 1ad52adf0d Split res-related CMake functions into their own file 2022-09-16 14:28:53 +02:00
Xavier Del Campo Romero 64f75ac924 CMakeLists.txt: bump minimum CMake version 2022-09-16 14:27:18 +02:00
Xavier Del Campo Romero e8dd951c6c Use find_package for SDL libraries
CMake already distributes FindSDL*.cmake files for SDL and SDL_mixer,
which support custom prefixes via environment variables, removing the
need for ad-hoc logic in Win9x builds.

Also, according to FindSDL.cmake, #include <SDL.h> is the preferred way
for portability reasons, instead of #include <SDL/SDL.h>, which is the
option that has been used so far.
2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero 94d98176ea ps1.cmake: import PSXSDK using find_package 2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero 55e2d00c45 README.md: Update documentation for Win9x builds 2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero a091af05c6 ps1: Use exported target PSXSDK::PSXSDK 2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero 8ed1c6e8b3 Implement FindPSXSDK.cmake 2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero 4d40033323 Update FindSDL_gfx.cmake as of today's upstream
Ongoing PR:
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7475
2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero 17380ab7d5 system/CMakeLists.txt: group common private dependencies into var 2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero 8b9822c013 Create cdroot directory on common CMakeLists.txt 2022-07-23 04:23:05 +02:00
Xavier Del Campo Romero e59e4c061e README.md: Document dependencies for Ubuntu builds 2022-07-23 04:16:57 +02:00
Xavier Del Campo Romero 0b201a49f6 CMakeLists.txt: Define rts as a C-only project
While it is true "extern C" is used on all headers, there is no need for
CMake to check the C++ compiler.
2022-07-23 04:16:57 +02:00
Xavier Del Campo Romero 24693bc9ed SDL-1.2: Implement X mirroring for quads 2022-07-15 01:35:46 +02:00
Xavier Del Campo Romero ca510a11c4 Import SDL_gfx 2022-07-15 01:03:36 +02:00
Xavier Del Campo Romero 450cdc3fab Implement FindSDL_gfx.cmake
Surprisingly, as of today (July 2022) CMake ships with FindSDL*.cmake
files for several SDL libraries such as SDL_mixer or SDL_image, but not
for SDL_gfx, so one was created, based on FindSDL_mixer.cmake.

Reference:
8a3004d5c2/Modules/FindSDL_mixer.cmake
2022-07-15 01:03:36 +02:00
Xavier Del Campo Romero 938b35033b gui: Update elements in reverse order
This allows to calculate dimensions for containers with children
containers in it.
2022-07-15 01:03:36 +02:00
Xavier Del Campo Romero e66894e3f8 Deprecate memset(3) in favour of C99 compound literals 2022-07-15 01:03:31 +02:00
Xavier Del Campo Romero f69dc6f359 Allow children of gui_container be resized anytime
So far, their position inside the container was determined when
initializing the interface. However, if a child were resized
afterwards, the container would not adjust its elements accordingly.
Moreover, the implementation for gui_container relied on hacking the
children's X/Y coordinates, which could only be done once.

Now, two additional members have been added to gui_common so that
specific X/Y offset can be determined by the parent, additionally to the
traditional rules followed by gui_coords. Despite the extra memory
footprint, it now allows containers to set specific X/Y offsets for
their children on every game cycle.
2022-07-10 00:26:48 +02:00
Xavier Del Campo Romero f318a66f8c Implement join/host and game cfg menus 2022-07-07 02:45:23 +02:00
Xavier Del Campo Romero e50aad2a6d Implement system_can_exit 2022-07-07 02:45:23 +02:00
Xavier Del Campo Romero dc4a3a2db8 Allow multiple button types 2022-07-07 02:37:25 +02:00
Xavier Del Campo Romero 3f793166bd button.c: fix wrong function call 2022-07-07 02:37:25 +02:00
Xavier Del Campo Romero 196a7501fe rounded_rect.h: fix typo 2022-07-07 02:37:25 +02:00
Xavier Del Campo Romero 3bc4b6f996 font.c: set null dimensions on null str 2022-07-02 04:50:50 +02:00
Xavier Del Campo Romero c0bdd53c90 human_player_gui.c: use gui_container for top gui_bar 2022-07-02 04:47:50 +02:00
Xavier Del Campo Romero ac913a3ff5 gui/container: support spacing between GUI elements 2022-07-02 04:42:41 +02:00
Xavier Del Campo Romero 1d40cadf43 gui/bar: support arbitrary x/y and width 2022-07-02 04:41:22 +02:00
Xavier Del Campo Romero 85e11e8f98 gui: reuse callback data
There is no need to allocate memory for these callbacks for each single
GUI element. Instead, a single, statically-allocated instance can be
shared among all GUI elements of a given type.
2022-07-02 04:08:35 +02:00
Xavier Del Campo Romero f4357485e6 menu: implement main menu using new GUI improvements 2022-07-02 00:58:50 +02:00
Xavier Del Campo Romero c10ca65109 gui: implement container
Containers, somewhat inspired by GtkBox, allow to packed other GUI
elements into a single row or column.
2022-07-02 00:53:03 +02:00
Xavier Del Campo Romero fa766deaf4 button.c: h/v-center child label by default 2022-07-02 00:50:26 +02:00
Xavier Del Campo Romero e4558e9ba0 gui.c: fix wrong logic on gui_coords
The older logic would iterate for all parents, where each parent would
again iterate for all of its parents, until no more parents found.
This is however not needed, since only inspecting the closest parent
will already cause the (recursive) algorithm to iterate for all parents.
2022-07-02 00:49:36 +02:00
Xavier Del Campo Romero 270c6101f6 gui: allow custom add_child callback 2022-07-02 00:45:51 +02:00
Xavier Del Campo Romero 1a67c196a5 host.cmake, win9x.cmake: fetch libfixmath if missing 2022-06-30 22:49:35 +02:00
Xavier Del Campo Romero e5bbfc6dc4 menu.c: center play button on screen 2022-06-29 01:01:31 +02:00
Xavier Del Campo Romero 2cd99b1bcf button.c: fail on negative width 2022-06-29 01:01:03 +02:00
Xavier Del Campo Romero 3e50314b44 gui: implement {h,v}centered 2022-06-29 00:39:06 +02:00