Window::Window(int width_a,int height_a,int Framerate_a,bool FullScreen_a,int Sample){ std::cout<<"CreatingWindow"<<std::endl; GetScreenMode(); if(width_a==0 || height_a==0){ width=(ResolutionList.back())[0]; height=(ResolutionList.back())[1]; ConsoleEcho("No preset"); ConsoleEcho("Auto Found Width:%i",width); ConsoleEcho("Auto Found Height:%i",height); }else{ width=width_a; height=height_a; std::cout<<"Size preset"<<std::endl; std::cout<<width<<std::endl; std::cout<<height<<std::endl; } MSAA_Sample=Sample; FrameRate=Framerate_a; FullScreen=FullScreen_a; ThreadStart=CreateEvent(NULL, true, 0, GenStrWithUniqueCode("WindowThreadStart",false)); ThreadClosed=CreateEvent(NULL, true, 0, GenStrWithUniqueCode("WindowThreadClosed",false)); WNDDemandAnswered=CreateEvent(NULL,0,0,GenStrWithUniqueCode("WNDDemandAnswered",false)); WNDDemandSent=CreateEvent(NULL,0,0,GenStrWithUniqueCode("WNDDemandSent",false)); WNDRenderSuspended=CreateEvent(NULL,true,0,GenStrWithUniqueCode("WNDRenderSuspended")); WNDThread=CreateThread(NULL, 0, ThreadPasser, this,0, &ThreadId); std::cout<<WaitForSingleObject(ThreadStart,INFINITE); ResetEvent(ThreadStart); ConsoleEcho("Link init"); test=6; }
Rect GetScreenRect() { Rect r; sScreenMode mode = GetScreenMode(); r.left = 0; r.right = mode.width; r.top = 0; r.bottom = mode.height; return r; }
void CoreWin32Platform::SwitchScreenToMode(eScreenMode screenMode) { if (GetScreenMode() != screenMode) // check if we try to switch mode { if (screenMode == Core::MODE_FULLSCREEN) { ToggleFullscreen(); }else if (screenMode == Core::MODE_WINDOWED) { ToggleFullscreen(); } }else { } }
void CoreMacOSPlatform::SwitchScreenToMode(eScreenMode screenMode) { if (GetScreenMode() != screenMode) // check if we try to switch mode { if (screenMode == Core::MODE_FULLSCREEN) { // [NSTimer scheduledTimerWithTimeInterval:0.01 target:mainWindowController selector:@selector(switchFullscreenTimerFired:) userInfo:nil repeats:NO]; }else if (screenMode == Core::MODE_WINDOWED) { // mainWindowController->stayInFullScreenMode = NO; } }else { Logger::Debug("[CoreMacOSPlatform::SwitchScreenToMode] Current screen mode is the same as previous. Do nothing"); } }
/** Resizes XMLterm to match a resized window. */ NS_IMETHODIMP mozXMLTerminal::Resize(void) { nsresult result; XMLT_LOG(mozXMLTerminal::Resize,20,("\n")); if (!mXMLTermSession) return NS_ERROR_FAILURE; PRBool screenMode; GetScreenMode(&screenMode); if (screenMode) { // Delay resizing until next input processing mNeedsResizing = PR_TRUE; } else { // Resize session result = mXMLTermSession->Resize(mLineTermAux); if (NS_FAILED(result)) return result; } return NS_OK; }
// Transmit string to LineTerm NS_IMETHODIMP mozXMLTerminal::SendText(const PRUnichar* aString, const PRUnichar* aCookie) { nsresult result; if (!mLineTermAux) return NS_ERROR_FAILURE; nsAutoString sendStr(aString); // Preprocess string and check if it is to be consumed PRBool consumed, checkSize; result = mXMLTermSession->Preprocess(sendStr, consumed, checkSize); PRBool screenMode; GetScreenMode(&screenMode); if (!screenMode && (checkSize || mNeedsResizing)) { // Resize terminal, if need be mXMLTermSession->Resize(mLineTermAux); mNeedsResizing = PR_FALSE; } if (!consumed) { result = mLineTermAux->Write(sendStr.get(), aCookie); if (NS_FAILED(result)) { // Abort XMLterm session nsAutoString abortCode; abortCode.AssignLiteral("SendText"); mXMLTermSession->Abort(mLineTermAux, abortCode); return NS_ERROR_FAILURE; } } return NS_OK; }
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int nshowcmd) { //*********************************************** // Convert WinMain() style command line arguments // to main() style arguments (argc, *argv[]) // This maintains compatibility with the former // main() entry point's parameters. //*********************************************** char **argv = NULL; int argc = 1; char *app_path = new char[MAX_PATH]; strcpy(app_path, GetCommandLine()); if (app_path[0] == '\"') { app_path = (app_path+1); char *lastdit = strchr(app_path, '\"'); *lastdit = '\x0'; } if ( *lpcmdline != '\x0' ) { char *cmdlinecopy = new char[strlen(lpcmdline)+1]; strcpy(cmdlinecopy, lpcmdline); char *c = cmdlinecopy; while(c) { ++argc; c = strchr((c+1),' '); } argv = new char*[argc]; argv[0] = app_path; if(argc > 1) { argv[1] = cmdlinecopy; char *c = strchr(cmdlinecopy, ' '); int n = 2; while(c) { *c = '\x0'; argv [n] = (c+1); ++n; c = strchr((c+1), ' '); } } } else { argv = new char *[1]; argv[0] = app_path; } //********************************************* // Process commandline and activate console // if -console switch is set. //********************************************* int i,j; for (i = j = 1; i < argc; i++) { if (strcmp(argv[i], "-console") == 0) { useconsole = TRUE; } else if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; } } if (useconsole || help_only) { AllocConsole(); // start a console window freopen("CONIN$","rb",stdin); // reopen stdin handle as console window input freopen("CONOUT$","wb",stdout); // reopen stout handle as console window output freopen("CONOUT$","wb",stderr); // reopen stderr handle as console window output } else // not using console { // console is supressed, so stream console output to a file stdout_stream = freopen("atari800.txt", "w", stdout); if (stdout_stream == NULL) fprintf(stdout, "Error opening atari800.txt\n"); } //********************************************* // Begin main processing //********************************************* MSG msg; POINT mouse; Win32_Init(); myInstance = GetModuleHandle(NULL); if (help_only) { /* initialize the Atari800 for help only */ Atari800_Initialise(&argc, argv); Log_print("\t-console Show the Atari800 console window"); Log_print("\n"); system("PAUSE"); return 0; } /* initialise Atari800 core for use */ if (!Atari800_Initialise(&argc, argv)) return 3; msg.message = WM_NULL; /* main loop */ for (;;) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if (msg.message == WM_QUIT) break; if (!bActive) continue; INPUT_key_code = PLATFORM_Keyboard(); // support mouse device modes // only supported in fullscreen modes for now if (GetScreenMode() == FULLSCREEN) { GetCursorPos(&mouse); INPUT_mouse_delta_x = mouse.x - MOUSE_CENTER_X; INPUT_mouse_delta_y = mouse.y - MOUSE_CENTER_Y; if (INPUT_mouse_delta_x | INPUT_mouse_delta_y) SetCursorPos(MOUSE_CENTER_X, MOUSE_CENTER_Y); } Atari800_Frame(); if (Atari800_display_screen) PLATFORM_DisplayScreen(); } return msg.wParam; }