Commit 23e8a147 authored by deuce's avatar deuce
Browse files

Add seticon() function which sets the programs icon to the specified RRGGBBAA

data.
parent a966944a
......@@ -133,6 +133,7 @@ int try_sdl_init(int mode)
cio_api.showmouse=sdl_showmouse;
cio_api.hidemouse=sdl_hidemouse;
cio_api.setname=sdl_setname;
cio_api.seticon=sdl_seticon;
cio_api.settitle=sdl_settitle;
#ifdef _WIN32
cio_api.copytext=win32_copytext;
......@@ -942,6 +943,13 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_setname(const char *name) {
cio_api.setname(name);
}
CIOLIBEXPORT void CIOLIBCALL ciolib_seticon(const void *icon, unsigned long size) {
CIOLIB_INIT();
if(cio_api.seticon!=NULL)
cio_api.seticon(icon,size);
}
CIOLIBEXPORT void CIOLIBCALL ciolib_settitle(const char *title) {
CIOLIB_INIT();
......
......@@ -237,6 +237,7 @@ typedef struct {
int (*showmouse) (void);
void (*settitle) (const char *);
void (*setname) (const char *);
void (*seticon) (const void *, unsigned long);
void (*copytext) (const char *, size_t);
char *(*getcliptext) (void);
void (*suspend) (void);
......@@ -295,6 +296,7 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_insline(void);
CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt);
CIOLIBEXPORT void CIOLIBCALL ciolib_settitle(const char *title);
CIOLIBEXPORT void CIOLIBCALL ciolib_setname(const char *title);
CIOLIBEXPORT void CIOLIBCALL ciolib_seticon(const void *icon,unsigned long size);
CIOLIBEXPORT int CIOLIBCALL ciolib_showmouse(void);
CIOLIBEXPORT int CIOLIBCALL ciolib_hidemouse(void);
CIOLIBEXPORT void CIOLIBCALL ciolib_copytext(const char *text, size_t buflen);
......@@ -345,6 +347,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_loadfont(char *filename);
#define hidemouse() ciolib_hidemouse()
#define showmouse() ciolib_showmouse()
#define setname(a) ciolib_setname(a)
#define seticon(a,b) ciolib_seticon(a,b)
#define settitle(a) ciolib_settitle(a)
#define copytext(a,b) ciolib_copytext(a,b)
#define getcliptext() ciolib_getcliptext()
......
......@@ -47,6 +47,7 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
sdlf->SemPost=SDL_SemPost;
sdlf->EventState=SDL_EventState;
sdlf->CreateRGBSurface=SDL_CreateRGBSurface;
sdlf->CreateRGBSurfaceFrom=SDL_CreateRGBSurfaceFrom;
sdlf->FillRect=SDL_FillRect;
sdlf->SetColors=SDL_SetColors;
sdlf->BlitSurface=SDL_UpperBlit;
......@@ -61,6 +62,7 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
sdlf->SetVideoMode=SDL_SetVideoMode;
sdlf->FreeSurface=SDL_FreeSurface;
sdlf->WM_SetCaption=SDL_WM_SetCaption;
sdlf->WM_SetIcon=SDL_WM_SetIcon;
sdlf->ShowCursor=SDL_ShowCursor;
sdlf->WasInit=SDL_WasInit;
sdlf->EnableUNICODE=SDL_EnableUNICODE;
......@@ -138,6 +140,10 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
FreeLibrary(sdl_dll);
return(-1);
}
if((sdlf->CreateRGBSurfaceFrom=GetProcAddress(sdl_dll, "SDL_CreateRGBSurfaceFrom"))==NULL) {
FreeLibrary(sdl_dll);
return(-1);
}
if((sdlf->FillRect=GetProcAddress(sdl_dll, "SDL_FillRect"))==NULL) {
FreeLibrary(sdl_dll);
return(-1);
......@@ -194,6 +200,10 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
FreeLibrary(sdl_dll);
return(-1);
}
if((sdlf->WM_SetIcon=GetProcAddress(sdl_dll, "SDL_WM_SetIcon"))==NULL) {
FreeLibrary(sdl_dll);
return(-1);
}
if((sdlf->ShowCursor=GetProcAddress(sdl_dll, "SDL_ShowCursor"))==NULL) {
FreeLibrary(sdl_dll);
return(-1);
......@@ -307,6 +317,10 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
dlclose(sdl_dll);
return(-1);
}
if((sdlf->CreateRGBSurfaceFrom=dlsym(sdl_dll, "SDL_CreateRGBSurfaceFrom"))==NULL) {
dlclose(sdl_dll);
return(-1);
}
if((sdlf->FillRect=dlsym(sdl_dll, "SDL_FillRect"))==NULL) {
dlclose(sdl_dll);
return(-1);
......@@ -363,6 +377,10 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
dlclose(sdl_dll);
return(-1);
}
if((sdlf->WM_SetIcon=dlsym(sdl_dll, "SDL_WM_SetIcon"))==NULL) {
dlclose(sdl_dll);
return(-1);
}
if((sdlf->ShowCursor=dlsym(sdl_dll, "SDL_ShowCursor"))==NULL) {
dlclose(sdl_dll);
return(-1);
......
......@@ -19,6 +19,8 @@ struct sdlfuncs {
Uint8 (*EventState) (Uint8 type, int state);
SDL_Surface *(*CreateRGBSurface) (Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
SDL_Surface *(*CreateRGBSurfaceFrom)(void *pixels, int width, int height, int depth, int pitch,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
int (*FillRect) (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
int (*SetColors) (SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
int (*BlitSurface) (SDL_Surface *src, SDL_Rect *srcrect,
......@@ -34,6 +36,7 @@ struct sdlfuncs {
SDL_Surface *(*SetVideoMode) (int width, int height, int bpp, Uint32 flags);
void (*FreeSurface) (SDL_Surface *surface);
void (*WM_SetCaption) (const char *title, const char *icon);
void (*WM_SetIcon) (SDL_Surface *icon, Uint8 *mask);
int (*ShowCursor) (int toggle);
Uint32 (*WasInit) (Uint32 flags);
int (*EnableUNICODE) (int enable);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment