SkillAgentSearch skills...

Spinach

Easy to use SDL3 based framework for software rendering, image processing and similar experiments

Install / Use

/learn @mmj-the-fighter/Spinach
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Spinach

A framework for starting with computer graphics. It uses SDL3 library.
But can be retargetted to other windowing frameworks by modifying the source code.
Presentation on YouTube with synthetic voice

Useful for:

  • Writing lab programs in a first course for computer graphics
    (pixels, lines, polygons, circles, ellipses, filling, clipping, transforms etc.)
  • Writing raytracers
  • Writing programs for advanced curves
  • Writing software rasterizers
  • Writing image processing routines
  • Games
  • and so on.

Examples / Tutorials

Build / Project Generation

Prerequisites

  • The root folder must contain the res directory.
  • CMake must be installed.

Steps

  1. Create a directory named build in the project root.
  2. Open a terminal in the project root and run:
cd build
cmake ../

This will generate the project files inside the build directory.

Key Bindings

Two keys are handled in the engine:

| Key | Behaviour | |-----|-----------| | Esc | Application closes | | F12 | A screenshot is saved with the current timestamp |

Projects that use Spinach

App Skeleton

#include <iostream>
#include <spn_canvas.h>
#include <spn_core.h>

void UpdateAndRender(spn::Canvas* canvas) {
    // Use the canvas to draw something
}

void HandleInput(const SDL_Event* sdlEvent) {
    // Process input events
}

int main(int argc, char* argv[])
{
    spn::SpinachCore sc(640, 480, "../res/");

    if (sc.IsInitFailed()) {
        std::cout << "Initialization failed with error "
                  << sc.GetInitializationResult()
                  << std::endl;
        return 1;
    }

    sc.SetUpdateAndRenderHandler(UpdateAndRender);
    sc.SetInputHandler(HandleInput);
    sc.SetWindowTitle("Spinach App");
	sc.GetCanvas()->SetPrimaryColorUint(0x0000ff);
    sc.GetCanvas()->SetClearColorUint(0x0);
    sc.SetTargetFramesPerSecond(30);
    sc.MainLoop();

    return 0;
}

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated17d ago
Forks0

Languages

C++

Security Score

85/100

Audited on Mar 10, 2026

No findings