OSDN Git Service

SDL.setCaption実装
authorRoNor <ronoru@users.sourceforge.jp>
Wed, 19 May 2010 15:15:28 +0000 (00:15 +0900)
committerRoNor <ronoru@users.sourceforge.jp>
Wed, 19 May 2010 15:15:28 +0000 (00:15 +0900)
iconがきちんと設定されているのか確認できない。後でチェック。

build/sdl/SDL$.class
build/sdl/SDL.class
src/SDL.c
src/SDL.scala
src/sdl_SDL.h

index cbbd1cf..f0e1411 100644 (file)
Binary files a/build/sdl/SDL$.class and b/build/sdl/SDL$.class differ
index 5f94e47..d9df46e 100644 (file)
Binary files a/build/sdl/SDL.class and b/build/sdl/SDL.class differ
index 30a605e..ecc19ce 100644 (file)
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -567,7 +567,17 @@ JNIEXPORT jint JNICALL Java_sdl_SDL_fillRect(JNIEnv *env, jobject obj, jobject s
 /**
  * Window Management
  */
-JNIEXPORT void JNICALL Java_sdl_SDL_setCaption(JNIEnv *env, jobject obj, jstring title, jint icon){
+JNIEXPORT void JNICALL Java_sdl_SDL_setCaption(JNIEnv *env, jobject obj, jstring title, jstring icon){
+  const char* title_string = NULL;
+  const char* icon_string = NULL;
+  if(title != NULL){
+    title_string = (*env)->GetStringUTFChars(env, title, NULL);
+  }
+  if(icon != NULL){
+    icon_string = (*env)->GetStringUTFChars(env, icon, NULL);
+  }
+  
+  SDL_WM_SetCaption(title_string, icon_string);
 }
 
 JNIEXPORT jlong JNICALL Java_sdl_SDL_getTicks(JNIEnv *env, jobject obj){
index c0a69db..400e9fb 100644 (file)
@@ -109,7 +109,7 @@ package sdl {
     //-------------------------------------------------
     // Window Management
     //-------------------------------------------------
-    def setCaption(title:String, icon:Int):Unit = return sdl.setCaption(title, icon)
+    def setCaption(title:String, icon:String):Unit = return sdl.setCaption(title, icon)
 
     //-------------------------------------------------
     // TIME
@@ -177,19 +177,13 @@ package sdl {
     //int SDL_SetPalette(SDL_Surface* surface, int flags, SDL_Color* colors, int firstcolor, int ncolors)
     @native def setPalette(surface:SDL_Surface, flags:Int, colors:Array[SDL_Color], firstcolor:Int, ncolors:Int):Int
     //int SDL_SetGamma(float redgamma, float greengamma, float bluegamma)
-    
     //int SDL_GetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable)
-    
     //int SDL_SetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable)
-
     //Uint32 SDL_MapRGB(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b)
     @native def mapRGB(fmt:SDL_PixelFormat, r:Int, g:Int, b:Int):Int
     //Uint32 SDL_MapRGBA(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
-    
     //void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b)
-    
     //void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) 
-   
     //SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int bitsPerPixel, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
     @native def createRGBSurface(flags:Int, width:Int, height:Int, bitsPerPixel:Int, Rmask:Int, Gmask:Int, Bmask:Int, Amask:Int):SDL_Surface 
     //SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels,int width, int height, int depth, int pitch,Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
@@ -239,7 +233,7 @@ package sdl {
     //-------------------------------------------------
     //int SDL_GetWMInfo(SDL_SysWMinfo *info)
     //void SDL_WM_SetCaption(const char *title, const char *icon)
-    @native def setCaption(title:String, icon:Int):Unit
+    @native def setCaption(title:String, icon:String):Unit
     //void SDL_WM_GetCaption(char **title, char **icon)
     //void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask)
     //int SDL_WM_IconifyWindow(void)
index 871d8c5..c1f0f48 100644 (file)
@@ -322,10 +322,10 @@ JNIEXPORT jint JNICALL Java_sdl_SDL_fillRect
 /*
  * Class:     sdl_SDL
  * Method:    setCaption
- * Signature: (Ljava/lang/String;I)V
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
  */
 JNIEXPORT void JNICALL Java_sdl_SDL_setCaption
-  (JNIEnv *, jobject, jstring, jint);
+  (JNIEnv *, jobject, jstring, jstring);
 
 /*
  * Class:     sdl_SDL