/* * ----------------------------------------------------------------------------- * This example is in the public domain (CC0 1.0 Universal). * You can copy, modify, use, and distribute it for any purpose. * ----------------------------------------------------------------------------- */ #include <LDL/LDL.h> int main(void)
{ LDL_Result* result; LDL_Context* context; LDL_Window* window; LDL_Event event; result = LDL_ResultNew(); context = LDL_ContextNew(LDL_ContextOpenGL1); window = LDL_WindowNew(result, context, LDL_GetVec2i(0, 0), LDL_GetVec2i(800, 600), "LDL - Simple Window", LDL_WindowModeResized); if (LDL_ResultIsOk(result)) { while (LDL_WindowIsRunning(window)) { while (LDL_WindowGetEvent(window, &event)) { if (event.Type == LDL_EventIsQuit || LDL_EventIsKeyPressed(&event, LDL_KeyEscape)) { LDL_WindowStopEvent(window); } } LDL_WindowPresent(window); LDL_Delay(16); } LDL_WindowFree(window); LDL_ContextFree(context); LDL_ResultFree(result); } if (LDL_ResultIsFail(result)) { printf("Error: %s\n", LDL_ResultGetMessage(result)); } return 0;
}
/* * ----------------------------------------------------------------------------- * This example is in the public domain (CC0 1.0 Universal). * You can copy, modify, use, and distribute it for any purpose. * ----------------------------------------------------------------------------- */ #include <LDL/LDL.h> int main(void)
{ LDL_Result* result; LDL_Context* context; LDL_Window* window; LDL_Event event; result = LDL_ResultNew(); context = LDL_ContextNew(LDL_ContextOpenGL1); window = LDL_WindowNew(result, context, LDL_GetVec2i(0, 0), LDL_GetVec2i(800, 600), "LDL - Simple Window", LDL_WindowModeResized); if (LDL_ResultIsOk(result)) { while (LDL_WindowIsRunning(window)) { while (LDL_WindowGetEvent(window, &event)) { if (event.Type == LDL_EventIsQuit || LDL_EventIsKeyPressed(&event, LDL_KeyEscape)) { LDL_WindowStopEvent(window); } } LDL_WindowPresent(window); LDL_Delay(16); } LDL_WindowFree(window); LDL_ContextFree(context); LDL_ResultFree(result); } if (LDL_ResultIsFail(result)) { printf("Error: %s\n", LDL_ResultGetMessage(result)); } return 0;
}
/* * ----------------------------------------------------------------------------- * This example is in the public domain (CC0 1.0 Universal). * You can copy, modify, use, and distribute it for any purpose. * ----------------------------------------------------------------------------- */ #include <LDL/LDL.h> int main(void)
{ LDL_Result* result; LDL_Context* context; LDL_Window* window; LDL_Event event; result = LDL_ResultNew(); context = LDL_ContextNew(LDL_ContextOpenGL1); window = LDL_WindowNew(result, context, LDL_GetVec2i(0, 0), LDL_GetVec2i(800, 600), "LDL - Simple Window", LDL_WindowModeResized); if (LDL_ResultIsOk(result)) { while (LDL_WindowIsRunning(window)) { while (LDL_WindowGetEvent(window, &event)) { if (event.Type == LDL_EventIsQuit || LDL_EventIsKeyPressed(&event, LDL_KeyEscape)) { LDL_WindowStopEvent(window); } } LDL_WindowPresent(window); LDL_Delay(16); } LDL_WindowFree(window); LDL_ContextFree(context); LDL_ResultFree(result); } if (LDL_ResultIsFail(result)) { printf("Error: %s\n", LDL_ResultGetMessage(result)); } return 0;
}
# Install dependencies (Debian/Ubuntu)
sudo apt-get install libx11-dev libgl1-mesa-dev # Clone and build
git clone https://github.com/JordanCpp/LDL.git
cd LDL
cmake -B build
cmake --build build
# Install dependencies (Debian/Ubuntu)
sudo apt-get install libx11-dev libgl1-mesa-dev # Clone and build
git clone https://github.com/JordanCpp/LDL.git
cd LDL
cmake -B build
cmake --build build
# Install dependencies (Debian/Ubuntu)
sudo apt-get install libx11-dev libgl1-mesa-dev # Clone and build
git clone https://github.com/JordanCpp/LDL.git
cd LDL
cmake -B build
cmake --build build - I switched entirely to C89 — this gives maximum compatibility with old compilers and platforms, including DOS, Windows 95, Solaris, and even PlayStation 1.
- I abandoned the idea of releasing a full-featured 1.0 all at once — now releases are iterative: First: windows, events, graphics ✅
Next: 2D renderer 🔜
Then: audio and fonts 🔜
- First: windows, events, graphics ✅
- Next: 2D renderer 🔜
- Then: audio and fonts 🔜 - First: windows, events, graphics ✅
- Next: 2D renderer 🔜
- Then: audio and fonts 🔜 - If native support for a platform isn't ready yet, you can temporarily use a backend through an existing library.
- Developers already familiar with SDL or GLFW can try LDL without completely replacing their toolchain.
- You can leverage features from these libraries (like audio or fonts in SDL) earlier than they're implemented natively in LDL. - On modern systems → Vulkan or OpenGL with hardware acceleration
- On retro hardware → software rasterizer - Sprite loading and drawing
- Position, rotation, scale
- Color effects and transparency
- Line and rectangle drawing
- Text rendering with fonts - The flicker of a CRT monitor
- The warmth of a fanless CPU working hard on every clock cycle
- How '90s engineers squeezed the impossible out of kilobytes of memory and megahertz of clock speed