OSDN Git Service

SDL.videoDriverNameを実装
authorRoNor <ronoru@users.sourceforge.jp>
Mon, 17 May 2010 13:59:02 +0000 (22:59 +0900)
committerRoNor <ronoru@users.sourceforge.jp>
Mon, 17 May 2010 13:59:02 +0000 (22:59 +0900)
build/sdl/SDL$.class
build/sdl/SDL.class
src/SDL.c
src/SDL.scala
src/sdl_SDL.h

index 28fa3e5..6b8043a 100644 (file)
Binary files a/build/sdl/SDL$.class and b/build/sdl/SDL$.class differ
index 7809c05..119eb1f 100644 (file)
Binary files a/build/sdl/SDL.class and b/build/sdl/SDL.class differ
index cf410a0..704fec1 100644 (file)
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -1,6 +1,7 @@
 #include <SDL/SDL.h>
 #include "sdl_SDL.h"
 
+#define BUFFER_SIZE 256
 jobject g_surface = NULL;
 
 jclass getSDL_Surface(JNIEnv *env){
@@ -216,6 +217,8 @@ jobject createObjectFromSDL_VideoInfo(JNIEnv* env, jclass sdl_videoinfo, const S
   return sdl_videoinfo_obj;
 }
 
+
+
 /**
  * General
  */
@@ -287,7 +290,14 @@ JNIEXPORT jobject JNICALL Java_sdl_SDL_getVideoInfo(JNIEnv *env, jobject obj){
   return sdl_videoinfo_obj;
 }
 
-JNIEXPORT jstring JNICALL Java_sdl_SDL_videoDriverName(JNIEnv *env, jobject obj, jstring namebuf, jint maxlen){
+JNIEXPORT jstring JNICALL Java_sdl_SDL_videoDriverName(JNIEnv *env, jobject obj){
+  char buffer[BUFFER_SIZE];
+  jstring driver_name = NULL;
+  if(SDL_VideoDriverName(buffer, BUFFER_SIZE) != NULL){
+    driver_name = (*env)->NewStringUTF(env, buffer); 
+  }
+
+  return driver_name;
 }
 
 JNIEXPORT jobject JNICALL Java_sdl_SDL_listModes(JNIEnv *env, jobject obj){
index fcc0381..ec10663 100644 (file)
@@ -82,7 +82,8 @@ package sdl {
     //-------------------------------------------------
     def getVideoSurface():Surface = return sdl.getVideoSurface()
     def getVideoInfo():VideoInfo = return sdl.getVideoInfo()
-
+    def videoDriverName():String = return sdl.videoDriverName()
+    def listModes(format:PixelFormat, flags:Int):Rect = return sdl.listModes(format, flags)
     def setVideoMode(width:Int, height:Int, bitsperpixel:Int, flags:Int):Surface = return sdl.setVideoMode(width, height, bitsperpixel, flags)
     def flip(surface:Surface):Int = sdl.flip(surface)
     def setColors(surface:Surface, colors:Array[Color], firstcolor:Int, ncolor:Int):Int = return sdl.setColors(surface, colors, firstcolor, ncolor)
@@ -90,6 +91,7 @@ package sdl {
     def mapRGB(fmt:PixelFormat, r:Int, g:Int, b:Int):Long = return sdl.mapRGB(fmt, r, g, b);
     def lockSurface(surface:Surface):Int = return sdl.lockSurface(surface)
     def unlockSurface(surface:Surface):Unit = return sdl.unlockSurface(surface)
+    def blitSurface(surface:Surface, srcrect:Rect, dst:Surface, dstrect:Rect):Int = sdl.blitSurface(surface, srcrect, dst, dstrect)
 
     //-------------------------------------------------
     // Window Management
@@ -140,9 +142,9 @@ package sdl {
     //const SDL_VideoInfo* SDL_GetVideoInfo()
     @native def getVideoInfo():VideoInfo
     //char* SDL_VideoDriverName(char* namebuf, int maxlen)
-    @native def videoDriverName(namebuf:String, maxlen:Int):String
+    @native def videoDriverName():String
     //SDL_Rect** SDL_ListModes(SDL_PixelFormat* format, Unit32 flags)
-    @native def listModes():Rect
+    @native def listModes(format:PixelFormat, flags:Int):Rect
     //int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
     @native def videoModeOK(width:Int, height:Int, bpp:Int, flags:Long):Int
     //SDL_Surface* setVideoMode(int width, int height, int bitsperpixel, Uint32 flags)
@@ -190,6 +192,7 @@ package sdl {
     //void SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect)
     //void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
     //int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
+    @native def blitSurface(surface:Surface, srcrect:Rect, dst:Surface, dstrect:Rect):Int
     //int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color)
     
     //---GL---
index 85db0bd..00e085a 100644 (file)
@@ -138,10 +138,10 @@ JNIEXPORT jobject JNICALL Java_sdl_SDL_getVideoInfo
 /*
  * Class:     sdl_SDL
  * Method:    videoDriverName
- * Signature: (Ljava/lang/String;I)Ljava/lang/String;
+ * Signature: ()Ljava/lang/String;
  */
 JNIEXPORT jstring JNICALL Java_sdl_SDL_videoDriverName
-  (JNIEnv *, jobject, jstring, jint);
+  (JNIEnv *, jobject);
 
 /*
  * Class:     sdl_SDL