Oxygen Basic
Programming => Problems & Solutions => Topic started by: Peter on January 23, 2016, 11:53:59 AM
-
Hi Charles,
I use for a Sint64 type a QUAD type, is this alright?
-
Hi Peter,
Sure. (the o2 quad type is a 64bit signed integer)
-
Thanks Charles,
I'm writing just a SDL2 library for OxygenBasic.
But I can the sdl_header not directly use, especially the keys definition from sdl.h.
Therefore I do everything by hand.
At the moment, I have trouble with SDL_Rect, somehow it does not work. ???
I can not imagine that this definition is wrong:
typedef struct SDL_Rect
{
Uint16 x
Uint16 y
Uint16 w
Uint16 h
} SDL_Rect
-
Peter, a C int is likely to be 32-bit and you are using 16-bit integers.
-
Hi Jack,
:)
typedef struct SDL_Rect
{
int x, y
int w, h
} SDL_Rect
But still no success.
-
sorry Peter, I am out of ideas
if Mike Lobanovsky shows up he may be able to help you.
-
hi Peter look into link:
https://wiki.libsdl.org/SDL_Rect
so if i understand this thing this must be type not typedef
something like we use in windows
TYPE Rect .rc
-
sorry Peter, I am out of ideas
no, I need no help, I only was saying that I have trouble with SDL_Rect.
nonetheless, thanks for your help.
that poblem is somewhere else and I will find it.
-
so if i understand this thing this must be type not typedef
something like we use in windows
TYPE Rect .rc
Aurel you need a warm oven to warm up your brain cells. ;D
-
Hi Peter,
We don't have a core definition for uint16, but you can use word to define it before the C SDL headers
typedef word uint16
-
Thanks Charles,
I already did it.
TypeDef byte uint8
TypeDef word uint16
TypeDef dword uint32
TypeDef short Sint16
TypeDef int Sint32
TypeDef quad Sint64
[/code]
-
Aurel you need a warm oven to warm up your brain cells.
Good point Peter. I didn't consider the weather being a factor. ;D
-
FYB
SDL sucks anyway :P
or better to say ..one reason more to not visit this forum...bye
-
FYB
SDL sucks anyway :P
or better to say ..one reason more to not visit this forum...bye
I would wish you well but I would be lying. Sorry life didn't work out for you.
-
Hi Peter,
I looked at the definition in SDL_stdinc.h
typedef int16_t Sint16;
/**
* \brief An unsigned 16-bit integer type.
*/
typedef uint16_t Uint16;
/**
so the solution might be to define before the SDL headers:
typedef word uint16_t
typedef short int16_t
-
Hi Charles,
the type-definition what I have is okay!
another thing here is an error message in this typedef struct.
typededef struct SDL_Surface
{
Uint32 flags
SDL_PixelFormat *format
int w, h
int pitch
void *pixels
void *userdata
int locked
void *lock_data
SDL_Rect clip_rect
struct SDL_BlitMap *map '< here
int refcount
} SDL_Surface
I got a solution, but whether this is a proper solution I have to test out.
.
-
The problem is that SDL_BlitMap is an undefined private structure.
The solution is to define it before including the SDL headers
typedef struct SDL_BlitMap {}
or hack:
typedef sys SDL_BlitMap
-
Thanks Charles,
that was my solution!
typedef struct SDL_BlitMap SDL_BlitMap
-
Hi Charles,
solved!
Sdl2 works now
-
Very good!
I will need to adjust o2 struct semantics in a future release, to comply with C.