Wat niet kan is nog nooit gebeurd
waarom gebruik je liever geen JNI?
Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.
Tja, ben eingelijk op zoek naar een kant-en-klaar-ik-ben-te-lui oplossing. 
Wellicht dat de jni oplossing toch het beste is. (Zoals ik het nu zie, zelfs de enige oplossing)
Uit jawt.h\
Moet hier dan maar even mee stoeien!
Wellicht dat de jni oplossing toch het beste is. (Zoals ik het nu zie, zelfs de enige oplossing)
Uit jawt.h\
Java:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
| In Win32, a programmer wishes to access the HWND of a canvas to perform * native rendering into it. The programmer has declared the paint() method * for their canvas subclass to be native: * * * MyCanvas.java: * * import java.awt.*; * * public class MyCanvas extends Canvas { * * static { * System.loadLibrary("mylib"); * } * * public native void paint(Graphics g); * } * * * myfile.c: * * #include "jawt_md.h" * #include <assert.h> * * JNIEXPORT void JNICALL * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics) * { * JAWT awt; * JAWT_DrawingSurface* ds; * JAWT_DrawingSurfaceInfo* dsi; * JAWT_Win32DrawingSurfaceInfo* dsi_win; * jboolean result; * jint lock; * * // Get the AWT * awt.version = JAWT_VERSION_1_3; * result = JAWT_GetAWT(env, &awt); * assert(result != JNI_FALSE); * * // Get the drawing surface * ds = awt.GetDrawingSurface(env, canvas); * assert(ds != NULL); * * // Lock the drawing surface * lock = ds->Lock(ds); * assert((lock & JAWT_LOCK_ERROR) == 0); * * // Get the drawing surface info * dsi = ds->GetDrawingSurfaceInfo(ds); * * // Get the platform-specific drawing info * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; * * ////////////////////////////// * // !!! DO PAINTING HERE !!! // * ////////////////////////////// * * // Free the drawing surface info * ds->FreeDrawingSurfaceInfo(dsi); * * // Unlock the drawing surface * ds->Unlock(ds); * * // Free the drawing surface * awt.FreeDrawingSurface(ds); * } * */ |
Moet hier dan maar even mee stoeien!
[ Voor 84% gewijzigd door Nexopheus op 18-02-2003 17:44 ]
Wat niet kan is nog nooit gebeurd