Commit Graph

16 Commits

Author SHA1 Message Date
Simon Anciaux bd7dac90ac Using 4coder string functions in code/4ed_api_parser_main.cpp instead of manually creating the strings.
Added "code/" in the string that point to the generator so it's easier to find the correct files.
Regenerated the 4 affected files (just to update the comment string).
2025-07-07 13:14:30 -07:00
Simon Anciaux 0e2b8d0df8 A user reported on the handmade network discord an issue where when you change the font size (e.g. ctrl + scroll up/down) 4coder was crashing. They were using the D3D11 renderer.
The crash is caused by dereferencing a invalid pointer to a texture. The D3D11 renderer as a arbitrary limit of 32 textures (there is normally no reason to have more than 2 or 3 textures in 4coder) because it needs to keep track of a few pointer in its state, while OpenGL doesn't (it just uses the id returned by `glGenTexture`). The code that recreate the texture atlas when changing the font size, never frees the previous texture, so both DirectX and OpenGL are leaking texture.

So this fix just frees the previous texture after 4coder successfully creates a new one. If for some reason the new texture can't be created, we continue using the last one. This is better than crashing as we can still use 4coder, but since we can't change font size anymore the editor might be stuck with a uncomfortable font size.

Unfortunately 4coder doesn't expose a way to delete texture outside the platform layer, and the font size code is not in the platform layer. So I had to expose a `free texture` function, which lead me to understand how 4coder generates API in the `generated` folder.

I updated the README to keep that information somewhere since it's not clear from the get go. The basic idea is that there are a few files that you can compile as a small standalone program and run to generate the files. For the graphics api, you need to compile `4ed_graphics_api.cpp`.

I took some time to also modify a little the generator so that the generated file contains the name of the file that generated them, and added a bit of indentation to make the file a bit more readable (even if we're not supposed to modify them).
2025-07-07 13:11:48 -07:00
Simon Anciaux c194053b83 4ed_generate_keycodes.cpp adds a comment at the top of the file it generate to specify which file generated it. Added proper indentation in the generated file. Note that this executable needs to be manually ran. The build system doesn't run it.
win32_keycode_init only initialize 30 KeyCode_Ex values (0 to 29) as the code generating the enum only generates that amount (explicitly loops from 0 to < 30).
2025-07-07 13:09:34 -07:00
Peter Slattery 75e72875ff Implement new build system 2025-07-06 12:44:54 -07:00
Peter Slattery b280722b1c set NSApp activateIgnoringOtherApps to YES 2025-04-24 16:18:01 -07:00
PS be632574e6 Added yeet sheet implementation 2024-05-13 19:29:16 -07:00
PS 120c6ceaad gs_parse_jump_location handles jai paths better 2024-03-27 13:49:52 -07:00
Peter Slattery cba2574e8a 4coder_command_map now gets the best match for a given input rather than the first match when Loose Matching 2024-03-22 16:17:44 -06:00
PS 24c8370f75 Indent next line only on hitting enter 2024-02-10 20:12:36 -08:00
PS 22fa2794e7 Project generation uses treat_as_code extensions to create project include patterns 2024-02-10 18:45:05 -08:00
PS e3ba01570a Backspace in file search deletes whole word 2024-02-10 15:55:05 -08:00
PS 7aa033783c Implemented custom modal bindings 2024-02-10 15:38:37 -08:00
PS 80b780278a Removed custom/audio 2024-02-10 14:25:13 -08:00
PS 0d840d128e command_metadata.h updated and 4coder project created 2024-02-10 13:02:25 -08:00
Jack Punter e2b3bd9f3e Correct build for new structure 2022-11-18 16:43:00 +00:00
Jack Punter 0e47ccd2ce Add 'code/' from commit '1459ef7cbce753b056ea148b29c9dc3f8a721261'
git-subtree-dir: code
git-subtree-mainline: cf6a50363e
git-subtree-split: 1459ef7cbc
2022-11-18 13:37:07 +00:00