Implement SDL2 SetIcon in Lime legacy

This commit is contained in:
Joshua Granick
2014-12-28 13:24:13 -08:00
parent 896efe77c0
commit 1c0b067185
8 changed files with 19 additions and 9 deletions

View File

@@ -194,8 +194,6 @@ typedef std::wstring WString;
WString IntToWide(int value);
WString ColorToWide(int value);
void SetIcon( const char *path );
int GetDeviceOrientation();
int GetNormalOrientation();
double CapabilitiesGetPixelAspectRatio ();
@@ -255,6 +253,8 @@ extern int gFixedOrientation;
#endif
void SetIcon( const OSChar *path );
std::string GetExeName();

View File

@@ -928,7 +928,7 @@ DEFINE_PRIM(nme_get_unique_device_identifier,0);
value nme_set_icon( value path ) {
//printf( "setting icon\n" );
#if defined( HX_WINDOWS ) || defined( HX_MACOS )
SetIcon( val_string( path ) );
SetIcon( val_os_string( path ) );
#endif
return alloc_null();
}

View File

@@ -370,7 +370,7 @@ void CreateMainFrame(FrameCreationCallback inOnFrame, int inWidth, int inHeight,
}
void SetIcon(const char *path)
void SetIcon(const OSChar *path)
{
}

View File

@@ -17,7 +17,7 @@ void CreateMainFrame(nme::FrameCreationCallback inOnFrame,int inWidth,int inHeig
bool sgDead = false;
void SetIcon( const char *path ) { }
void SetIcon( const OSChar *path ) { }
QuickVec<int> *CapabilitiesGetScreenResolutions()
{

View File

@@ -1343,7 +1343,7 @@ void CreateMainFrame(FrameCreationCallback inOnFrame,int inWidth,int inHeight,
bool sgDead = false;
void SetIcon( const char *path ) {
void SetIcon( const OSChar *path ) {
#ifndef EMSCRIPTEN
initSDL();

View File

@@ -1591,9 +1591,19 @@ void CreateMainFrame(FrameCreationCallback inOnFrame, int inWidth, int inHeight,
bool sgDead = false;
void SetIcon(const char *path)
void SetIcon(const OSChar *path)
{
Surface *surface = Surface::Load(path);
if (surface)
{
SDL_Surface *sdlSurface = SDL_CreateRGBSurfaceFrom ((void *)surface->GetBase(), surface->Width(), surface->Height(), 32, surface->GetStride(), 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
SDL_SetWindowIcon(sgSDLFrame->mStage->mSDLWindow, sdlSurface);
surface->DecRef();
SDL_FreeSurface (sdlSurface);
}
}

View File

@@ -213,7 +213,7 @@ namespace nme {
}
void SetIcon (const char *path) {}
void SetIcon (const OSChar *path) {}
}

View File

@@ -710,7 +710,7 @@ void CreateMainFrame(nme::FrameCreationCallback inOnFrame,int inWidth,int inHeig
bool sgDead = false;
void SetIcon( const char *path ) { }
void SetIcon( const OSChar *path ) { }
QuickVec<int> *CapabilitiesGetScreenResolutions()
{