Closed boonkerz closed 1 year ago
Thanks! Fixed in version 2.0.1
Does not work as expected, its not possible to set color properly because the sdl_color has to be: typedef struct SDL_Color { Uint8 r; Uint8 g; Uint8 b; Uint8 a; } SDL_Color;
All types are located in the main SDL library. TTF provides only API (so as not to duplicate types from the main library):
$color = $sdl->new('SDL_Color');
$color->r = 42;
// ...
or
$color = $sdl->cast('SDL_Color', $ttf->new('SDL_Color'));
$color->r = 42;
// ...
All types are located in the main SDL library. TTF provides only API (so as not to duplicate types from the main library):
yea thats right
$color = $sdl->new('SDL_Color'); $color->r = 42; // ...
when i assign this to the rendertext function it doesn't respect the color it is produce an random color. i think the color struct get lost.
or
$color = $sdl->cast('SDL_Color', $ttf->new('SDL_Color')); $color->r = 42; // ...
poduce an error
poduce an error
Yes, you're right, I checked - it's really a mistake =(((
Didn't think about this case. Allocating a pointer and then converting it to a structure creates a SIGSEGV error in this case.
It looks like I can't make a "stub" just like that and I'll have to duplicate all types from the original SDL in TTF.
For now, the only option is to create types from the original SDL:
$color = $sdl->new('SDL_Color');
// etc...
Please check now if everything is ok.
Since everything worked locally for me even without these fixes, I can’t check it myself)
yea works now sdl_color created by ttf
Still, it is recommended to create all structures using SDL instead of TTF ;)
yea but it works only with sdl_color from ttf
If it's not difficult, it would be nice to provide a code example to reproduce the problem, because the creation of all structures from the main SDL library is implied.
example does not work.
the ttf ffi part does not know what the structure of SDL_color is because its defined in SDL_pixels.h