53 Commits

Author SHA1 Message Date
IntegratedQuantum
74c896c969 Handle errors locally instead of letting them bubble up into the main functions. 2024-01-31 22:42:20 +01:00
IntegratedQuantum
2c33f3779d Switch to a self-made list data structure that doesn't return OutOfMemory errors. 2024-01-30 16:34:40 +01:00
IntegratedQuantum
de004841b7 Handle OutOfMemory errors centrally for the globalAllocator and derivatives.
To let the rest of the code know about this decision I implemented a wrapper over the Allocator interface which cannot fail.

This is just the first step in the upcoming refactoring attempt.
2024-01-29 17:22:20 +01:00
IntegratedQuantum
178489b044 Merge All ItemSlot types into one struct.
Fixes #240
2024-01-26 00:14:51 +01:00
IntegratedQuantum
4f789c4cca Update zig, forcing constness 2023-11-21 16:23:24 +01:00
IntegratedQuantum
e61709cb69 Rethink the allocation strategy.
Instead of one general purpose allocator per thread, there now is one stack allocator per thread, which behaves like a basic stack.
Using this allocator for all the trivial allocations, makes the game overall more efficient, even if some larger allocations now require going through the global allocator.
Maybe in the future the stack allocator could be extended with a temporary arena allocator functionality?

This should help with #171 by almost halfing the CPU usage of the receiving network thread. However the issue remains.
2023-11-21 16:06:19 +01:00
IntegratedQuantum
f3a197f6d4 Default gui positions
Resolves #131
2023-10-15 22:26:02 +02:00
IntegratedQuantum
cc9a06ef29 Fix some TODOs. 2023-10-06 22:34:36 +02:00
IntegratedQuantum
248691d54d Store key names at runtime instead of at compile time.
Reduces code complexity and binary size.
2023-07-24 11:36:45 +02:00
IntegratedQuantum
7cb347ce3c Update zig to 0.11.0-dev.3990+f2d433a19 2023-07-14 11:24:18 +02:00
IntegratedQuantum
93b2a29cc8 Add a volume slider. 2023-07-03 11:27:50 +02:00
IntegratedQuantum
7c3d3462c9 Update zig version to 0.11.0-dev.3879+5804f3f75
Note: Requires running `zig fmt` in the mach subfolder to work.

Zig did some weird stuff there. Partially helpful, partially annoying. But it made me clean up some old code, so that's a good thing I guess.
2023-06-28 19:54:52 +02:00
IntegratedQuantum
0867dd1975 Update mach-freetype (it finally works again!!!) and fix problems when there was no settings or guilayout file. 2023-06-21 17:38:58 +02:00
IntegratedQuantum
4402c55203 A couple of small improvements. 2023-05-25 13:36:48 +02:00
IntegratedQuantum
0c3743fd02 Add some file utilities to simplify reading/writing (json-)files. 2023-04-09 21:44:15 +02:00
IntegratedQuantum
b98f565f2e Start working on the server:
It can now do a handshake (sort of).
I also added a CommandQueue for the gui system to prevent issues from closing windows while they are being updated.
2023-04-09 11:28:21 +02:00
IntegratedQuantum
32a4e2cb10 Send inventory changes to the server. 2023-04-08 12:59:26 +02:00
IntegratedQuantum
84d55cc95c Finish some remaining TODOs in the gui system. 2023-04-07 22:52:24 +02:00
IntegratedQuantum
3212e00b42 Add a userData argument to all gui callbacks and some more refactoring. 2023-04-04 21:50:57 +02:00
IntegratedQuantum
914be9cf63 Add debug overlay and performance graph. 2023-04-04 19:22:02 +02:00
IntegratedQuantum
e0321c6cbf Various ui improvements proposed by @till++ 2023-04-03 19:01:49 +02:00
IntegratedQuantum
da8f6ac9cb Add inventory crafting. 2023-03-31 20:37:39 +02:00
IntegratedQuantum
58d1428392 Tooltips. 2023-03-29 11:41:13 +02:00
IntegratedQuantum
2f5ff8f081 Throw items out of the inventory when clicking outside of an inventory slot. 2023-03-27 22:17:55 +02:00
IntegratedQuantum
f927487a0f Add inventory and creative inventory. 2023-03-27 17:51:00 +02:00
IntegratedQuantum
bbcc9caff0 Allow interacting with item slots. 2023-03-27 12:37:47 +02:00
IntegratedQuantum
758fe2c8ab Use @hasDecl and automatically assign the window function pointers. 2023-03-23 17:13:40 +01:00
IntegratedQuantum
642624c94d Add the ItemSlot component. 2023-03-23 13:08:29 +01:00
IntegratedQuantum
f158da89d4 Seperate the gui and game update logic, so you won't move while typing into a text field. 2023-03-22 14:29:55 +01:00
IntegratedQuantum
77610c0064 Add the chat gui and set the default text color to white. 2023-03-22 13:59:46 +01:00
IntegratedQuantum
ba8856bd35 Add the crosshair. 2023-03-18 22:54:05 +01:00
IntegratedQuantum
0467e43163 Update the position of closed windows as well to prevent weird behavior. 2023-03-17 16:26:49 +01:00
IntegratedQuantum
9e7f3defe2 Add HorizontalList, add alignment to list components and fix a bug. 2023-03-17 16:18:43 +01:00
IntegratedQuantum
5c74694611 Refactor how components are handled.
- A `GuiComponent` now is union of pointers.
- `pos` and `size` are now stored in each component rather than being passed down through functions.
2023-03-17 13:47:07 +01:00
IntegratedQuantum
fd0e903431 Refactor: Simplify window creation by limiting it to a single window per namespace. 2023-03-17 11:25:46 +01:00
IntegratedQuantum
bb904828e8 Save/Load the gui layout. 2023-03-15 22:25:32 +01:00
IntegratedQuantum
2523947a9c Finish the change name window. 2023-03-12 17:43:57 +01:00
IntegratedQuantum
0d064fc9da Dynamic gui scale and some refactoring and fixes. 2023-03-12 17:11:00 +01:00
IntegratedQuantum
ecbcfd3ed0 Implement updateHovered which only updates the components that are on the front-most window at the cursor position.
This is for example used to prevent marking buttons as hovered when another window is above it.
2023-03-12 16:04:20 +01:00
IntegratedQuantum
b8f5b84322 Text can now be scrolled. 2023-03-11 17:45:20 +01:00
IntegratedQuantum
44eed8026d Refactor: Use one global allocator for all gui related stuff. 2023-03-10 17:24:36 +01:00
IntegratedQuantum
1c12ba3459 Add a texture for text fields. 2023-03-10 16:53:21 +01:00
IntegratedQuantum
1d9d38c9b7 Newline on enter. 2023-03-08 12:42:23 +01:00
IntegratedQuantum
c2e888031f Add a TextInput component that supports multiline text editing. 2023-03-07 20:53:57 +01:00
IntegratedQuantum
df73bc964e Add a Checkbox. 2023-03-01 16:43:05 +01:00
IntegratedQuantum
b5e8ba4d20 Add a Slider component. 2023-03-01 10:55:41 +01:00
IntegratedQuantum
17dead15da Prepare the menu/settings related windows. 2023-02-24 19:36:18 +01:00
IntegratedQuantum
61e2e417a2 Add textures for the button and window. 2023-02-24 13:25:59 +01:00
IntegratedQuantum
ff7df1bdbc The for loop update. 2023-02-21 21:34:09 +01:00
IntegratedQuantum
313f31915e Add a VerticalList layouting component.
Also made some ergonomical changes.
2023-02-16 22:51:03 +01:00