Skip to content

ceramic-engine/linc_sdl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linc/SDL

Haxe/hxcpp @:native bindings for SDL.

This is a linc library.


This library works with the Haxe cpp target only.


Install

haxelib git linc_sdl https://github.com/snowkit/linc_sdl.git

If you run into SDL build errors first try:

  • Get the path of the library haxelib path linc_sdl
  • Change directory to that path cd <path to linc_sdl>
  • git submodule update --init

Reporting errors

If you run into any issues compiling or using a function, please report it since there are many endpoints, there are inevitably places with minor oversight. Thanks!

Example usage

See test/Test.hx for more (messy) example usage.

Be sure to read the SDL documentation https://wiki.libsdl.org/

import sdl.SDL;
import sdl.Window;
import sdl.Renderer;

class Example {

    static var state : { window:Window, renderer:Renderer };

        //Haxe entry point
    static function main() {

        SDL.init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
        state = SDL.createWindowAndRenderer(320, 320, SDL_WINDOW_RESIZABLE);

        while(update()) {
            SDL.delay(33);
        }

    }

    static function update() {

        while(SDL.hasAnEvent()) {

            var e = SDL.pollEvent();
            if(e.type == SDL_QUIT) return false;

            SDL.setRenderDrawColor(state.renderer, 255, 255, 255, 255);
            SDL.renderClear(state.renderer);
            SDL.renderPresent(state.renderer);
        }

        return true;

    }

}

Packages

No packages published

Languages

  • Haxe 79.9%
  • C++ 20.0%
  • C 0.1%