//! constructor CIrrDeviceMarmalade::CIrrDeviceMarmalade(const SIrrlichtCreationParameters& param) : CIrrDeviceStub(param), Paused(false) { initKeyMap(); CursorControl = new CMarmaladeCursor(this); //video::SExposedVideoData data; SIrrlichtCreationParameters params = param; params.WindowSize.Width = s3eSurfaceGetInt(S3E_SURFACE_WIDTH); params.WindowSize.Height = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT); int32 glver = s3eGLGetInt(S3E_GL_VERSION); if(glver >= 0x200) VideoDriver = video::createOGLES2Driver(params, FileSystem); else VideoDriver = video::createOGLES1Driver(params, FileSystem); glViewport(0, 0, params.WindowSize.Width, params.WindowSize.Height); if (VideoDriver) createGUIAndScene(); s3eDeviceRegister(S3E_DEVICE_EXIT, &do_Exit, this); s3eDeviceRegister(S3E_DEVICE_PAUSE, &do_Pause, this); s3eDeviceRegister(S3E_DEVICE_UNPAUSE, &do_Unpause, this); s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, &do_KeyEvent, this); s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, &do_CharEvent, this); }
//! constructor CIrrDevicePS3::CIrrDevicePS3(const SIrrlichtCreationParameters& param): CIrrDeviceStub(param), Width(param.WindowSize.Width), Height(param.WindowSize.Height), WindowHasFocus(false), WindowMinimized(false), UseXVidMode(false), UseXRandR(false), UseGLXWindow(false), ExternalWindow(false), AutorepeatSupport(0) { #ifdef _DEBUG setDebugName("CIrrDevicePS3"); #endif // create keymap createKeyMap(); // create window if (CreationParams.DriverType != video::EDT_NULL) { // create the window, only if we do not use the null device if (!createWindow()) return; } // create cursor control CursorControl = new CCursorControl(this, CreationParams.DriverType == video::EDT_NULL); // create driver createDriver(); if (!VideoDriver) return; createGUIAndScene(); }
//! constructor CIrrDeviceNaCl::CIrrDeviceNaCl(const SIrrlichtCreationParameters& params) : CIrrDeviceStub(params) { createDriver(); if (VideoDriver) createGUIAndScene(); }
//! constructor CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& params, const char* dataPak) : CIrrDeviceStub(params, dataPak) { // create driver createDriver(); if (!VideoDriver) return; createGUIAndScene(); static CAndroidCursor s_cursor; core::rect<s32> winRect(0,0,params.WindowSize.Width, params.WindowSize.Height); s_cursor.setReferenceRect(&winRect); CursorControl = &s_cursor; }
//! constructor CIrrDeviceFB::CIrrDeviceFB(const SIrrlichtCreationParameters& params, const char* dataPak) : CIrrDeviceStub(params, dataPak), Framebuffer(-1), EventDevice(-1), SoftwareImage(0), Pitch(0), FBColorFormat(video::ECF_A8R8G8B8), Close(false) { #ifdef _DEBUG setDebugName("CIrrDeviceFB"); #endif // print version, distribution etc. // thx to LynxLuna for pointing me to the uname function core::stringc linuxversion; struct utsname FBInfo; uname(&FBInfo); linuxversion += FBInfo.sysname; linuxversion += " "; linuxversion += FBInfo.release; linuxversion += " "; linuxversion += FBInfo.version; linuxversion += " "; linuxversion += FBInfo.machine; Operator = new COSOperator(linuxversion); os::Printer::log(linuxversion.c_str(), ELL_INFORMATION); // create window if (params.DriverType != video::EDT_NULL) { // create the window, only if we do not use the null device if (!createWindow(params.WindowSize, params.Bits)) return; } // create cursor control CursorControl = new CCursorControl(this, params.DriverType == video::EDT_NULL); // create driver createDriver(); if (!VideoDriver) return; createGUIAndScene(); }
//! constructor CIrrDeviceBB10::CIrrDeviceBB10(const SIrrlichtCreationParameters& param) : CIrrDeviceStub(param), bspScreenWindow((screen_window_t)param.WindowId), MouseX(0), MouseY(0), MouseButtonStates(0), Width(param.WindowSize.Width), Height(param.WindowSize.Height), Resizable(false), WindowHasFocus(true), WindowMinimized(false) { #ifdef _DEBUG setDebugName("CIrrDeviceBB10"); #endif // Initialize SDL... Timer for sleep, video for the obvious, and // noparachute prevents SDL from catching fatal errors. if (bps_initialize() !=BPS_SUCCESS) { os::Printer::log( "Unable to initialize BSP !"); Close = true; } //create screen context screen_create_context(&bspScreenCtx, 0); core::stringc devVersion = "BB10 Version "; Operator = new COSOperator(devVersion); os::Printer::log(devVersion.c_str(), ELL_INFORMATION); // create keymap createKeyMap(); // create window if (CreationParams.DriverType != video::EDT_NULL) { // create the window, only if we do not use the null device createWindow(); } // create cursor control CursorControl = new CCursorControl(this); // create driver createDriver(); if (VideoDriver) createGUIAndScene(); }
//! constructor CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params, const char* dataPak) : CIrrDeviceStub(params, dataPak), IsWindowFocused(true), ConsoleFont(0), OutFile(stdout) { DeviceToClose = this; #ifdef _IRR_WINDOWS_NT_CONSOLE_ MouseButtonStates = 0; WindowsSTDIn = GetStdHandle(STD_INPUT_HANDLE); WindowsSTDOut = GetStdHandle(STD_OUTPUT_HANDLE); PCOORD Dimensions = 0; if (CreationParams.Fullscreen) { // Some mingw versions lack this define, so avoid it in case it does not exist #if (_WIN32_WINNT >= 0x0501) && defined(CONSOLE_FULLSCREEN_MODE) if (SetConsoleDisplayMode(WindowsSTDOut, CONSOLE_FULLSCREEN_MODE, Dimensions)) { CreationParams.WindowSize.Width = Dimensions->X; CreationParams.WindowSize.Width = Dimensions->Y; } #endif } else { COORD ConsoleSize; ConsoleSize.X = CreationParams.WindowSize.Width; ConsoleSize.X = CreationParams.WindowSize.Height; SetConsoleScreenBufferSize(WindowsSTDOut, ConsoleSize); } // catch windows close/break signals SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE); #elif defined(_IRR_POSIX_API_) // catch other signals signal(SIGABRT, &sighandler); signal(SIGTERM, &sighandler); signal(SIGINT, &sighandler); // set output stream if (params.WindowId) OutFile = (FILE*)(params.WindowId); #endif #ifdef _IRR_VT100_CONSOLE_ // reset terminal fprintf(OutFile, "%cc", 27); // disable line wrapping fprintf(OutFile, "%c[7l", 27); #endif switch (params.DriverType) { case video::EDT_SOFTWARE: #ifdef _IRR_COMPILE_WITH_SOFTWARE_ VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this); #else os::Printer::log("Software driver was not compiled in.", ELL_ERROR); #endif break; case video::EDT_BURNINGSVIDEO: #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this); #else os::Printer::log("Burning's Video driver was not compiled in.", ELL_ERROR); #endif break; case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D9: case video::EDT_OPENGL: os::Printer::log("The console device cannot use hardware drivers yet.", ELL_ERROR); break; case video::EDT_NULL: VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize); break; default: break; } // set up output buffer for (u32 y=0; y<CreationParams.WindowSize.Height; ++y) { core::stringc str; str.reserve(CreationParams.WindowSize.Width); for (u32 x=0; x<CreationParams.WindowSize.Width; ++x) str += " "; OutputBuffer.push_back(str); } #ifdef _IRR_WINDOWS_NT_CONSOLE_ CursorControl = new CCursorControl(CreationParams.WindowSize); #endif if (VideoDriver) { createGUIAndScene(); #ifdef _IRR_USE_CONSOLE_FONT_ if (GUIEnvironment) { ConsoleFont = new gui::CGUIConsoleFont(this); gui::IGUISkin *skin = GUIEnvironment->getSkin(); if (skin) { for (u32 i=0; i < gui::EGDF_COUNT; ++i) skin->setFont(ConsoleFont, gui::EGUI_DEFAULT_FONT(i)); } } #endif } }
//! constructor CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) : CIrrDeviceStub(param), Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_ANYFORMAT), MouseX(0), MouseY(0), MouseButtonStates(0), Width(param.WindowSize.Width), Height(param.WindowSize.Height), Resizable(false), WindowHasFocus(false), WindowMinimized(false) { #ifdef _DEBUG setDebugName("CIrrDeviceSDL"); #endif // Initialize SDL... Timer for sleep, video for the obvious, and // noparachute prevents SDL from catching fatal errors. if (SDL_Init( SDL_INIT_TIMER|SDL_INIT_VIDEO| #if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) SDL_INIT_JOYSTICK| #endif SDL_INIT_NOPARACHUTE ) < 0) { os::Printer::log( "Unable to initialize SDL!", SDL_GetError()); Close = true; } #if defined(_IRR_WINDOWS_) SDL_putenv("SDL_VIDEODRIVER=directx"); #elif defined(_IRR_OSX_PLATFORM_) SDL_putenv("SDL_VIDEODRIVER=Quartz"); #else SDL_putenv("SDL_VIDEODRIVER=x11"); #endif // SDL_putenv("SDL_WINDOWID="); SDL_VERSION(&Info.version); SDL_GetWMInfo(&Info); core::stringc sdlversion = "SDL Version "; sdlversion += Info.version.major; sdlversion += "."; sdlversion += Info.version.minor; sdlversion += "."; sdlversion += Info.version.patch; Operator = new COSOperator(sdlversion); os::Printer::log(sdlversion.c_str(), ELL_INFORMATION); // create keymap createKeyMap(); // enable key to character translation SDL_EnableUNICODE(1); (void)SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); if ( CreationParams.Fullscreen ) SDL_Flags |= SDL_FULLSCREEN; if (CreationParams.DriverType == video::EDT_OPENGL) SDL_Flags |= SDL_OPENGL; else if (CreationParams.Doublebuffer) SDL_Flags |= SDL_DOUBLEBUF; // create window if (CreationParams.DriverType != video::EDT_NULL) { // create the window, only if we do not use the null device createWindow(); } // create cursor control CursorControl = new CCursorControl(this); // create driver createDriver(); if (VideoDriver) createGUIAndScene(); }