|
|
| version 1.20, 2003/10/25 16:07:34 | version 1.21, 2003/10/25 16:52:58 |
|---|---|
| Line 74 static const char np2resume[] = "sav"; | Line 74 static const char np2resume[] = "sav"; |
| #endif | #endif |
| static void setUpCarbonEvent(void); | static void setUpCarbonEvent(void); |
| static bool setupMainWindow(void); | |
| static void toggleFullscreen(void); | |
| #ifdef TARGET_API_MAC_CARBON | #ifdef TARGET_API_MAC_CARBON |
| static pascal OSErr handleQuitApp(const AppleEvent *event, AppleEvent *reply, | static pascal OSErr handleQuitApp(const AppleEvent *event, AppleEvent *reply, |
| Line 136 static void MenuBarInit(void) { | Line 138 static void MenuBarInit(void) { |
| } | } |
| static void changescreen(BYTE mode) { | static void changescreen(BYTE mode) { |
| #if 0 | |
| (void)mode; | (void)mode; |
| #endif | |
| BYTE change; | |
| BYTE renewal; | |
| change = scrnmode ^ mode; | |
| renewal = (change & SCRNMODE_FULLSCREEN); | |
| if (mode & SCRNMODE_FULLSCREEN) { | |
| renewal |= (change & SCRNMODE_HIGHCOLOR); | |
| } | |
| else { | |
| renewal |= (change & SCRNMODE_ROTATEMASK); | |
| } | |
| if (renewal) { | |
| soundmng_stop(); | |
| mouse_running(MOUSE_STOP); | |
| scrnmng_destroy(); | |
| if (scrnmng_create(mode) == SUCCESS) { | |
| scrnmode = mode; | |
| } | |
| scrndraw_redraw(); | |
| mouse_running(MOUSE_CONT); | |
| soundmng_play(); | |
| } | |
| else { | |
| scrnmode = mode; | |
| } | |
| } | } |
| static void HandleMenuChoice(long wParam) { | static void HandleMenuChoice(long wParam) { |
| Line 211 static void HandleMenuChoice(long wParam | Line 240 static void HandleMenuChoice(long wParam |
| diskdrv_sethdd(1, NULL); | diskdrv_sethdd(1, NULL); |
| break; | break; |
| case IDM_FULLSCREEN: | |
| toggleFullscreen(); | |
| break; | |
| case IDM_ROLNORMAL: | case IDM_ROLNORMAL: |
| menu_setrotate(0); | menu_setrotate(0); |
| changescreen(scrnmode & (~SCRNMODE_ROTATEMASK)); | changescreen(scrnmode & (~SCRNMODE_ROTATEMASK)); |
| Line 277 static void HandleMenuChoice(long wParam | Line 310 static void HandleMenuChoice(long wParam |
| mouse_running(MOUSE_XOR); | mouse_running(MOUSE_XOR); |
| menu_setmouse(np2oscfg.MOUSE_SW ^ 1); | menu_setmouse(np2oscfg.MOUSE_SW ^ 1); |
| sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); |
| toggleMenubar(); | |
| break; | break; |
| #endif | #endif |
| Line 657 static void openingNP2(void) { | Line 691 static void openingNP2(void) { |
| int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { |
| Rect wRect; | |
| #if 0 | #if 0 |
| Rect wRect; | |
| EventRecord event; | EventRecord event; |
| #endif | #endif |
| EventRef theEvent; | EventRef theEvent; |
| Line 678 int main(int argc, char *argv[]) { | Line 712 int main(int argc, char *argv[]) { |
| TRACEINIT(); | TRACEINIT(); |
| #if 0 | |
| SetRect(&wRect, 100, 100, 100, 100); | SetRect(&wRect, 100, 100, 100, 100); |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, | hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | noGrowDocProc, (WindowPtr)-1, TRUE, 0); |
| Line 691 int main(int argc, char *argv[]) { | Line 726 int main(int argc, char *argv[]) { |
| SizeWindow(hWndMain, 640, 400, TRUE); | SizeWindow(hWndMain, 640, 400, TRUE); |
| setUpCarbonEvent(); | setUpCarbonEvent(); |
| ShowWindow(hWndMain); | ShowWindow(hWndMain); |
| #endif | |
| if (!(setupMainWindow())) { | |
| return(0); | |
| } | |
| #ifdef NP2OPENING | #ifdef NP2OPENING |
| openingNP2(); | openingNP2(); |
| #endif | #endif |
| Line 830 int main(int argc, char *argv[]) { | Line 870 int main(int argc, char *argv[]) { |
| } | } |
| np2running = FALSE; | np2running = FALSE; |
| if (scrnmode & SCRNMODE_FULLSCREEN) { | |
| toggleFullscreen(); | |
| } | |
| pccore_cfgupdate(); | pccore_cfgupdate(); |
| #if defined(USE_RESUME) | #if defined(USE_RESUME) |
| Line 964 static pascal OSStatus np2windowevent(Ev | Line 1008 static pascal OSStatus np2windowevent(Ev |
| np2running = FALSE; | np2running = FALSE; |
| result = noErr; | result = noErr; |
| } | } |
| else if (whatHappened == kEventWindowShowing) { | |
| scrndraw_redraw(); | |
| } | |
| break; | break; |
| case kEventClassKeyboard: | case kEventClassKeyboard: |
| UInt32 key; | UInt32 key; |
| Line 1027 static const EventTypeSpec appEventList[ | Line 1074 static const EventTypeSpec appEventList[ |
| static const EventTypeSpec windEventList[] = { | static const EventTypeSpec windEventList[] = { |
| {kEventClassWindow, kEventWindowClose}, | {kEventClassWindow, kEventWindowClose}, |
| {kEventClassWindow, kEventWindowShowing}, | |
| {kEventClassKeyboard, kEventRawKeyDown}, | {kEventClassKeyboard, kEventRawKeyDown}, |
| {kEventClassKeyboard, kEventRawKeyUp}, | {kEventClassKeyboard, kEventRawKeyUp}, |
| {kEventClassKeyboard, kEventRawKeyRepeat}, | {kEventClassKeyboard, kEventRawKeyRepeat}, |
| Line 1045 static void setUpCarbonEvent(void) { | Line 1093 static void setUpCarbonEvent(void) { |
| windEventList, 0, NULL); | windEventList, 0, NULL); |
| } | } |
| bool setupMainWindow(void) { | |
| #if defined(NP2GCC) && 0 | |
| #else | |
| Rect wRect; | |
| SetRect(&wRect, 100, 100, 100, 100); | |
| hWndMain = NewWindow(0, &wRect, "\pNeko Project II", FALSE, | |
| noGrowDocProc, (WindowPtr)-1, TRUE, 0); | |
| if (!hWndMain) { | |
| TRACETERM(); | |
| macossub_term(); | |
| dosio_term(); | |
| return(false); | |
| } | |
| SizeWindow(hWndMain, 640, 400, TRUE); | |
| #endif | |
| scrnmng_initialize(); | |
| setUpCarbonEvent(); | |
| ShowWindow(hWndMain); | |
| return(true); | |
| } | |
| static void toggleFullscreen(void) { | |
| static Ptr bkfullscreen; | |
| static BYTE mouse = 0; | |
| soundmng_stop(); | |
| if (!scrnmode & SCRNMODE_FULLSCREEN) { | |
| RGBColor col = {0, 0, 0}; | |
| short w=640, h=480; | |
| DisposeWindow(hWndMain); | |
| BeginFullScreen(&bkfullscreen,0,&w,&h,&hWndMain,&col,(fullScreenAllowEvents | fullScreenDontChangeMenuBar)); | |
| HideMenuBar(); | |
| setUpCarbonEvent(); | |
| if (!np2oscfg.MOUSE_SW) { | |
| mouse = np2oscfg.MOUSE_SW; | |
| mouse_running(MOUSE_ON); | |
| menu_setmouse(1); | |
| } | |
| changescreen(scrnmode | SCRNMODE_FULLSCREEN); | |
| } | |
| else { | |
| scrnmng_destroy(); | |
| EndFullScreen(bkfullscreen, 0); | |
| setupMainWindow(); | |
| changescreen(scrnmode & (~SCRNMODE_FULLSCREEN)); | |
| if (!mouse) { | |
| mouse_running(MOUSE_OFF); | |
| menu_setmouse(0); | |
| } | |
| ShowMenuBar(); | |
| } | |
| CheckMenuItem(GetMenuHandle(IDM_SCREEN), LoWord(IDM_FULLSCREEN), scrnmode & SCRNMODE_FULLSCREEN); | |
| soundmng_play(); | |
| } | |
| void toggleMenubar(void) { | |
| if (scrnmode & SCRNMODE_FULLSCREEN) { | |
| if (!np2oscfg.MOUSE_SW) { | |
| ShowMenuBar(); | |
| } | |
| else { | |
| HideMenuBar(); | |
| } | |
| } | |
| } | |