mirror of
https://github.com/love2d/love.git
synced 2026-08-21 21:15:09 +02:00
added love.graphics.setIcon
This commit is contained in:
+1
-1
@@ -9,6 +9,7 @@ LOVE 0.7.0
|
||||
* Added identity field to love.conf.
|
||||
* Added love.quit callback.
|
||||
* Added extra meter parameter to love.physics.newWorld.
|
||||
* Added love.graphics.setIcon.
|
||||
* Enabled love.filesystem.FileData.
|
||||
* Fixed bug where the debug module was not an upvalue of the error handlers. (you can now override debug)
|
||||
* Fixed bug where love.audio.pause and friends were acting on everything, not just the passed Source.
|
||||
@@ -20,7 +21,6 @@ LOVE 0.7.0
|
||||
* Moved fonts to love.font (from love.graphics), only rendering remains in love.graphics.
|
||||
* Switched font origin to top-left.
|
||||
* OS X now properly uses UTIs for .love files.
|
||||
* Dropped the OS X version requirement to 10.4.
|
||||
* Fewer compiler warnings.
|
||||
|
||||
LOVE 0.6.2
|
||||
|
||||
@@ -307,6 +307,25 @@ namespace opengl
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
void Graphics::setIcon(Image * image)
|
||||
{
|
||||
Uint32 rmask, gmask, bmask, amask;
|
||||
#ifdef LOVE_BIG_ENDIAN
|
||||
rmask = 0xFF000000;
|
||||
gmask = 0x00FF0000;
|
||||
bmask = 0x0000FF00;
|
||||
amask = 0x000000FF;
|
||||
#else
|
||||
rmask = 0x000000FF;
|
||||
gmask = 0x0000FF00;
|
||||
bmask = 0x00FF0000;
|
||||
amask = 0xFF000000;
|
||||
#endif
|
||||
SDL_Surface * icon = SDL_CreateRGBSurfaceFrom(image->getData()->getData(), image->getWidth(), image->getHeight(), 32, image->getWidth() * 4, rmask, gmask, bmask, amask);
|
||||
SDL_WM_SetIcon(icon, NULL);
|
||||
SDL_FreeSurface(icon);
|
||||
}
|
||||
|
||||
void Graphics::setCaption(const char * caption)
|
||||
{
|
||||
SDL_WM_SetCaption(caption, 0);
|
||||
|
||||
@@ -178,7 +178,12 @@ namespace opengl
|
||||
void present();
|
||||
|
||||
/**
|
||||
* Sets the windows caption.
|
||||
* Sets the window's icon.
|
||||
**/
|
||||
void setIcon(Image * image);
|
||||
|
||||
/**
|
||||
* Sets the window's caption.
|
||||
**/
|
||||
void setCaption(const char * caption);
|
||||
|
||||
@@ -505,7 +510,6 @@ namespace opengl
|
||||
* @param ... Vertex components (x1, y1, x2, y2, etc).
|
||||
**/
|
||||
int polygon(lua_State * L);
|
||||
int polygong(lua_State * L);
|
||||
|
||||
/**
|
||||
* Creates a screenshot of the view and saves it to the default folder.
|
||||
|
||||
@@ -78,6 +78,13 @@ namespace opengl
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_setIcon(lua_State * L)
|
||||
{
|
||||
Image * image = luax_checktype<Image>(L, 1, "Image", GRAPHICS_IMAGE_T);
|
||||
instance->setIcon(image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_setCaption(lua_State * L)
|
||||
{
|
||||
const char * str = luaL_checkstring(L, 1);
|
||||
@@ -860,6 +867,8 @@ namespace opengl
|
||||
{ "setCaption", w_setCaption },
|
||||
{ "getCaption", w_getCaption },
|
||||
|
||||
{ "setIcon", w_setIcon },
|
||||
|
||||
{ "getWidth", w_getWidth },
|
||||
{ "getHeight", w_getHeight },
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace opengl
|
||||
int w_reset(lua_State * L);
|
||||
int w_clear(lua_State * L);
|
||||
int w_present(lua_State * L);
|
||||
int w_setIcon(lua_State * L);
|
||||
int w_setCaption(lua_State * L);
|
||||
int w_getCaption(lua_State * L);
|
||||
int w_getWidth(lua_State * L);
|
||||
|
||||
Reference in New Issue
Block a user