1 /* Library Abstraction Layer header */
6 #include "neuro_engine.h"
8 /* take note that those functions herein are to be used stricly by the
9 * local library and not by the external programs!
11 * Those functions are designed for internal use only! their where abouts
12 * are not garanteed and they surely don't have any (none at all)
13 * backward compatibility! So use the Neuro_ functions, now please.
17 /* allocate stuff needed for the video */
18 extern int Lib_VideoInit(v_object
**screen
, v_object
**screen_buf
);
20 /* cleans up stuff allocated for the video */
21 extern void Lib_VideoExit();
23 /* allocated stuff needed for events */
24 extern int Lib_EventInit();
26 /* cleans up stuff allocated for events */
27 extern void Lib_EventExit();
29 /* allocates stuff needed for fonts */
30 extern int Lib_FontsInit();
32 /* cleans up stuff allocated for fonts */
33 extern void Lib_FontsExit();
35 /* you can set the size of the screen with this function.
36 * note that this function will not work on the fly, you
37 * can only use this __before__ you init Neuro! or
40 extern void Lib_SetScreenSize(i32 width
, i32 height
);
42 /* puts the size of the screen in current use in the input variables */
43 extern void Lib_GetScreenSize(i32
*width
, i32
*height
);
45 /* for pixel manipulations (input/output) this locks the lock on
46 * the pixels buffer. So nothing can be done in the background on
49 extern void Lib_LockVObject(v_object
*vobj
);
51 /* for pixel manipulations (input/output) this unlocks the lock on
54 extern void Lib_UnlockVObject(v_object
*vobj
);
56 /* free a v_object after its use is no longer needed. */
57 extern void Lib_FreeVobject(v_object
*source
);
59 /* flip the surface/screen if its double buffered */
60 extern void Lib_Flip(v_object
*source
);
62 /* draw rectangles on the surface */
63 extern void Lib_FillRect(v_object
*source
, Rectan
*src
, u32 color
);
65 /* used to update only parts of the surface/screen at once */
66 extern void Lib_UpdateRect(v_object
*source
, Rectan
*src
);
68 /* blit one surface to another one with this function */
69 extern void Lib_BlitObject(v_object
*source
, Rectan
*src
, v_object
*destination
, Rectan
*dst
);
71 /* SOON TO BE OBSOLETE!!
73 * no idea what that does... it doesn't seem to have any use...
75 extern void Lib_GiveVobjectProp(v_object
*source
, Rectan
*output
);
77 /* outputs the current depth in use */
78 extern u32
Lib_GetDefaultDepth();
80 /* get sensible informations about a surface and yes, all those needs
83 extern void Lib_GetVObjectData(v_object
*vobj
, u32
*flags
, i32
*h
, i32
*w
, u32
*pitch
, void **pixels
, Rectan
**clip_rect
, u8
*bpp
, u32
*Rmask
, u32
*Gmask
, u32
*Bmask
, u32
*Amask
);
85 /* load a M$ bitmap from a file that you input
86 * pass the address of a pointer v_object :
89 * and pointer for that is &image
91 extern void Lib_LoadBMP(const char *path
, v_object
**img
);
93 /* load a M$ bitmap from a buffer in memory
94 * pass the address of a pointer v_object :
97 * and pointer for that is &image
99 extern void Lib_LoadBMPBuffer(void *data
, v_object
**img
);
101 /* outputs the color code(properly aligned) corresponding to
102 * the three primary color inputs. For surfaces that have
103 * their own palette, we support an input of the surface.
105 extern u32
Lib_MapRGB(v_object
*vobj
, u8 r
, u8 g
, u8 b
);
107 /* sets the color key that will not be drawn (for transparency) of a surface.
108 * this needs to be done strictly before loading a surface with X11 and
109 * can be done anytime with SDL.
111 extern void Lib_SetColorKey(v_object
*vobj
, u32 key
);
113 /* sets the alpha (transparency) of a surface */
114 extern void Lib_SetAlpha(v_object
*vobj
, u8 alpha
);
116 /* syncs the pixels so subsequent input or output on them
117 * are getting correct informations.
119 extern void Lib_SyncPixels(v_object
*src
);
121 /* puts a pixel into surface srf at the given coordinates */
122 extern void Lib_PutPixel(v_object
*srf
, int x
, int y
, u32 pixel
);
124 /* outputs the color of a pixel in the surface srf */
125 extern u32
Lib_GetPixel(v_object
*srf
, int x
, int y
);
127 /* create visual surfaces with this function */
128 extern v_object
* Lib_CreateVObject(u32 flags
, i32 width
, i32 height
, i32 depth
, u32 Rmask
, u32 Gmask
, u32 Bmask
, u32 Amask
);
130 /* a higher SDL function which is kinda an hack for event.c */
131 extern void Lib_EventPoll();
133 /* the poll for the events */
134 extern i32
Lib_PollEvent(void *event
);
136 /* better function to get key status */
137 extern u8
Lib_CheckKeyStatus(u32 key
);
139 /* outputs the current status of the mouse and passes the coordinates to the
142 extern u8
Lib_GetMouseState(i32
*x
, i32
*y
);
144 /* you can load a truetype (or any other that the freetype library
145 * supports) with this function.
146 * returns NULL on error or a pointer to a font_object.
148 extern font_object
*Lib_LoadFontFile(const char *fonts_file_path
);
150 /* this function is to clean a font file loaded
151 * using Lib_LoadFontFile
153 extern void Lib_CleanFont(font_object
*font
);
155 /* even though the input arguments seem to be quite complicated, it is not.
156 * the ttf input address can be given with the load fonts function, the size
157 * is the size of the fonts you want in pixels, the character is the character
158 * code you want to render.
160 * The x and y coordinates are a bit special, the value in those are changed so
161 * characters in a string have the correct spacing(instead of overlapping).
163 * color is the color you want your character to be and the 2 Rectan output
164 * the basic informations about the surface so it can be blit easily.
166 * returns the v_object pointer if the character got loaded well or
167 * NULL if either there was an error or the character that was input
168 * requires more than one byte to be complete.
170 * NOTE This function do handle spaces! ie ' '. just input the corresponding
171 * x and y addresses so the function can calculate itself the size they take.
172 * For this purpose, you CAN leave color, src and dst to 0 or NULL!
173 * just remember to put the correct size and character (to ' ') so the size
174 * of the space is correct.
176 extern v_object
*Lib_RenderUnicode(font_object
*ttf
, u32 size
, u32 character
,
177 i16
*x
, i16
*y
, u32 color
, Rectan
*src
, Rectan
*dst
);
179 #endif /* not __EXTLIB_H */