foreignsasquatch / raylib-hx

Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming
https://raylib.com
zlib License
55 stars 13 forks source link

struct Texture is using "->" for acess instead of "." #41

Closed smezzy closed 12 months ago

smezzy commented 1 year ago

here canvas.texture.width or canvas.texture.height gives me a compiler error cuz its trying to acesss width and height with "->" operator

    public function new(initialState:State) {
        canvas = Rl.loadRenderTexture(320, 180);
        var w = canvas.texture.width;
        var h = canvas.texture.height;
        sourceRect = Rectangle.create(-360, -180, 360, -180);
        destRect = Rectangle.create(-360, -180, 1280 + (360 * 2), 720 + (160 * 2));
        switchState(initialState);
    }
void Game_obj::__construct( ::fucciboiGDX::State initialState){
                HX_STACKFRAME(&_hx_pos_69efd8c9269cf369_22_new)
HXLINE(  23)        this->canvas = LoadRenderTexture(320,180);
HXLINE(  24)        int w = this->canvas->texture->width;
HXLINE(  25)        int h = this->canvas->texture->height;
HXLINE(  26)        this->sourceRect = Rectangle{ (float)-360, (float)-180, (float)360, (float)-180 };
HXLINE(  27)        this->destRect = Rectangle{ (float)-360, (float)-180, (float)2000, (float)1040 };
HXLINE(  28)        this->switchState(initialState);
                }

heres the code I was trying to copy from the raylib examples

Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
    Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };

i tried patching the bindings but both RenderTexture and Texture types already have the @:structAccess modified so idk what could be wrong

foreignsasquatch commented 1 year ago

I can't seem to replicate this issue over here. I've had this issue before but now it seems to work. Will update if I manage to replicate this. Thank you for trying out raylib-hx

smezzy commented 1 year ago

it seems that casting textures to a texture seems to work, read that on the raylib discord server

swordcube commented 1 year ago

these issues are unfortunately just caused by hxcpp being weirdly made, i can confirm casting works

foreignsasquatch commented 12 months ago

hxcpp is just annoying so many times