return ret_rect;
}
+SDL_Color createSDL_Color(JNIEnv* env, jobject color_obj){
+ jclass sdl_color = getSDL_Color(env);
+ jfieldID fld_r = (*env)->GetFieldID(env, sdl_color, "r", "I");
+ jfieldID fld_g = (*env)->GetFieldID(env, sdl_color, "g", "I");
+ jfieldID fld_b = (*env)->GetFieldID(env, sdl_color, "b", "I");
+
+ jint color_r = (*env)->GetIntField(env, color_obj, fld_r);
+ jint color_g = (*env)->GetIntField(env, color_obj, fld_g);
+ jint color_b = (*env)->GetIntField(env, color_obj, fld_b);
+ SDL_Color color;
+ color.r = color_r;
+ color.g = color_g;
+ color.b = color_b;
+
+ return color;
+}
+
JNIEXPORT jint JNICALL Java_sdl_SDL_blitSurface(JNIEnv *env, jobject obj, jobject src, jobject srcrect, jobject dst, jobject dstrect){
- jclass sdl_surface = getSDL_Surface(env);
-
SDL_Rect srcrect2 = createSDL_Rect(env, srcrect);
SDL_Rect dstrect2 = createSDL_Rect(env, dstrect);
SDL_Surface* src2 = getSDL_SurfacePointer(env, src);
return SDL_BlitSurface(src2, &srcrect2, dst2, &dstrect2);
}
+JNIEXPORT jint JNICALL Java_sdl_SDL_fillRect(JNIEnv *env, jobject obj, jobject surface, jobject dstrect, jlong color){
+ SDL_Rect dstrect2 = createSDL_Rect(env, dstrect);
+ SDL_Surface* dst_surface = getSDL_SurfacePointer(env, surface);
+
+ return SDL_FillRect(dst_surface, &dstrect2, (Uint32)color);
+}
+
/**
* Window Management
def unlockSurface(surface:Surface):Unit = return sdl.unlockSurface(surface)
def loadBMP(file:String):Surface = return sdl.loadBMP(file)
def blitSurface(surface:Surface, srcrect:Rect, dst:Surface, dstrect:Rect):Int = sdl.blitSurface(surface, srcrect, dst, dstrect)
+ def fillRect(surface:Surface, dstrect:Rect, color:Long):Int = sdl.fillRect(surface, dstrect, color)
+
//-------------------------------------------------
// Window Management
//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)
+ @native def fillRect(surface:Surface, dstrect:Rect, color:Long):Int
//---GL---
//int SDL_GL_LoadLibrary(const char *path)
var unused:Int = 0
}
- class Rect {
- var x:Int = 0
- var y:Int = 0
- var w:Int = 0
- var h:Int = 0
+ class Rect(var x:Int, var y:Int, var w:Int, var h:Int) {
+ def this(x:Int, y:Int) = this(x,y,0,0)
+ def this() = this(0,0,0,0)
}
/**