44 |
|
|
45 |
typedef std::vector<GLubyte> ByteVector; |
typedef std::vector<GLubyte> ByteVector; |
46 |
|
|
47 |
ObjectStorer<Os::Window> windows; |
ObjectStorer<Os::RenderingSurface> windows; |
48 |
ObjectStorer<Image> images; |
ObjectStorer<Image> images; |
49 |
ObjectStorer<Mosaic::MosaicTile> imagetiles; |
ObjectStorer<Mosaic::MosaicTile> imagetiles; |
50 |
ObjectStorer<RealFont> fonts; |
ObjectStorer<RealFont> fonts; |
104 |
return env->NewStringUTF(stdstr.c_str()); |
return env->NewStringUTF(stdstr.c_str()); |
105 |
} |
} |
106 |
|
|
107 |
Os::Window *getWindowByWID(int wid) { |
Os::RenderingSurface *getWindowByWID(int wid) { |
108 |
return (wid<0 ? defaultWindow : windows.get(wid)); |
return (wid<0 ? defaultWindow : windows.get(wid)); |
109 |
} |
} |
110 |
|
|
111 |
void setWindow(int wid = -1) { |
void setWindow(int wid = -1) { |
112 |
Os::Window *win = getWindowByWID(wid); |
Os::RenderingSurface *win = getWindowByWID(wid); |
113 |
if(!win->setCurrent()) { |
if(!win->setCurrent()) { |
114 |
cerr << "Couldn't set window to current -> returning\n"; |
cerr << "Couldn't set window to current -> returning\n"; |
115 |
return; |
return; |
125 |
} |
} |
126 |
int wid = contextStack[contextStack.size()-1]; |
int wid = contextStack[contextStack.size()-1]; |
127 |
contextStack.pop_back(); |
contextStack.pop_back(); |
128 |
Os::Window *win = getWindowByWID(wid); |
Os::RenderingSurface *win = getWindowByWID(wid); |
129 |
if(!win->releaseCurrent()) { |
if(!win->releaseCurrent()) { |
130 |
cerr << "Couldn't release window current!!!"; |
cerr << "Couldn't release window current!!!"; |
131 |
exit(17); |
exit(17); |
301 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_repaintWindow |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_repaintWindow |
302 |
(JNIEnv *env, jclass, jint id) { |
(JNIEnv *env, jclass, jint id) { |
303 |
DBG(dbg_event) << "RepaintWindow called\n"; |
DBG(dbg_event) << "RepaintWindow called\n"; |
304 |
Os::Window *w = windows.get(id); |
Os::Window *w = (Os::Window *)windows.get(id); |
305 |
w->repaint(); |
w->repaint(); |
306 |
} |
} |
307 |
|
|
308 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_getWindowSize |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_getWindowSize |
309 |
(JNIEnv *env, jclass, jint id, jobject rect) { |
(JNIEnv *env, jclass, jint id, jobject rect) { |
310 |
Os::Window *win = windows.get(id); |
Os::RenderingSurface *win = windows.get(id); |
311 |
int xywh[4]; |
int xywh[4]; |
312 |
win->getSize(xywh); |
win->getSize(xywh); |
313 |
|
|
327 |
|
|
328 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_addTimeoutWindow |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_addTimeoutWindow |
329 |
(JNIEnv *env, jclass, jint id, jint ms, jint tid) { |
(JNIEnv *env, jclass, jint id, jint ms, jint tid) { |
330 |
Os::Window *w = windows.get(id); |
Os::Window *w = (Os::Window *)windows.get(id); |
331 |
w->addTimeout(ms, tid); |
w->addTimeout(ms, tid); |
332 |
} |
} |
333 |
|
|
343 |
|
|
344 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1move |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1move |
345 |
(JNIEnv *env, jclass, jint id, jint x, jint y) { |
(JNIEnv *env, jclass, jint id, jint x, jint y) { |
346 |
windows.get(id)->move(x,y); |
Os::Window *w = (Os::Window *)windows.get(id); |
347 |
|
w->move(x,y); |
348 |
} |
} |
349 |
|
|
350 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1resize |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1resize |
351 |
(JNIEnv *env, jclass, jint id, jint w, jint h) { |
(JNIEnv *env, jclass, jint id, jint wid, jint h) { |
352 |
windows.get(id)->resize(w,h); |
Os::Window *w = (Os::Window *)windows.get(id); |
353 |
|
w->resize(wid,h); |
354 |
} |
} |
355 |
|
|
356 |
|
|