Giter Club home page Giter Club logo

linc_sdl's People

Contributors

gogoprog avatar ntrf avatar ruby0x1 avatar sunjammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linc_sdl's Issues

Trying it out for the first time.

So i've decided to finally give it a try but unfortunately run into some problems.

First the example is missing imports for Window, Renderer then it is missing a final return for the update method and Haxe will complain. After finally being able to compile it with -D HXCPP_M64 and running hxcpp on the generated Build files it gets compiled into an application but this application autocloses right away upon being run.

Any ideas?

Can't compile

I can't seem to get the test to compile. Getting the same error when compiling on Mac and Windows.

Error: ./src/Test.cpp:1571:20: error: no member named 'sym' in 'cpp::Struct<SDL_Keysym, cpp::DefaultStructHandler>'; did you mean to use '->' instead of '.'?
int tmp10 = tmp9.sym; HX_STACK_VAR(tmp10,"tmp10");
^
->

Windows builds broken with cl.exe

These lines

#ifndef HXCPP_H
#include <hxcpp.h>
#endif

are not valid on windows with cl.exe. Anything before the include statement for a precompiled header is ignored, making the #endif a syntax error

Android target error: SDL could not create window.

I tried compiling linc_nanovg test/snow example on android target: I am getting this error

E/Exception: error(runtime / sdl / failed to create platform window, unable to recover / `Could not initialize OpenGL / GLES library`)

The error seems to be coming from SDL, so I am hoping you might be able to help.

linc_sdl : SDL.Keycode: Pattern matching havoc

Hi,

Since switch does no pattern match variables but only constants (static inline), the whole Keycode class is a potential disaster (at least with recent haxe versions).

for example : key_1 is static var and thus the pattern matcher will use every work key_1 as switch traps and all the code in the switch is a potential switch trap.

I suggest obliterating the code (asap) and replacing the old implementation switch with an Int Map matching keycodes and scancodes.

Xoxo

SDL Audio ?

First, this is a nice binding working out of the box, congrats.

Seems to me there is no reference to SDL_OpenAudio. I need it for the ffmpeg binding.
Is it already done somewhere or should I send a pull request ?
( I'll start to write something while waiting for response )
Thanks and see ya!

SDL.hasAnEvent signature is not recognized

OMG, I'm sorry! I found what caused this error. Main function must return boolean value. The while block may or may not be executed, so there may not be any returns at all.

Fails to Compile using Test Code

I am using the latest HXCPP and Linc-SDL, using this code (the test):

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

class Main {

    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);
        update();

    }

    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);
            SDL.delay(4);

        }

        return true;
    }

}

I get the following error upon compilation:

Error: ./src/Main.cpp:52:16: error: no matching function for call to 'SDL_SetRenderDrawColor'
HXLINE(  24)                    SDL_SetRenderDrawColor( ::Dynamic(::Main_obj::state->__Field(HX_("renderer",43,c5,db,b2),hx::paccDynamic)),(int)255,(int)255,(int)255,(int)255);
                                ^~~~~~~~~~~~~~~~~~~~~~
/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/SDL_render.h:633:29: note: candidate function not viable: no known conversion from '::Dynamic' to 'SDL_Renderer *' for 1st argument
extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer,
                            ^
./src/Main.cpp:53:16: error: no matching function for call to 'SDL_RenderClear'
HXLINE(  25)                    SDL_RenderClear( ::Dynamic(::Main_obj::state->__Field(HX_("renderer",43,c5,db,b2),hx::paccDynamic)));
                                ^~~~~~~~~~~~~~~
/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/SDL_render.h:690:29: note: candidate function not viable: no known conversion from '::Dynamic' to 'SDL_Renderer *' for 1st argument
extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
                            ^
./src/Main.cpp:54:16: error: no matching function for call to 'SDL_RenderPresent'
HXLINE(  26)                    SDL_RenderPresent( ::Dynamic(::Main_obj::state->__Field(HX_("renderer",43,c5,db,b2),hx::paccDynamic)));
                                ^~~~~~~~~~~~~~~~~
/usr/local/lib/haxe/lib/linc_sdl/git//lib/sdl/include/SDL_render.h:856:30: note: candidate function not viable: no known conversion from '::Dynamic' to 'SDL_Renderer *' for 1st argument
extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
                             ^
3 errors generated.

Any assistance would be appreciated.

SDL_Image support

So I was using this (really nice) library to port my code from C++ to Haxe but I see that there's no SDL_image support.
I need to use PNG and JPG images, but the SDL library only accepts BMPs.

I wanted to implement it myself, but I the library isn't on native-toolkit's GitHub.

Any ideas?

Compiling linc_sdl on latest Haxe+HXCpp

Error: While running :cl.exe -Iinclude -DLINC_SDL -IC:/HaxeToolkit/haxe/lib/linc_sdl/git//linc/ -IC:/HaxeToolkit/haxe/lib/linc_sdl/git//lib/sdl/include/ -IC:/HaxeToolkit/haxe/lib/linc_sdl/git//lib/sdl/include/configs/windows/ -DHAVE_LIBC -DNATIVE_TOOLKIT_SDL -nologo -O2 /WX- /fp:precise -DHX_WINDOWS -D_USING_V120_SDK71_ -GR -FS -Oy- -c -EHs -GS- -arch:SSE -IC:/Projects/hxcpp/include -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -D_CRT_SECURE_NO_DEPRECATE -D_ALLOW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -DHX_WIN_MAIN -wd4996 -MT ./src/Main.cpp -FoC:/Projects/Flow-Basic-Test-01/bin/windows.build/cpp/obj/msvc18-ncxp/2159692e_Main.obj
Main.cpp
C:/Projects/hxcpp/include\cpp/Pointer.h(150) : error C2027: use of undefined type 'SDL_Window'
        c:\haxetoolkit\haxe\lib\linc_sdl\git\lib\sdl\include\SDL_video.h(89) : see declaration of 'SDL_Window'
        ./src/Main.cpp(39) : see reference to class template instantiation 'cpp::Pointer<SDL_Window>' being compiled

Getting this error with the latest Haxe and HXCpp.

SDLRect Compile Error

So I am trying to us SDL.blitSurface

this is my function

public function apply_surface(?x:Int = null, ?y:Int = null, source:Surface, destination:Surface, clip:SDLRect){
        //Holds offsets
        var shift:SDLRect = {y:0, x:0, w:0, h:0};

        //Get offsets
        shift.x = offSetX;
        shift.y = offSetY;

        //Blit
        SDL.blitSurface(source, clip, destination, shift);

    }

I am getting this error

error C2664: 'int SDL_UpperBlit(SDL_Surface *,const SDL_Rect *,SDL_Surface *,SDL_Rect *)': cannot convert argument 2 from 'Dynamic' to 'const SDL_Rect *'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.