17#include <main/headers.h>
24#include <libFreeWRL.h>
27#include <ui/statusbar.h>
29void fv_swapbuffers(freewrl_params_t * d);
30bool fv_create_and_bind_GLcontext(freewrl_params_t * d);
31BOOL fwDisplayChange();
40#define ES_WINDOW_RGB 0
42#define ES_WINDOW_ALPHA 1
44#define ES_WINDOW_DEPTH 2
46#define ES_WINDOW_STENCIL 4
48#define ES_WINDOW_MULTISAMPLE 8
53void fv_swapbuffers(freewrl_params_t * d){
54 eglSwapBuffers((EGLDisplay)d->display,(EGLSurface)d->surface);
56EGLBoolean fwCreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
57 EGLContext* eglContext, EGLSurface* eglSurface,
68 EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
74 display = eglGetDisplay(dc);
76 if ( display == EGL_NO_DISPLAY ){
77 display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
80 if ( display == EGL_NO_DISPLAY )
82 printf(
"Ouch - EGL_NO_DISPLAY\n");
86 if ( !eglInitialize(display, &majorVersion, &minorVersion) )
89 int ierr = eglGetError();
90 sprintf(errbuf,
"%x",ierr);
99 printf(
"Ouch no eglInitialize %d %s\n",ierr,errbuf);
103 if ( !eglGetConfigs(display, NULL, 0, &numConfigs) )
105 printf(
"Ouch no eglGetConfigs\n");
110 if ( !eglChooseConfig(display, attribList, &config, 1, &numConfigs) )
116 surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)hWnd, NULL);
117 if ( surface == EGL_NO_SURFACE )
123 context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs );
124 if ( context == EGL_NO_CONTEXT )
130 if ( !eglMakeCurrent(display, surface, surface, context) )
135 *eglDisplay = display;
136 *eglSurface = surface;
137 *eglContext = context;
141bool fv_create_and_bind_GLcontext(freewrl_params_t * d){
143 EGLDisplay eglDisplay;
144 EGLContext eglContext;
145 EGLSurface eglSurface;
146 EGLNativeWindowType eglWindow;
147 GLuint flags = ES_WINDOW_RGB | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL;
148 EGLint attribList[] =
153 EGL_ALPHA_SIZE, (flags & ES_WINDOW_ALPHA) ? 8 : EGL_DONT_CARE,
154 EGL_DEPTH_SIZE, (flags & ES_WINDOW_DEPTH) ? 24 : EGL_DONT_CARE,
155 EGL_STENCIL_SIZE, (flags & ES_WINDOW_STENCIL) ? 8 : EGL_DONT_CARE,
156 EGL_SAMPLE_BUFFERS, (flags & ES_WINDOW_MULTISAMPLE) ? 1 : 0,
172 eglWindow = (EGLNativeWindowType) d->winToEmbedInto;
173 if ( !fwCreateEGLContext (eglWindow,
179 printf(
"Ouch CreateEGLContext returns FALSE\n");
182 d->context = (
void*)eglContext;
183 d->display = (
void*)eglDisplay;
184 d->surface = (
void*)eglSurface;
188BOOL fwDisplayChange(){
191void fwCloseContext(){
193void fv_change_GLcontext(freewrl_params_t* d){
200#include <main/headers.h>
209void fv_swapbuffers(freewrl_params_t * d)
214 SwapBuffers((HDC)d->display);
217BOOL bSetupPixelFormat(HDC hdc)
220 PIXELFORMATDESCRIPTOR pfd, *ppfd;
225 memset(ppfd,0,
sizeof(PIXELFORMATDESCRIPTOR));
227 ppfd->nSize =
sizeof(PIXELFORMATDESCRIPTOR);
229 ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
230 if(gglobal()->display.shutterGlasses ==1)
231 ppfd->dwFlags |= PFD_STEREO;
232 ppfd->iLayerType = PFD_MAIN_PLANE;
233 ppfd->iPixelType = PFD_TYPE_RGBA;
234 ppfd->cColorBits = 24;
235 ppfd->cAlphaBits = 8;
236 ppfd->cDepthBits = 32;
238 ppfd->cStencilBits = 8;
239 ppfd->cAuxBuffers = 0;
240 ppfd->cAccumBits = 0;
243 if ( (pixelformat = ChoosePixelFormat(hdc, ppfd)) == 0 )
245 MessageBox(NULL,
"ChoosePixelFormat failed",
"Error", MB_OK);
251 DescribePixelFormat(hdc, pixelformat,
sizeof(PIXELFORMATDESCRIPTOR), ppfd);
256 if (SetPixelFormat(hdc, pixelformat, ppfd) == FALSE)
258 MessageBox(NULL,
"SetPixelFormat failed",
"Error", MB_OK);
264void fv_change_GLcontext(freewrl_params_t* d){
268 hDC = (HDC)d->display;
269 hRC = (HGLRC)d->context;
270 wglMakeCurrent(hDC, hRC);
273bool fv_create_and_bind_GLcontext(freewrl_params_t* d)
283 hWnd = (HWND)d->winToEmbedInto;
286 if (!bSetupPixelFormat(hDC))
287 printf(
"ouch - bSetupPixelFormat failed\n");
288 hRC = wglCreateContext(hDC);
295 if (wglMakeCurrent(hDC, hRC)) {
299 d->display = (
void*)hDC;
300 d->context = (
void*)hRC;
307BOOL fwDisplayChange(){
312 ttglobal tg = gglobal();
313 hWnd = (HWND)((freewrl_params_t*)tg->display.params)->winToEmbedInto;
316 ret = bSetupPixelFormat(ghDC);
322 ghRC = wglCreateContext(ghDC);
323 wglMakeCurrent(ghDC, ghRC);
328void fwCloseContext(){
332 ttglobal tg = gglobal();
333 hWnd = (HWND)((freewrl_params_t *)tg->display.params)->winToEmbedInto;
334 ghRC = wglGetCurrentContext();
336 wglDeleteContext(ghRC);
339 ReleaseDC(hWnd, ghDC);
353HWND fw_window32_hwnd(){
354 ttglobal tg = (ttglobal)gglobal();
355 return (HWND)((freewrl_params_t *)tg->display.params)->winToEmbedInto;
358void fwl_do_keyPress(
const char kp,
int type);
365#define VK_SEMICOLON 0xBA
368#define VK_PERIOD 0xBE
377#define VK_BACK_QUOTE 0xC0
383#define VK_BACK_SLASH 0xDC
386#define VK_EQUALS 0xBB
388#ifndef VK_OPEN_BRACKET
389#define VK_OPEN_BRACKET 0xDB
391#ifndef VK_CLOSE_BRACKET
392#define VK_CLOSE_BRACKET 0xDD
395#define VK_GR_LESS 0xE2
400static int oldx = 0, oldy = 0;
405static short gcWheelDelta = 0;
409static bool m_fullscreen =
false;
410static bool dualmonitor =
false;
411static RECT smallrect;
413bool EnableFullscreen(
int w,
int h,
int bpp)
415#if defined(ENABLEFULLSCREEN)
424 MONITORINFOEX monInfo;
427 DWORD style, exstyle;
435 hMonitor = MonitorFromWindow(ghWnd, MONITOR_DEFAULTTOPRIMARY);
436 memset(&monInfo, 0,
sizeof(MONITORINFOEX));
437 monInfo.cbSize =
sizeof(MONITORINFOEX);
438 GetMonitorInfo(hMonitor, (LPMONITORINFO)&monInfo);
442 memset(&dmode, 0,
sizeof(DEVMODE));
443 dmode.dmSize =
sizeof(DEVMODE);
445 for(i=0 ; EnumDisplaySettings(monInfo.szDevice, i, &dmode) && !foundMode ; ++i)
447 foundMode = (dmode.dmPelsWidth==(DWORD)w) &&
448 (dmode.dmPelsHeight==(DWORD)h) &&
449 (dmode.dmBitsPerPel==(DWORD)bpp);
451 ConsoleMessage(
"found w=%d h=%d bpp=%d\n",(
int)dmode.dmPelsWidth, (
int)dmode.dmPelsHeight, (
int)dmode.dmBitsPerPel);
453 if(!foundMode || debugit )
455 ConsoleMessage(
"error: suitable display mode for w=%d h=%d bpp=%d not found\n",w,h,bpp);
456 GetWindowRect(ghWnd, &smallrect);
457 ConsoleMessage(
"window rect l=%d t=%d r=%d b=%d\n",smallrect.top,smallrect.left,smallrect.right,smallrect.bottom);
460 dmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
470 GetWindowRect(ghWnd, &smallrect);
473 style = GetWindowLongPtr(ghWnd, GWL_STYLE);
474 exstyle = GetWindowLongPtr(ghWnd, GWL_EXSTYLE);
475 SetWindowLongPtr(ghWnd, GWL_STYLE, style & (~WS_OVERLAPPEDWINDOW));
476 SetWindowLongPtr(ghWnd, GWL_EXSTYLE, exstyle | WS_EX_APPWINDOW | WS_EX_TOPMOST);
482 ret = ChangeDisplaySettingsEx(monInfo.szDevice, &dmode, NULL, CDS_FULLSCREEN, NULL);
484 ret = ChangeDisplaySettings(&dmode, CDS_FULLSCREEN);
487 ok = (ret == DISP_CHANGE_SUCCESSFUL);
488 if(ok) m_fullscreen =
true;
498 GetMonitorInfo(hMonitor, (LPMONITORINFO)&monInfo);
503 SetWindowPos(ghWnd, NULL, monInfo.rcMonitor.left, monInfo.rcMonitor.top, (
int)w, (
int)h,
504 SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOREPOSITION | SWP_NOZORDER);
510 else if(!m_fullscreen)
512 SetWindowLongPtr(ghWnd, GWL_STYLE, style);
513 SetWindowLongPtr(ghWnd, GWL_EXSTYLE, exstyle);
520void DisableFullscreen()
522#if defined(ENABLEFULLSCREEN)
527 MONITORINFOEX monInfo;
531 hMonitor = MonitorFromWindow(ghWnd, MONITOR_DEFAULTTOPRIMARY);
532 memset(&monInfo, 0,
sizeof(MONITORINFOEX));
533 monInfo.cbSize =
sizeof(MONITORINFOEX);
534 GetMonitorInfo(hMonitor, (LPMONITORINFO)&monInfo);
537 ChangeDisplaySettingsEx(monInfo.szDevice, NULL, NULL, 0, NULL);
540 m_fullscreen =
false;
543 style = GetWindowLongPtr(ghWnd, GWL_STYLE);
544 exstyle = GetWindowLongPtr(ghWnd, GWL_EXSTYLE);
545 SetWindowLongPtr(ghWnd, GWL_STYLE, style | WS_OVERLAPPEDWINDOW);
546 SetWindowLongPtr(ghWnd, GWL_EXSTYLE, exstyle & (~(WS_EX_APPWINDOW | WS_EX_TOPMOST)));
555 smallrect.right - smallrect.left,
556 smallrect.bottom - smallrect.top,
564static HCURSOR hSensor, hArrow;
565static HCURSOR cursor;
568 hSensor = LoadCursor(NULL,IDC_HAND);
569 hArrow = LoadCursor( NULL, IDC_ARROW );
571void updateCursorStyle0(
int cstyle)
573 if(!hSensor) loadCursors();
576 SetCursor(hSensor);
break;
578 SetCursor(hArrow);
break;
580 SetCursor(NULL);
break;
586#define PHOME_KEY VK_HOME
587#define PPGDN_KEY VK_NEXT
588#define PLEFT_KEY VK_LEFT
589#define PEND_KEY VK_END
591#define PRIGHT_KEY VK_RIGHT
592#define PPGUP_KEY VK_PRIOR
593#define PDOWN_KEY VK_DOWN
603#define PF10_KEY VK_F10
604#define PF11_KEY VK_F11
605#define PF12_KEY VK_F12
606#define PALT_KEY VK_MENU
607#define PCTL_KEY VK_CONTROL
608#define PSFT_KEY VK_SHIFT
609#define PDEL_KEY VK_DELETE
610#define PRTN_KEY VK_RETURN
611#define PNUM0 VK_NUMPAD0
612#define PNUM1 VK_NUMPAD1
613#define PNUM2 VK_NUMPAD2
614#define PNUM3 VK_NUMPAD3
615#define PNUM4 VK_NUMPAD4
616#define PNUM5 VK_NUMPAD5
617#define PNUM6 VK_NUMPAD6
618#define PNUM7 VK_NUMPAD7
619#define PNUM8 VK_NUMPAD8
620#define PNUM9 VK_NUMPAD9
621#define PNUMDEC VK_DECIMAL
667int platform2web3dActionKeyWIN32(
int platformKey)
672 if(platformKey >= PF1_KEY && platformKey <= PF12_KEY)
673 key = platformKey - PF1_KEY + F1_KEY;
678 key = HOME_KEY;
break;
680 key = END_KEY;
break;
682 key = PGDN_KEY;
break;
684 key = PGUP_KEY;
break;
688 key = DOWN_KEY;
break;
690 key = LEFT_KEY;
break;
692 key = RIGHT_KEY;
break;
694 key = DEL_KEY;
break;
696 key = ALT_KEY;
break;
698 key = CTL_KEY;
break;
700 key = SFT_KEY;
break;
729void printbitssimple(
int n) {
732 i = 1<<(
sizeof(n) * 8 - 1);
740 if(j%8 == 0) printf(
" ");
744static HWND last_key_hWnd = NULL;
745static int clipboard_functions_registered = 0;
746static void win32_clipboard_copy(
char *str){
752 if (!OpenClipboard(last_key_hWnd))
766 hglbCopy = GlobalAlloc(GMEM_MOVEABLE,
767 (len + 1) *
sizeof(TCHAR));
768 if (hglbCopy == NULL)
776 lptstrCopy = GlobalLock(hglbCopy);
777 memcpy(lptstrCopy, str,
778 len *
sizeof(TCHAR));
779 lptstrCopy[len] = (TCHAR) 0;
780 GlobalUnlock(hglbCopy);
784 SetClipboardData(CF_TEXT, hglbCopy);
790static void win32_clipboard_paste() {
796 if (IsClipboardFormatAvailable(CF_TEXT)) {
797 if (OpenClipboard(last_key_hWnd)) {
798 hglb = GetClipboardData(CF_TEXT);
801 lptstr = GlobalLock(hglb);
804 int m, len = strlen(lptstr);
807 fwl_do_rawKeyPress(lptstr[m],KEYPRESS);
817int GetContactIndex(
int dwID,
int *idLookup,
int maxpoints){
819 for (
int i=1; i < maxpoints; i++){
820 if (idLookup[i] == -1){
824 if (idLookup[i] == dwID){
835LRESULT DecodeGesture(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){
839 ZeroMemory(&gi,
sizeof(GESTUREINFO));
841 gi.cbSize =
sizeof(GESTUREINFO);
843 BOOL bResult = GetGestureInfo((HGESTUREINFO)lParam, &gi);
844 BOOL bHandled = FALSE;
861 case GID_TWOFINGERTAP:
865 case GID_PRESSANDTAP:
874 DWORD dwErr = GetLastError();
886void onGestureNotify(HWND hWnd){
887 GESTURECONFIG config = { 0 };
888 config.dwWant =GC_ALLGESTURES | GC_ROTATE;
889 config.dwID = GID_ROTATE;
892 BOOL result = SetGestureConfig(
897 sizeof(GESTURECONFIG)
903void fwl_set_clipboard_copy(
void (*fn)(
char *));
904void fwl_set_clipboard_paste(
void (*fn));
906void statusbar_set_window_size(
int width,
int height);
907int statusbar_handle_mouse(
int mev,
int butnum,
int mouseX,
int mouseY);
908int fwl_hwnd_to_windex(
void *hWnd);
909void fwl_setScreenDim1(
int wi,
int he,
int itargetwindow);
910LRESULT CALLBACK PopupWndProc(
929static int altState = 0;
931static int shiftState = 0;
937 windex = fwl_hwnd_to_windex(hWnd);
938 last_key_hWnd = hWnd;
939 if(!clipboard_functions_registered){
940 fwl_set_clipboard_paste(win32_clipboard_paste);
941 fwl_set_clipboard_copy(win32_clipboard_copy);
942 clipboard_functions_registered = 1;
955 GetClientRect(hWnd, &rect);
964 fwl_setScreenDim1(rect.right, rect.bottom, windex);
967 case WM_DISPLAYCHANGE:
971 if(!fwDisplayChange())
980 fwl_doQuit(__FILE__,__LINE__);
990 ghDC = BeginPaint( hWnd, &ps );
992 EndPaint( hWnd, &ps );
1017 PostQuitMessage (0);
1026 if(msg==WM_KEYUP) updown = KEYUP;
1027 if(updown==KeyPress)
1028 if(lkeydata & 1 << 30)
1048 keyraw = (int) wParam;
1049 if(keyraw == VK_OEM_1) keyraw = (int)
';';
1050 if(updown==KEYUP && keyraw == VK_DELETE)
1051 fwl_do_rawKeyPress(DEL_KEY,KEYPRESS);
1052 actionKey = platform2web3dActionKeyWIN32(keyraw);
1054 fwl_do_rawKeyPress(actionKey,updown+10);
1056 fwl_do_rawKeyPress(keyraw,updown);
1128 keyraw = (int) wParam;
1129 fwl_do_rawKeyPress(keyraw,KEYPRESS);
1132 case WM_LBUTTONDOWN:
1136 case WM_MBUTTONDOWN:
1140 case WM_RBUTTONDOWN:
1146 mev = ButtonRelease;
1150 mev = ButtonRelease;
1154 mev = ButtonRelease;
1159 pz= MAKEPOINTS(lParam);
1165#ifndef WM_MOUSEWHEEL
1166#define WM_MOUSEWHEEL 0x020A
1179 fwKeys = GET_KEYSTATE_WPARAM(wParam);
1183 zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
1189 if( zDelta < 0 ) butnum = 4;
1190 else if(zDelta > 0) butnum = 5;
1194 fwKeys = GET_KEYSTATE_WPARAM(wParam);
1195 zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
1196 xPos = GET_X_LPARAM(lParam);
1197 yPos = GET_Y_LPARAM(lParam);
1198 printf(
"wheel delta %d CTRL=%c SHFT=%c xyPos %d %d BUT %c%c%c X%c%c\n",zDelta,
1199 fwKeys & MK_CONTROL ?
'C' :
'_',
1200 fwKeys & MK_SHIFT ?
'S' :
'_',
1203 fwKeys & MK_LBUTTON ?
'L' :
'_',
1204 fwKeys & MK_MBUTTON ?
'M' :
'_',
1205 fwKeys & MK_RBUTTON ?
'R' :
'_',
1206 fwKeys & MK_XBUTTON1 ?
'X' :
'_',
1207 fwKeys & MK_XBUTTON2 ?
'X' :
'_'
1220 #define MAXPOINTS 20
1221 static int idLookup[MAXPOINTS];
1222 static int initialized = 0;
1223 printf(
"got a WM_TOUCH index x y action\n");
1224 static TOUCHINPUT pInputs[MAXPOINTS];
1227 for(
int i=0;i<MAXPOINTS;i++) idLookup[i] = -1;
1229 cInputs = LOWORD(wParam);
1230 cInputs = min(20,cInputs);
1232 if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs,
sizeof(TOUCHINPUT))){
1233 for (
int i=0; i < (int)(cInputs); i++){
1234 int index, cursorStyle, touchAction;
1235 TOUCHINPUT ti = pInputs[i];
1236 index = GetContactIndex(ti.dwID,idLookup,MAXPOINTS);
1237 if (ti.dwID != 0 && index < MAXPOINTS){
1239 ptInput.x = TOUCH_COORD_TO_PIXEL(ti.x);
1240 ptInput.y = TOUCH_COORD_TO_PIXEL(ti.y);
1241 ScreenToClient(hWnd, &ptInput);
1242 touchAction = MotionNotify;
1243 if (ti.dwFlags & TOUCHEVENTF_UP) touchAction = ButtonRecycle;
1244 if (ti.dwFlags & TOUCHEVENTF_DOWN) touchAction = ButtonPress;
1245 if (ti.dwFlags & TOUCHEVENTF_UP){
1246 printf(
"touch up ID %d ",index);
1250 printf(
"x %d y %d ID %d ",ptInput.x,ptInput.y,index);
1254 printf(
"[%d %d %d %d]\n",index,ptInput.x,ptInput.y,touchAction);
1255 cursorStyle = fwl_handle_touch(touchAction, index, ptInput.x, ptInput.y, 0);
1260 CloseTouchInputHandle((HTOUCHINPUT)lParam);
1266 case WM_GESTURENOTIFY:
1267 onGestureNotify(hWnd);
1275 iretg = DecodeGesture(hWnd, msg, wParam, lParam);
1276 printf(
"got a WM_GESTURE\n");
1281 printf(
"got a WM_SCROLL\n");
1292 return( DefWindowProc( hWnd, msg, wParam, lParam ));
1299 cursorStyle = fwl_handle_mouse(mev, butnum, mouseX, mouseY, windex);
1300 updateCursorStyle0(cursorStyle);
1307 static int eventcount = 0;
1311 while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) == TRUE)
1313 if (GetMessage(&msg, NULL, 0, 0) )
1315 TranslateMessage(&msg);
1316 DispatchMessage(&msg);
1327void fwMessageLoop(){
1331void fv_setGeometry_from_cmdline(
const char *gstring)
1335 freewrl_params_t *params;
1336 char *str = MALLOC(
void *,
sizeof(gstring)+1);
1337 strcpy(str,gstring);
1339 for(i=0;i<(int)strlen(gstring);i++)
1340 if(str[i] ==
'x' || str[i] ==
'X')
1346 sscanf(tok[0],
"%d",&w);
1347 sscanf(tok[1],
"%d",&h);
1348 params = (freewrl_params_t *)gglobal()->display.params;
1356void setWindowTitle()
1366 ghWnd = (
void*)((freewrl_params_t *)(gglobal()->display.params))->winToEmbedInto;
1368 SetWindowText(ghWnd,getWindowTitle());
1374int fv_open_display()
1380static char *wgetpath = NULL;
1381TCHAR szPath[MAX_PATH];
1382static int wgetpathLoaded = 0;
1387 if( !GetModuleFileName( NULL, &szPath[1], MAX_PATH ) )
1389 printf(
"Cannot install service (%d)\n", GetLastError());
1394 wgetpath = &szPath[1];
1395 PathRemoveFileSpec(wgetpath);
1396 PathAppend(wgetpath,
"wget.exe");
1398 strcat(wgetpath,
"\"");
1410HWND create_main_window0(freewrl_params_t * d)
1412 HINSTANCE hInstance;
1414 static int wc_defined = 0;
1418 int width, height, xpos, ypos, wnum;
1421 int nCmdShow = SW_SHOW;
1425 hInstance = (HANDLE)GetModuleHandle(NULL);
1457 wc.lpszClassName =
"FreeWrlAppClass";
1458 wc.lpfnWndProc = PopupWndProc;
1460 wc.style = CS_OWNDC;
1461 wc.hInstance = hInstance;
1462 wc.hIcon = LoadIcon(wc.hInstance,
"APPICON");
1464 wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
1467 wc.hbrBackground = (HBRUSH)( COLOR_WINDOW+1 );
1468 wc.lpszMenuName = 0;
1472 RegisterClass( &wc );
1479 xpos = d->xpos > -1 ? d->xpos : CW_USEDEFAULT;
1480 ypos = d->ypos > -1 ? d->ypos : CW_USEDEFAULT;
1481 strcpy(appname,
"freeWRL");
1485 sprintf_s(appname, 30,
"freeWRL%d", d->wnum);
1487 if (!d->fullscreen){
1491 wStyle = WS_VISIBLE | WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION;
1492 wStyle |= WS_SIZEBOX;
1493 wStyle |= WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
1496 ghWnd = CreateWindowEx( WS_EX_APPWINDOW,
"FreeWrlAppClass", appname,
1528 if(d->touchtype == 2){
1529 RegisterTouchWindow(ghWnd, 0);
1536 ShowWindow( ghWnd, SW_SHOW);
1541 UpdateWindow(ghWnd);
1545 LONG lStyle = GetWindowLong(ghWnd, GWL_STYLE);
1546 lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
1547 SetWindowLong(ghWnd, GWL_STYLE, lStyle);
1549 lExStyle = GetWindowLong(ghWnd, GWL_EXSTYLE);
1550 lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
1551 SetWindowLong(ghWnd, GWL_EXSTYLE, lExStyle);
1553 SetWindowPos(ghWnd, HWND_TOP, d->xpos, d->ypos, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE);
1562int fv_create_main_window2(freewrl_params_t * d, freewrl_params_t *share)
1566 MessageBoxA(d->winToEmbedInto,
"You may now attach a debugger.1\n Press OK when you want to proceed.",
"dllfreeWRL plugin process(1)",MB_OK);
1568 if(!d->frontend_handles_display_thread){
1570 if( (
long)(
size_t)d->winToEmbedInto < 1)
1571 d->winToEmbedInto = (
long *)create_main_window0(d);
1573 if( d->winToEmbedInto )
1580 fv_create_and_bind_GLcontext(d);
1584 wglShareLists((HGLRC) share->context,(HGLRC) d->context);
1597void poll_game_controllers(){
1599 for (DWORD i=0; i< XUSER_MAX_COUNT; i++ )
1602 ZeroMemory( &state,
sizeof(XINPUT_STATE) );
1605 dwResult = XInputGetState( i, &state );
1607 if( dwResult == ERROR_SUCCESS )
1610 static int once = 0;
1612 printf(
"game controller connected!\n");
1619 static int once = 0;
1621 printf(
"no game controller\n");
1627void poll_game_controllers(){}
1631char *get_key_val(
char *
key);
1633void SSR_reply(
void * tg);
1634void dequeue_SSR_request(
void * tg);
1636static run_ssr = FALSE;
1639void initialize_ssr_server(){
1643 char *running_ssr = get_key_val(
"SSR");
1645 if(!strcmp(running_ssr,
"true"))
1651void poll_ssr_server(){
1654 SSR_reply(gglobal());
1655 dequeue_SSR_request(gglobal());
1660void platform_initialize_input_devices(){
1661 initialize_ssr_server();
1664void platform_poll_input_devices(){
1672 poll_game_controllers();