All Projects → snowkit → linc_sdl

snowkit / linc_sdl

Licence: other
http://snowkit.github.io/linc/ Haxe/hxcpp @:native bindings for SDL

Programming Languages

haxe
709 projects
C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

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);
        }

    } //main

    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;

    } //update

} //Example
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].