11 #include "cdllFreeWRL.h"
15 #include "libFreeWRL.h"
17 void fwl_setConsole_writePrimitive(
int ibool);
18 void statusbar_set_window_size(
int width,
int height);
19 int statusbar_handle_mouse(
int mev,
int butnum,
int mouseX,
int mouseY);
21 void *fwl_frontenditem_dequeue();
22 char* fwl_resitem_getURL(
void *res);
23 int fwl_resitem_getStatus(
void *res);
24 int fwl_resitem_getType(
void *res);
25 int fwl_resitem_getMediaType(
void *res);
26 void fwl_resitem_enqueuNextMulti(
void *res);
27 void fwl_resitem_setLocalPath(
void *res,
char* path);
28 void fwl_resitem_enqueue(
void *res);
29 int file2blob(
void *res);
32 void SSRserver_enqueue_request_and_wait(
void *fwctx,
void *request);
40 DLLFREEWRL_API
void * dllFreeWRL_dllFreeWRL()
59 return fwl_init_instance();
61 DLLFREEWRL_API
void dllFreeWRL_setDensityFactor(
void *fwctx,
float density_factor){
62 fwl_setCurrentHandle(fwctx, __FILE__, __LINE__);
63 fwl_setDensityFactor(density_factor);
64 fwl_clearCurrentHandle();
71 DLLFREEWRL_API
void dllFreeWRL_onInit(
void *fwctx,
int width,
int height,
void* windowhandle,
int bEai,
int frontend_handles_display_thread)
77 fwl_setCurrentHandle(fwctx, __FILE__, __LINE__);
82 params->width = width;
83 params->height = height;
85 params->fullscreen = 0;
86 params->winToEmbedInto = (long)windowhandle;
87 params->frontend_handles_display_thread = frontend_handles_display_thread;
88 ok = fwl_initFreeWRL(params);
89 #ifndef FRONTEND_HANDLES_DISPLAY_THREAD
91 if(!frontend_handles_display_thread)
92 fwl_initializeDisplayThread();
97 fwl_setScreenDim(width, height);
99 fwl_clearCurrentHandle();
102 DLLFREEWRL_API
void dllFreeWRL_setTempFolder(
void *fwctx,
char *tmpFolder)
104 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
105 fwl_tmpFileLocation(tmpFolder);
107 fwl_clearCurrentHandle();
109 DLLFREEWRL_API
void dllFreeWRL_setFontFolder(
void *fwctx,
char *fontFolder)
111 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
112 fwl_fontFileLocation(fontFolder);
114 fwl_clearCurrentHandle();
116 DLLFREEWRL_API
void * dllFreeWRL_dllFreeWRL1(
int width,
int height,
void* windowhandle,
int bEai)
119 fwctx = fwl_init_instance();
120 dllFreeWRL_onInit(fwctx, width, height, windowhandle, bEai, FALSE);
123 DLLFREEWRL_API
void *dllFreeWRL_dllFreeWRL2(
char* scene_url,
int width,
int height,
void* windowhandle,
int bEai)
126 fwctx = fwl_init_instance();
127 dllFreeWRL_onInit(fwctx, width, height, windowhandle, bEai, FALSE);
128 dllFreeWRL_onLoad(fwctx,scene_url);
132 DLLFREEWRL_API
void dllFreeWRL_onLoad(
void *fwctx,
char* scene_url)
135 url = strdup(scene_url);
136 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
137 fwl_replaceWorldNeeded(url);
139 fwl_clearCurrentHandle();
143 DLLFREEWRL_API
void dllFreeWRL_onResize(
void *fwctx,
int width,
int height){
144 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
148 fwl_setScreenDim(width,height);
151 fwl_clearCurrentHandle();
154 DLLFREEWRL_API
int dllFreeWRL_onMouse(
void *fwctx,
int mouseAction,
int mouseButton,
int x,
int y){
159 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
160 cursorStyle = fwl_handle_mouse(mouseAction,mouseButton,x,y,0);
162 fwl_clearCurrentHandle();
165 DLLFREEWRL_API
int dllFreeWRL_onTouch(
void *fwctx,
int touchAction,
unsigned int ID,
int x,
int y) {
170 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
171 cursorStyle = fwl_handle_touch(touchAction, ID, x, y, 0);
173 fwl_clearCurrentHandle();
176 DLLFREEWRL_API
void dllFreeWRL_onGyro(
void *fwctx,
float rx,
float ry,
float rz) {
178 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
179 fwl_handle_gyro(rx, ry, rz);
181 fwl_clearCurrentHandle();
184 DLLFREEWRL_API
void dllFreeWRL_onAccelerometer(
void *fwctx,
float ax,
float ay,
float az) {
186 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
187 fwl_handle_accelerometer(ax, ay, az);
189 fwl_clearCurrentHandle();
192 DLLFREEWRL_API
void dllFreeWRL_onMagnetic(
void *fwctx,
float azimuth,
float pitch,
float roll) {
194 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
195 fwl_handle_magnetic(azimuth, pitch, roll);
197 fwl_clearCurrentHandle();
200 DLLFREEWRL_API
void dllFreeWRL_onKey(
void *fwctx,
int keyAction,
int keyValue){
203 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
218 fwl_do_keyPress(kp, ka);
222 fwl_do_keyPress(kp,ka);
226 fwl_clearCurrentHandle();
228 DLLFREEWRL_API
void dllFreeWRL_onClose(
void *fwctx)
234 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
238 fwl_clearCurrentHandle();
240 DLLFREEWRL_API
void dllFreeWRL_print(
void *fwctx,
char *str)
242 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
245 fwl_clearCurrentHandle();
247 DLLFREEWRL_API
void dllFreeWRL_onDraw(
void *fwctx)
249 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
252 fwl_clearCurrentHandle();
255 DLLFREEWRL_API
int dllFreeWRL_getUpdatedCursorStyle(
void *fwctx)
258 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
259 cstyle = getCursorStyle();
261 fwl_clearCurrentHandle();
265 #define NULL (char*)0
267 DLLFREEWRL_API
void* dllFreeWRL_frontenditem_dequeue(
void *fwctx)
270 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
271 item = fwl_frontenditem_dequeue();
273 fwl_clearCurrentHandle();
276 DLLFREEWRL_API
char* dllFreeWRL_resitem_getURL(
void *fwctx,
void *res){
278 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
279 url = fwl_resitem_getURL(res);
281 fwl_clearCurrentHandle();
284 DLLFREEWRL_API
int dllFreeWRL_resitem_getStatus(
void *fwctx,
void *res){
286 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
287 status = fwl_resitem_getStatus(res);
289 fwl_clearCurrentHandle();
292 DLLFREEWRL_API
void dllFreeWRL_resitem_setStatus(
void *fwctx,
void *res,
int status){
293 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
294 fwl_resitem_setStatus(res, status);
296 fwl_clearCurrentHandle();
299 DLLFREEWRL_API
int dllFreeWRL_resitem_getType(
void *fwctx,
void *res){
301 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
302 status = fwl_resitem_getType(res);
304 fwl_clearCurrentHandle();
307 DLLFREEWRL_API
int dllFreeWRL_resitem_getMediaType(
void *fwctx,
void *res) {
309 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
310 status = fwl_resitem_getMediaType(res);
312 fwl_clearCurrentHandle();
316 DLLFREEWRL_API
void dllFreeWRL_resitem_enqueuNextMulti(
void *fwctx,
void *res){
317 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
318 fwl_resitem_enqueuNextMulti(res);
320 fwl_clearCurrentHandle();
322 DLLFREEWRL_API
void dllFreeWRL_resitem_setLocalPath(
void *fwctx,
void *res,
char* path){
323 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
324 fwl_resitem_setLocalPath(res,path);
326 fwl_clearCurrentHandle();
328 DLLFREEWRL_API
void dllFreeWRL_resitem_load(
void *fwctx,
void *res){
329 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
331 fwl_resitem_enqueue(res);
333 fwl_clearCurrentHandle();
335 DLLFREEWRL_API
void dllFreeWRL_resitem_enqueue(
void *fwctx,
void *res){
336 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
337 fwl_resitem_enqueue(res);
339 fwl_clearCurrentHandle();
343 DLLFREEWRL_API
void dllFreeWRL_SSRserver_enqueue_request_and_wait(
void *fwctx,
void *request){
344 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
345 SSRserver_enqueue_request_and_wait(fwctx, request);
347 fwl_clearCurrentHandle();
351 DLLFREEWRL_API
void dllFreeWRL_commandline(
void *fwctx,
char *cmdline){
352 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
353 fwl_commandline(cmdline);
355 fwl_clearCurrentHandle();