11#include "cdllFreeWRL.h"
15#include "libFreeWRL.h"
17void fwl_setConsole_writePrimitive(
int ibool);
18void statusbar_set_window_size(
int width,
int height);
19int statusbar_handle_mouse(
int mev,
int butnum,
int mouseX,
int mouseY);
21void *fwl_frontenditem_dequeue();
22char* fwl_resitem_getURL(
void *res);
23int fwl_resitem_getStatus(
void *res);
24void fwl_resitem_setStatus(
void *resp,
int status);
25int fwl_resitem_getType(
void *res);
26int fwl_resitem_getMediaType(
void *res);
27void fwl_resitem_enqueuNextMulti(
void *res);
28void fwl_resitem_setLocalPath(
void *res,
char* path);
29void fwl_resitem_enqueue(
void *res);
30int file2blob(
void *res);
31void frontend_dequeue_get_enqueue(
void *fwctx);
32int fv_parseCommandLine (
int argc,
char **argv,
freewrl_params_t *,
int *url_index);
35void SSRserver_enqueue_request_and_wait(
void *fwctx,
void *request);
43DLLFREEWRL_API
void * dllFreeWRL_dllFreeWRL()
62 return fwl_init_instance();
64DLLFREEWRL_API
void dllFreeWRL_setDensityFactor(
void *fwctx,
float density_factor){
65 fwl_setCurrentHandle(fwctx, __FILE__, __LINE__);
66 fwl_setDensityFactor(density_factor);
67 fwl_clearCurrentHandle();
74DLLFREEWRL_API
void dllFreeWRL_onInit(
void *fwctx,
int width,
int height,
void* windowhandle,
int bEai,
int frontend_handles_display_thread)
80 fwl_setCurrentHandle(fwctx, __FILE__, __LINE__);
85 params->width = width;
86 params->height = height;
88 params->fullscreen = 0;
89 params->winToEmbedInto = (long)windowhandle;
90 params->frontend_handles_display_thread = frontend_handles_display_thread;
91 ok = fwl_initFreeWRL(params);
92#ifndef FRONTEND_HANDLES_DISPLAY_THREAD
94 if(!frontend_handles_display_thread)
95 fwl_initializeDisplayThread();
100 fwl_setScreenDim(width, height);
102 fwl_clearCurrentHandle();
106DLLFREEWRL_API
void dllFreeWRL_onInitArgv(
void *fwctx,
int argc,
char **argv,
int frontend_handles_display_thread)
110 char *start_url = NULL;
112 fwl_setCurrentHandle(fwctx, __FILE__, __LINE__);
118 params->height = 400;
119 fv_parseCommandLine(argc, argv,params, &url_index);
121 start_url = argv[url_index];
122 params->frontend_handles_display_thread = frontend_handles_display_thread;
123 ok = fwl_initFreeWRL(params);
125#ifndef FRONTEND_HANDLES_DISPLAY_THREAD
127 if(!frontend_handles_display_thread)
128 fwl_initializeDisplayThread();
130 fwl_setScreenDim(params->width, params->height);
132 fwl_replaceWorldNeeded(start_url);
134 fwl_clearCurrentHandle();
138DLLFREEWRL_API
void dllFreeWRL_setTempFolder(
void *fwctx,
char *tmpFolder)
140 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
141 fwl_tmpFileLocation(tmpFolder);
143 fwl_clearCurrentHandle();
145DLLFREEWRL_API
void dllFreeWRL_setFontFolder(
void *fwctx,
char *fontFolder)
147 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
148 fwl_fontFileLocation(fontFolder);
150 fwl_clearCurrentHandle();
152DLLFREEWRL_API
void * dllFreeWRL_dllFreeWRL1(
int width,
int height,
void* windowhandle,
int bEai)
155 fwctx = fwl_init_instance();
156 dllFreeWRL_onInit(fwctx, width, height, windowhandle, bEai, FALSE);
159DLLFREEWRL_API
void *dllFreeWRL_dllFreeWRL2(
char* scene_url,
int width,
int height,
void* windowhandle,
int bEai)
162 fwctx = fwl_init_instance();
163 dllFreeWRL_onInit(fwctx, width, height, windowhandle, bEai, FALSE);
164 dllFreeWRL_onLoad(fwctx,scene_url);
168DLLFREEWRL_API
void dllFreeWRL_onLoad(
void *fwctx,
char* scene_url)
170 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
171 fwl_replaceWorldNeeded(scene_url);
173 fwl_clearCurrentHandle();
176DLLFREEWRL_API
void dllFreeWRL_onResize(
void *fwctx,
int width,
int height){
177 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
181 fwl_setScreenDim(width,height);
184 fwl_clearCurrentHandle();
187DLLFREEWRL_API
int dllFreeWRL_onMouse(
void *fwctx,
int mouseAction,
int mouseButton,
int x,
int y){
192 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
193 cursorStyle = fwl_handle_mouse(mouseAction,mouseButton,x,y,0);
195 fwl_clearCurrentHandle();
198DLLFREEWRL_API
int dllFreeWRL_onTouch(
void *fwctx,
int touchAction,
unsigned int ID,
int x,
int y) {
203 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
204 cursorStyle = fwl_handle_touch(touchAction, ID, x, y, 0);
206 fwl_clearCurrentHandle();
209DLLFREEWRL_API
void dllFreeWRL_onGyro(
void *fwctx,
float rx,
float ry,
float rz) {
211 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
212 fwl_handle_gyro(rx, ry, rz);
214 fwl_clearCurrentHandle();
217DLLFREEWRL_API
void dllFreeWRL_onAccelerometer(
void *fwctx,
float ax,
float ay,
float az) {
219 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
220 fwl_handle_accelerometer(ax, ay, az);
222 fwl_clearCurrentHandle();
225DLLFREEWRL_API
void dllFreeWRL_onMagnetic(
void *fwctx,
float azimuth,
float pitch,
float roll) {
227 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
228 fwl_handle_magnetic(azimuth, pitch, roll);
230 fwl_clearCurrentHandle();
233DLLFREEWRL_API
void dllFreeWRL_onKey(
void *fwctx,
int keyAction,
int keyValue){
236 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
251 fwl_do_keyPress(kp, ka);
255 fwl_do_keyPress(kp,ka);
259 fwl_clearCurrentHandle();
261DLLFREEWRL_API
void dllFreeWRL_onClose(
void *fwctx)
267 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
271 fwl_clearCurrentHandle();
273DLLFREEWRL_API
void dllFreeWRL_print(
void *fwctx,
char *str)
275 if(fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
278 fwl_clearCurrentHandle();
280DLLFREEWRL_API
void dllFreeWRL_onDraw(
void *fwctx)
282 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
283#ifndef FRONTEND_GETS_FILES
285 frontend_dequeue_get_enqueue(fwctx);
289 fwl_clearCurrentHandle();
292DLLFREEWRL_API
int dllFreeWRL_getUpdatedCursorStyle(
void *fwctx)
295 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
296 cstyle = getCursorStyle();
298 fwl_clearCurrentHandle();
304DLLFREEWRL_API
void* dllFreeWRL_frontenditem_dequeue(
void *fwctx)
307 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
308 item = fwl_frontenditem_dequeue();
310 fwl_clearCurrentHandle();
313DLLFREEWRL_API
char* dllFreeWRL_resitem_getURL(
void *fwctx,
void *res){
315 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
316 url = fwl_resitem_getURL(res);
318 fwl_clearCurrentHandle();
321DLLFREEWRL_API
int dllFreeWRL_resitem_getStatus(
void *fwctx,
void *res){
323 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
324 status = fwl_resitem_getStatus(res);
326 fwl_clearCurrentHandle();
329DLLFREEWRL_API
void dllFreeWRL_resitem_setStatus(
void *fwctx,
void *res,
int status){
330 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
331 fwl_resitem_setStatus(res, status);
333 fwl_clearCurrentHandle();
336DLLFREEWRL_API
int dllFreeWRL_resitem_getType(
void *fwctx,
void *res){
338 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
339 status = fwl_resitem_getType(res);
341 fwl_clearCurrentHandle();
344DLLFREEWRL_API
int dllFreeWRL_resitem_getMediaType(
void *fwctx,
void *res) {
346 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)) {
347 status = fwl_resitem_getMediaType(res);
349 fwl_clearCurrentHandle();
353DLLFREEWRL_API
void dllFreeWRL_resitem_enqueuNextMulti(
void *fwctx,
void *res){
354 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
355 fwl_resitem_enqueuNextMulti(res);
357 fwl_clearCurrentHandle();
359DLLFREEWRL_API
void dllFreeWRL_resitem_setLocalPath(
void *fwctx,
void *res,
char* path){
360 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
361 fwl_resitem_setLocalPath(res,path);
363 fwl_clearCurrentHandle();
365DLLFREEWRL_API
void dllFreeWRL_resitem_load(
void *fwctx,
void *res){
366 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
368 fwl_resitem_enqueue(res);
370 fwl_clearCurrentHandle();
372DLLFREEWRL_API
void dllFreeWRL_resitem_enqueue(
void *fwctx,
void *res){
373 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
374 fwl_resitem_enqueue(res);
376 fwl_clearCurrentHandle();
380DLLFREEWRL_API
void dllFreeWRL_SSRserver_enqueue_request_and_wait(
void *fwctx,
void *request){
381 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
382 SSRserver_enqueue_request_and_wait(fwctx, request);
384 fwl_clearCurrentHandle();
388DLLFREEWRL_API
void dllFreeWRL_commandline(
void *fwctx,
char *cmdline){
389 if (fwl_setCurrentHandle(fwctx, __FILE__, __LINE__)){
390 fwl_commandline(cmdline);
392 fwl_clearCurrentHandle();