|
|
| version 1.24, 2007/01/08 07:52:01 | version 1.26, 2007/11/11 12:46:07 |
|---|---|
| Line 236 static void renewalclientsize(BOOL winlo | Line 236 static void renewalclientsize(BOOL winlo |
| wlex = NULL; | wlex = NULL; |
| if (winloc) { | if (winloc) { |
| wlex = np2_winlocexallwin(hWndMain); | wlex = np2_winlocexallwin(g_hWndMain); |
| } | } |
| winlocex_setholdwnd(wlex, hWndMain); | winlocex_setholdwnd(wlex, g_hWndMain); |
| setwindowsize(hWndMain, scrnwidth, scrnheight); | setwindowsize(g_hWndMain, scrnwidth, scrnheight); |
| winlocex_move(wlex); | winlocex_move(wlex); |
| winlocex_destroy(wlex); | winlocex_destroy(wlex); |
| } | } |
| Line 297 static void clearoutscreen(void) { | Line 297 static void clearoutscreen(void) { |
| POINT clipt; | POINT clipt; |
| RECT target; | RECT target; |
| GetClientRect(hWndMain, &base); | GetClientRect(g_hWndMain, &base); |
| clipt.x = 0; | clipt.x = 0; |
| clipt.y = 0; | clipt.y = 0; |
| ClientToScreen(hWndMain, &clipt); | ClientToScreen(g_hWndMain, &clipt); |
| base.left += clipt.x; | base.left += clipt.x; |
| base.top += clipt.y; | base.top += clipt.y; |
| base.right += clipt.x; | base.right += clipt.x; |
| Line 321 const RECT *scrn; | Line 321 const RECT *scrn; |
| base.top = 0; | base.top = 0; |
| base.right = ddraw.width; | base.right = ddraw.width; |
| base.bottom = ddraw.height; | base.bottom = ddraw.height; |
| if (GetWindowLongPtr(hWndMain, NP2GWLP_HMENU)) { | if (GetWindowLongPtr(g_hWndMain, NP2GWLP_HMENU)) { |
| scrn = &ddraw.scrn; | scrn = &ddraw.scrn; |
| base.top = 0; | base.top = 0; |
| } | } |
| Line 340 static void paletteinit(void) { | Line 340 static void paletteinit(void) { |
| HDC hdc; | HDC hdc; |
| UINT i; | UINT i; |
| hdc = GetDC(hWndMain); | hdc = GetDC(g_hWndMain); |
| GetSystemPaletteEntries(hdc, 0, 256, ddraw.pal); | GetSystemPaletteEntries(hdc, 0, 256, ddraw.pal); |
| ReleaseDC(hWndMain, hdc); | ReleaseDC(g_hWndMain, hdc); |
| #if defined(SUPPORT_DCLOCK) | #if defined(SUPPORT_DCLOCK) |
| for (i=0; i<4; i++) { | for (i=0; i<4; i++) { |
| ddraw.pal[i+START_PALORG].peBlue = dclockpal.pal32[i].p.b; | ddraw.pal[i+START_PALORG].peBlue = dclockpal.pal32[i].p.b; |
| Line 411 void scrnmng_initialize(void) { | Line 411 void scrnmng_initialize(void) { |
| scrnstat.height = 400; | scrnstat.height = 400; |
| scrnstat.extend = 1; | scrnstat.extend = 1; |
| scrnstat.multiple = 8; | scrnstat.multiple = 8; |
| setwindowsize(hWndMain, 640, 400); | setwindowsize(g_hWndMain, 640, 400); |
| } | } |
| BRESULT scrnmng_create(UINT8 scrnmode) { | BRESULT scrnmng_create(UINT8 scrnmode) { |
| Line 429 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 429 BRESULT scrnmng_create(UINT8 scrnmode) { |
| DEVMODE devmode; | DEVMODE devmode; |
| ZeroMemory(&scrnmng, sizeof(scrnmng)); | ZeroMemory(&scrnmng, sizeof(scrnmng)); |
| winstyle = GetWindowLong(hWndMain, GWL_STYLE); | winstyle = GetWindowLong(g_hWndMain, GWL_STYLE); |
| winstyleex = GetWindowLong(hWndMain, GWL_EXSTYLE); | winstyleex = GetWindowLong(g_hWndMain, GWL_EXSTYLE); |
| hmenu = GetMenu(hWndMain); | hmenu = GetMenu(g_hWndMain); |
| if (scrnmode & SCRNMODE_FULLSCREEN) { | if (scrnmode & SCRNMODE_FULLSCREEN) { |
| scrnmode &= ~SCRNMODE_ROTATEMASK; | scrnmode &= ~SCRNMODE_ROTATEMASK; |
| scrnmng.flag = SCRNFLAG_FULLSCREEN; | scrnmng.flag = SCRNFLAG_FULLSCREEN; |
| Line 442 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 442 BRESULT scrnmng_create(UINT8 scrnmode) { |
| CheckMenuItem(hmenu, IDM_FULLSCREEN, MF_CHECKED); | CheckMenuItem(hmenu, IDM_FULLSCREEN, MF_CHECKED); |
| ddraw.menudisp = 0; | ddraw.menudisp = 0; |
| ddraw.menusize = GetSystemMetrics(SM_CYMENU); | ddraw.menusize = GetSystemMetrics(SM_CYMENU); |
| np2class_enablemenu(hWndMain, FALSE); | np2class_enablemenu(g_hWndMain, FALSE); |
| } | } |
| else { | else { |
| scrnmng.flag = SCRNFLAG_HAVEEXTEND; | scrnmng.flag = SCRNFLAG_HAVEEXTEND; |
| Line 458 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 458 BRESULT scrnmng_create(UINT8 scrnmode) { |
| CheckMenuItem(hmenu, IDM_WINDOW, MF_CHECKED); | CheckMenuItem(hmenu, IDM_WINDOW, MF_CHECKED); |
| CheckMenuItem(hmenu, IDM_FULLSCREEN, MF_UNCHECKED); | CheckMenuItem(hmenu, IDM_FULLSCREEN, MF_UNCHECKED); |
| } | } |
| SetWindowLong(hWndMain, GWL_STYLE, winstyle); | SetWindowLong(g_hWndMain, GWL_STYLE, winstyle); |
| SetWindowLong(hWndMain, GWL_EXSTYLE, winstyleex); | SetWindowLong(g_hWndMain, GWL_EXSTYLE, winstyleex); |
| if (DirectDrawCreate(NULL, &ddraw.ddraw1, NULL) != DD_OK) { | if (DirectDrawCreate(NULL, &ddraw.ddraw1, NULL) != DD_OK) { |
| goto scre_err; | goto scre_err; |
| Line 471 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 471 BRESULT scrnmng_create(UINT8 scrnmode) { |
| #if defined(SUPPORT_DCLOCK) | #if defined(SUPPORT_DCLOCK) |
| dclock_init(); | dclock_init(); |
| #endif | #endif |
| ddraw2->SetCooperativeLevel(hWndMain, | ddraw2->SetCooperativeLevel(g_hWndMain, |
| DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); |
| width = np2oscfg.fscrn_cx; | width = np2oscfg.fscrn_cx; |
| height = np2oscfg.fscrn_cy; | height = np2oscfg.fscrn_cy; |
| Line 502 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 502 BRESULT scrnmng_create(UINT8 scrnmode) { |
| goto scre_err; | goto scre_err; |
| } | } |
| ddraw2->CreateClipper(0, &ddraw.clipper, NULL); | ddraw2->CreateClipper(0, &ddraw.clipper, NULL); |
| ddraw.clipper->SetHWnd(0, hWndMain); | ddraw.clipper->SetHWnd(0, g_hWndMain); |
| ZeroMemory(&ddsd, sizeof(ddsd)); | ZeroMemory(&ddsd, sizeof(ddsd)); |
| ddsd.dwSize = sizeof(ddsd); | ddsd.dwSize = sizeof(ddsd); |
| Line 554 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 554 BRESULT scrnmng_create(UINT8 scrnmode) { |
| #endif | #endif |
| } | } |
| else { | else { |
| ddraw2->SetCooperativeLevel(hWndMain, DDSCL_NORMAL); | ddraw2->SetCooperativeLevel(g_hWndMain, DDSCL_NORMAL); |
| ZeroMemory(&ddsd, sizeof(ddsd)); | ZeroMemory(&ddsd, sizeof(ddsd)); |
| ddsd.dwSize = sizeof(ddsd); | ddsd.dwSize = sizeof(ddsd); |
| Line 565 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 565 BRESULT scrnmng_create(UINT8 scrnmode) { |
| } | } |
| ddraw2->CreateClipper(0, &ddraw.clipper, NULL); | ddraw2->CreateClipper(0, &ddraw.clipper, NULL); |
| ddraw.clipper->SetHWnd(0, hWndMain); | ddraw.clipper->SetHWnd(0, g_hWndMain); |
| ddraw.primsurf->SetClipper(ddraw.clipper); | ddraw.primsurf->SetClipper(ddraw.clipper); |
| ZeroMemory(&ddpf, sizeof(ddpf)); | ZeroMemory(&ddpf, sizeof(ddpf)); |
| Line 615 BRESULT scrnmng_create(UINT8 scrnmode) { | Line 615 BRESULT scrnmng_create(UINT8 scrnmode) { |
| ddraw.height = height; | ddraw.height = height; |
| ddraw.cliping = 0; | ddraw.cliping = 0; |
| renewalclientsize(FALSE); | renewalclientsize(FALSE); |
| screenupdate = 3; // update! | // screenupdate = 3; // update! |
| return(SUCCESS); | return(SUCCESS); |
| scre_err: | scre_err: |
| Line 626 scre_err: | Line 626 scre_err: |
| void scrnmng_destroy(void) { | void scrnmng_destroy(void) { |
| if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { | if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { |
| np2class_enablemenu(hWndMain, (!np2oscfg.wintype)); | np2class_enablemenu(g_hWndMain, (!np2oscfg.wintype)); |
| } | } |
| #if defined(SUPPORT_DCLOCK) | #if defined(SUPPORT_DCLOCK) |
| if (ddraw.clocksurf) { | if (ddraw.clocksurf) { |
| Line 652 void scrnmng_destroy(void) { | Line 652 void scrnmng_destroy(void) { |
| } | } |
| if (ddraw.ddraw2) { | if (ddraw.ddraw2) { |
| if (ddraw.scrnmode & SCRNMODE_FULLSCREEN) { | if (ddraw.scrnmode & SCRNMODE_FULLSCREEN) { |
| ddraw.ddraw2->SetCooperativeLevel(hWndMain, DDSCL_NORMAL); | ddraw.ddraw2->SetCooperativeLevel(g_hWndMain, DDSCL_NORMAL); |
| } | } |
| ddraw.ddraw2->Release(); | ddraw.ddraw2->Release(); |
| ddraw.ddraw2 = NULL; | ddraw.ddraw2 = NULL; |
| Line 689 void scrnmng_fullscrnmenu(int y) { | Line 689 void scrnmng_fullscrnmenu(int y) { |
| if (ddraw.menudisp != menudisp) { | if (ddraw.menudisp != menudisp) { |
| ddraw.menudisp = menudisp; | ddraw.menudisp = menudisp; |
| if (menudisp == 1) { | if (menudisp == 1) { |
| np2class_enablemenu(hWndMain, TRUE); | np2class_enablemenu(g_hWndMain, TRUE); |
| } | } |
| else { | else { |
| np2class_enablemenu(hWndMain, FALSE); | np2class_enablemenu(g_hWndMain, FALSE); |
| clearoutfullscreen(); | clearoutfullscreen(); |
| } | } |
| } | } |
| Line 707 void scrnmng_topwinui(void) { | Line 707 void scrnmng_topwinui(void) { |
| ddraw.primsurf->SetClipper(ddraw.clipper); | ddraw.primsurf->SetClipper(ddraw.clipper); |
| } | } |
| #ifndef __GNUC__ | #ifndef __GNUC__ |
| WINNLSEnableIME(hWndMain, TRUE); | WINNLSEnableIME(g_hWndMain, TRUE); |
| #endif | #endif |
| } | } |
| } | } |
| Line 716 void scrnmng_clearwinui(void) { | Line 716 void scrnmng_clearwinui(void) { |
| if ((ddraw.cliping > 0) && (!(--ddraw.cliping))) { | if ((ddraw.cliping > 0) && (!(--ddraw.cliping))) { |
| #ifndef __GNUC__ | #ifndef __GNUC__ |
| WINNLSEnableIME(hWndMain, FALSE); | WINNLSEnableIME(g_hWndMain, FALSE); |
| #endif | #endif |
| if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { | if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { |
| ddraw.primsurf->SetClipper(0); | ddraw.primsurf->SetClipper(0); |
| } | } |
| } | } |
| if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { | if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { |
| np2class_enablemenu(hWndMain, FALSE); | np2class_enablemenu(g_hWndMain, FALSE); |
| clearoutfullscreen(); | clearoutfullscreen(); |
| ddraw.menudisp = 0; | ddraw.menudisp = 0; |
| } | } |
| else { | else { |
| if (np2oscfg.wintype) { | if (np2oscfg.wintype) { |
| np2class_enablemenu(hWndMain, FALSE); | np2class_enablemenu(g_hWndMain, FALSE); |
| InvalidateRect(hWndMain, NULL, TRUE); | InvalidateRect(g_hWndMain, NULL, TRUE); |
| } | } |
| } | } |
| mousemng_enable(MOUSEPROC_WINUI); | mousemng_enable(MOUSEPROC_WINUI); |
| Line 818 void scrnmng_update(void) { | Line 818 void scrnmng_update(void) { |
| scrnmng.allflash = 0; | scrnmng.allflash = 0; |
| clearoutfullscreen(); | clearoutfullscreen(); |
| } | } |
| if (GetWindowLongPtr(hWndMain, NP2GWLP_HMENU)) { | if (GetWindowLongPtr(g_hWndMain, NP2GWLP_HMENU)) { |
| rect = &ddraw.rect; | rect = &ddraw.rect; |
| scrn = &ddraw.scrn; | scrn = &ddraw.scrn; |
| } | } |
| Line 842 void scrnmng_update(void) { | Line 842 void scrnmng_update(void) { |
| } | } |
| clip.x = 0; | clip.x = 0; |
| clip.y = 0; | clip.y = 0; |
| ClientToScreen(hWndMain, &clip); | ClientToScreen(g_hWndMain, &clip); |
| dst.left = clip.x + ddraw.scrn.left; | dst.left = clip.x + ddraw.scrn.left; |
| dst.top = clip.y + ddraw.scrn.top; | dst.top = clip.y + ddraw.scrn.top; |
| dst.right = clip.x + ddraw.scrn.right; | dst.right = clip.x + ddraw.scrn.right; |
| Line 897 const RECT *scrn; | Line 897 const RECT *scrn; |
| if (!dclock_disp()) { | if (!dclock_disp()) { |
| return; | return; |
| } | } |
| if (GetWindowLongPtr(hWndMain, NP2GWLP_HMENU)) { | if (GetWindowLongPtr(g_hWndMain, NP2GWLP_HMENU)) { |
| scrn = &ddraw.scrn; | scrn = &ddraw.scrn; |
| } | } |
| else { | else { |
| Line 959 void scrnmng_entersizing(void) { | Line 959 void scrnmng_entersizing(void) { |
| int cx; | int cx; |
| int cy; | int cy; |
| GetWindowRect(hWndMain, &rectwindow); | GetWindowRect(g_hWndMain, &rectwindow); |
| GetClientRect(hWndMain, &rectclient); | GetClientRect(g_hWndMain, &rectclient); |
| scrnsizing.bx = (np2oscfg.paddingx * 2) + | scrnsizing.bx = (np2oscfg.paddingx * 2) + |
| (rectwindow.right - rectwindow.left) - | (rectwindow.right - rectwindow.left) - |
| (rectclient.right - rectclient.left); | (rectclient.right - rectclient.left); |
| Line 1051 void scrnmng_exitsizing(void) { | Line 1051 void scrnmng_exitsizing(void) { |
| sysmenu_setscrnmul(scrnsizing.mul); | sysmenu_setscrnmul(scrnsizing.mul); |
| scrnmng_setmultiple(scrnsizing.mul); | scrnmng_setmultiple(scrnsizing.mul); |
| InvalidateRect(hWndMain, NULL, TRUE); // ugh | InvalidateRect(g_hWndMain, NULL, TRUE); // ugh |
| } | } |