Iyadahmed NanoGUI Save

A very small C library for putting pixels on the screen, perfect for software raytracing projects.

Project README

Build Status:

Minimal Window

A very small C library for putting pixels on the screen, perfect for software raytracing projects. 042a6961-4224-4d63-b3b7-650ed83b29cd

How to include in your CMake project

  1. Install the relevant libraries and runtimes: see Supported Platforms
  2. Clone or download the repo. to your project
  3. Use add_subdirectory("/path/to/minimal_window") with correct path
  4. Link to minimal_window: target_link_libraries(your_target PRIVATE minimal_window)

Alternatively, you can use ExternalProject, FetchContent, CPM, or any other method that you are comfortable with, minimal_window is a modern CMake project and should be very easy to include

Supported Platforms

  • Win32 (Windows)
  • Wayland (Linux):
    Wayland development packages are needed for building (for example on Ubuntu: sudo apt install libwayland-dev wayland-protocols), you also need a running Wayland session at runtime. You also need pkg-config sudo apt install pkg-config.
  • X11 (Linux and macOS):
    * Linux: X11 development packages are needed for building (for example on Ubuntu: sudo apt install libx11-dev), you also need a running X11 session at runtime.
    * macOS: XQuartz is needed at runtime.
  • Native macOS

Tested Compilers

  • GCC
  • MSVC
  • Apple Clang
  • Clang

API

void minimal_window_create_fixed_size_window(int width, int height);
bool minimal_window_process_events();
void minimal_window_draw_pixel(int x, int y, uint8_t r, uint8_t g, uint8_t b);
void minimal_window_request_update();

Example: filling window with white

#include <minimal_window.h>
int main() {
  int width = 800, height = 600;
  minimal_window_create_fixed_size_window(width, height);
  while (minimal_window_process_events()) {
    for (int i = 0; i < width; i++)
      for (int j = 0; j < height; j++)
        minimal_window_draw_pixel(i, j, 255, 255, 255);
  }
  return 0;
}

Example: raytracing

https://github.com/iyadahmed/minimal_window_raytracing/blob/main/main.c

Open Source Agenda is not affiliated with "Iyadahmed NanoGUI" Project. README Source: esnosy/minimal_window
Stars
113
Open Issues
4
Last Commit
7 months ago
License

Open Source Agenda Badge

Open Source Agenda Rating