{"author_link":"\/users\/philliptrudeau","author_name":"philliptrudeau","author_uid":"philliptrudeau","comments":[],"epoch":1570251012,"event":"LD45","format":"md","ldjam_node_id":168787,"likes":13,"metadata":{"p_key":"134200","p_author":"philliptrudeau","p_authorkey":"1164906","p_urlkey":"350439","p_title":"Start with nothing in C: the first 3 hours","p_cat":"LDJam ","p_event":"LD45","p_time":"1570251012","p_likes":"13","p_comments":"0","p_status":"WAYBACK","us_key":"1164906","us_name":"philliptrudeau","us_username":"philliptrudeau","event_start":"1570147200","event_key":"78","event_name":"Ludum Dare 45"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD45","removed_author":false},"_superparent":159347,"_trust":2,"author":164906,"body":"First Ludum Dare; second jam.\nMy self-imposed challenge is to build the game from scratch in C with no `#include`s or `#define`s. This means no libraries except the ones I link against and manually pre-declare as headers. (Meaning, in this case, just Windows, and no C runtime library.)\n\nSo far I've written a simple OpenGL loader, and this macro-less assertion handler:\n```\nstatic void assert_passed(void) {}\nstatic void (*assert(bool condition))(void) {\n    if (condition) return assert_passed;\n    \/\/ stack trace printing code omitted\n    int result = MessageBoxA(NULL, textual_trace, \"Assert Fired\", 0x2102);\n    if (result == 3) ExitProcess(1);\n    if (result == 4) return NULL; \/\/ 4 represents \"Retry\" being clicked in the message box\n    return assert_passed;\n}\n\/\/ Usage code:\nint swap_result = GL.wglSwapIntervalEXT(0);\nassert(swap_result)(); \/\/ calls a NULL function pointer if \"Retry\" is clicked in the message box, crashing and\/or trapping to debugger.\n```\n(I had to format the stack trace myself, because there's no printf!)\n\nThe big challenges will be asset loading and audio. I have written WASAPI code from scratch before, so I'll reuse that, but I've only ever done simple additive wave synthesis with it, so the music will be pretty minimalistic; more of a tracker-music vibe, probably. (I'm a fan of Fearofdark!)\n\nGot simple fixed-function rendering going on right now to draw a blue square to the screen. Runs at about 7,000 FPS, so it's less than ideal, but it'll do for a game jam.![blog1pic1.png](\/\/\/raw\/a24\/82\/z\/25853.png)","comments":1,"comments-timestamp":"2019-10-05T05:04:43Z","created":"2019-10-05T00:47:32Z","files":[],"files-timestamp":0,"id":168787,"love":13,"love-timestamp":"2019-10-07T01:00:13Z","meta":[],"modified":"2019-10-07T01:00:13Z","name":"Start with nothing in C: the first 3 hours","node-timestamp":"2019-10-05T04:52:07Z","parent":164909,"parents":[1,5,9,159347,164909],"path":"\/events\/ludum-dare\/45\/word-salad\/start-with-nothing-in-c-the-first-3-hours","published":"2019-10-05T04:50:12Z","scope":"public","slug":"start-with-nothing-in-c-the-first-3-hours","subsubtype":"","subtype":"","type":"post","version":493821},"node_metadata":{"n_key":"168787","n_urlkey":"350439","n_parent":"164909","n_path":"\/events\/ludum-dare\/45\/word-salad\/start-with-nothing-in-c-the-first-3-hours","n_slug":"start-with-nothing-in-c-the-firs","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"164906","n_created":"1570236452","n_modified":"1570410013","n_version":"493821","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/45\/word-salad\/start-with-nothing-in-c-the-first-3-hours","text":"First Ludum Dare; second jam.\nMy self-imposed challenge is to build the game from scratch in C with no `#include`s or `#define`s. This means no libraries except the ones I link against and manually pre-declare as headers. (Meaning, in this case, just Windows, and no C runtime library.)\n\nSo far I've written a simple OpenGL loader, and this macro-less assertion handler:\n```\nstatic void assert_passed(void) {}\nstatic void (*assert(bool condition))(void) {\n    if (condition) return assert_passed;\n    \/\/ stack trace printing code omitted\n    int result = MessageBoxA(NULL, textual_trace, \"Assert Fired\", 0x2102);\n    if (result == 3) ExitProcess(1);\n    if (result == 4) return NULL; \/\/ 4 represents \"Retry\" being clicked in the message box\n    return assert_passed;\n}\n\/\/ Usage code:\nint swap_result = GL.wglSwapIntervalEXT(0);\nassert(swap_result)(); \/\/ calls a NULL function pointer if \"Retry\" is clicked in the message box, crashing and\/or trapping to debugger.\n```\n(I had to format the stack trace myself, because there's no printf!)\n\nThe big challenges will be asset loading and audio. I have written WASAPI code from scratch before, so I'll reuse that, but I've only ever done simple additive wave synthesis with it, so the music will be pretty minimalistic; more of a tracker-music vibe, probably. (I'm a fan of Fearofdark!)\n\nGot simple fixed-function rendering going on right now to draw a blue square to the screen. Runs at about 7,000 FPS, so it's less than ideal, but it'll do for a game jam.![blog1pic1.png](\/\/\/raw\/a24\/82\/z\/25853.png)","title":"Start with nothing in C: the first 3 hours","wayback_source":[]}