Exemplo n.º 1
0
//! 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();
}
Exemplo n.º 2
0
//! constructor
CIrrDeviceNaCl::CIrrDeviceNaCl(const SIrrlichtCreationParameters& params)
	: CIrrDeviceStub(params)
{
	createDriver();

	if (VideoDriver)
		createGUIAndScene();
	
}
Exemplo n.º 3
0
int rmain(void* initrfsPtr) {
	createDriver();

	fCall("initrfs", 0, 0); //TELL init we are finished here

	while(1) {
		yield();
	}

	return 0;
}
Exemplo n.º 4
0
TKvsDatabase TKvsDatabase::addDatabase(const QString &driver, const QString &connectionName)
{
    QMutexLocker lock(&mutex);

    // Removes it if exists
    if (databaseMap.contains(connectionName))
        removeDatabase(connectionName);

    TKvsDatabaseData data;
    data.connectionName = connectionName;
    data.driver = createDriver(driver);  // creates a driver
    databaseMap.insert(connectionName, data);
    return database(connectionName);
}
	//! 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;
	}
Exemplo n.º 6
0
//! 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();
}
Exemplo n.º 8
0
    //-----------------------------------------------------------------------------
    Bool ClientNetUdpApplyManager::initialize()
    {
        if ( NetUdpManager::initialize(UDP_SECTION_PACKET_DEFAULT_SIZE) == false )
            return false;
        
        revertOnceHandlePacketCountByDrive();

		mNetDriver = createDriver( "Client", 4, false, true, 
                                    UDP_LOGIC_PACK_MIN_SIZE,
                                    UDP_LOGIC_PACK_MAX_SIZE);
		if ( mNetDriver < 0 )
		{
			return false;
		}

        this->setOnceHandlePacketCountByDriver( mNetDriver, -1 );

		configLocalSockets(mNetDriver,NULL,100);
        return true;
    }
Exemplo n.º 9
0
    //-----------------------------------------------------------------------------
    Bool ClientNetApplyManager::initialize()
    {
        if ( NetManager::initialize() == false )
            return false;
        
		//mNetDriver = createDriver("Client",1200,false,MG_NET_IOCP_BUFFER_SIZE_CLIENT);
		mNetDriver = createDriver(   
			"Client",
			1200,
			false, 
			MG_NET_CLIENT_TIMEOUT_TOUCH_TIME,
			MG_NET_CLIENT_TIMEOUT_DURATION,
			true, 
			MG_GAME_NET_PACKET_NORMAL_MAX_SIZE, 
			MG_GAME_NET_PACKET_BIG_MAX_SIZE,
			MG_NET_BUFFER_SIZE_CLIENT,
			MG_NET_MAX_CLIENT_SOCKET_SENDBUFF_SIZE,
			MG_NET_MAX_CLIENT_SOCKET_RECVBUFF_SIZE,
			DRIVER_TYPE_CLIENT);

		if ( mNetDriver < 0 )
		{
			return false;
		}

		GameNetDriveConfig config;
		config.OnceHandlePacketCount        = 1;
		config.SendCombinePacketMaxSize     = 1024*10;
		config.ReplaceEnableInSendQueue     = true;
		config.ReplaceEnableInRecvQueue     = true;
		config.DiscardEnableInSendQueue     = true;
		config.DiscardEnableInRecvQueue     = true;
		config.BlockWaitEnableInSendQueue   = true;
		config.BlockWaitEnableInRecvQueue   = true;
		configDrive( mNetDriver, config );

        return true;
    }
Exemplo n.º 10
0
	bool GraphicsEngine::init(VideoDriverType::List type,
	                          unsigned int width,
	                          unsigned int height,
	                          bool fullscreen,
	                          RenderContext::Ptr context,
	                          bool multithreaded)
	{
		// Initialize file system
		if (!fs)
		{
			core::StandardFileSystem::Ptr newfs = new core::StandardFileSystem();
			newfs->mount("", "/");
			fs = newfs;
		}
		// Initialize log file
		if (!log)
			log = new core::Log(fs, "/CoreRenderLog.html");
		log->info("CoreRender initializing.");
		// TODO: Version information
		// Create context of no was provided
		if (!context)
		{
			context = createContext(type, width, height, fullscreen);
		}
		if (!context)
		{
			log->error("Could not create any rendering context!");
			return false;
		}
		this->context = context;
		if (multithreaded)
		{
			// Create second context for the rendering thread
			RenderContext::Ptr secondcontext = context->clone();
			if (secondcontext)
			{
				this->secondcontext = secondcontext;
			}
			else
			{
				log->warning("Could not clone the rendering context. "
				             "Continuing single-threaded.");
				multithreaded = false;
			}
		}
		this->multithreaded = multithreaded;
		// Initialize resource manager
		rmgr = new res::ResourceManager(fs, log);
		if (!rmgr->init())
		{
			log->error("Could not initialize resource manager.");
			delete rmgr;
			rmgr = 0;
			context = 0;
			secondcontext = 0;
			return false;
		}
		// Create renderer
		context->makeCurrent();
		driver = createDriver(type);
		context->makeCurrent(false);
		if (!driver)
		{
			log->error("Could not create video driver.");
			delete rmgr;
			rmgr = 0;
			context = 0;
			secondcontext = 0;
			return false;
		}
		renderer = new Renderer(context, secondcontext, log, driver, this);
		// Create render thread
		if (multithreaded)
		{
			renderthread = new RenderThread(renderer);
			if (!renderthread->start())
			{
				log->error("Could not start render thread.");
				delete renderthread;
				renderthread = 0;
				delete renderer;
				renderer = 0;
				delete rmgr;
				rmgr = 0;
				context = 0;
				secondcontext = 0;
				return false;
			}
		}
		// Register resource types
		res::ResourceFactory::Ptr factory;
		factory = new res::DefaultResourceFactory<Material>(rmgr);
		rmgr->addFactory("Material", factory);
		factory = new res::DefaultResourceFactory<Model>(rmgr);
		rmgr->addFactory("Model", factory);
		factory = new res::DefaultResourceFactory<ShaderText>(rmgr);
		rmgr->addFactory("ShaderText", factory);
		factory = new ShaderFactory(driver, renderer, rmgr);
		rmgr->addFactory("Shader", factory);
		factory = new Texture2DFactory(driver, renderer, rmgr);
		rmgr->addFactory("Texture2D", factory);
		factory = new IndexBufferFactory(driver, renderer, rmgr);
		rmgr->addFactory("IndexBuffer", factory);
		factory = new VertexBufferFactory(driver, renderer, rmgr);
		rmgr->addFactory("VertexBuffer", factory);
		factory = new FrameBufferFactory(driver, renderer, rmgr);
		rmgr->addFactory("FrameBuffer", factory);
		factory = new res::DefaultResourceFactory<Animation>(rmgr);
		rmgr->addFactory("Animation", factory);
		factory = new res::DefaultResourceFactory<RenderTarget>(rmgr);
		rmgr->addFactory("RenderTarget", factory);
		return true;
	}
Exemplo n.º 11
0
    //-----------------------------------------------------------------------------
    Bool ServerNetApplyManager::initialize()
    {
        if ( GameNetPacketManager::initialize() == false )
            return false;

		SServerSetting& setting = SServerSetting::getInstance();

		if ( setting.isClientLisiten() )
		{
			mClientDriver = createDriver(   "Client",
                                            setting.getClientListenInfo()->maxConnects,
                                            false, 
                                            MG_NET_CLIENT_TIMEOUT_TOUCH_TIME,
                                            MG_NET_CLIENT_TIMEOUT_DURATION,
                                            true, 
                                            MG_GAME_NET_PACKET_NORMAL_MAX_SIZE, 
                                            MG_GAME_NET_PACKET_BIG_MAX_SIZE,
                                            MG_NET_BUFFER_SIZE_CLIENT,
											MG_NET_MAX_CLIENT_SOCKET_SENDBUFF_SIZE,
											MG_NET_MAX_CLIENT_SOCKET_RECVBUFF_SIZE,
											DRIVER_TYPE_CLIENT);
			if ( mClientDriver < 0 )
			{
				return false;
			}
			NetAddress addr(setting.getClientListenInfo()->addr);
			if ( lisiten( mClientDriver, &addr ) == false )
			{
				return false;
			}

            GameNetDriveConfig config;
            config.OnceHandlePacketCount        = 1;
            config.SendCombinePacketMaxSize     = 1024*10;
            config.ReplaceEnableInSendQueue     = true;
            config.ReplaceEnableInRecvQueue     = true;
            config.DiscardEnableInSendQueue     = true;
            config.DiscardEnableInRecvQueue     = true;
            config.BlockWaitEnableInSendQueue   = true;
            config.BlockWaitEnableInRecvQueue   = true;
            configDrive( mClientDriver, config );
		}
		
		if (setting.getServerListenInfo())
		{	
			mServerDriver = createDriver(   "Server",
                                            setting.getServerListenInfo()->maxConnects,
                                            false, 
                                            MG_NET_SERVER_TIMEOUT_TOUCH_TIME,
                                            MG_NET_SERVER_TIMEOUT_DURATION,
                                            false, 
                                            MG_GAME_NET_PACKET_NORMAL_MAX_SIZE, 
                                            MG_GAME_NET_PACKET_BIG_MAX_SIZE,
                                            MG_NET_BUFFER_SIZE_SERVER,
											MG_NET_MAX_SERVER_SOCKET_SENDBUFF_SIZE,
											MG_NET_MAX_SERVER_SOCKET_RECVBUFF_SIZE,
											DRIVER_TYPE_SERVER);
			if (mServerDriver < 0)
			{
				return false;
			}

            GameNetDriveConfig config;
            config.OnceHandlePacketCount        = -1;
            config.SendCombinePacketMaxSize     = 1024*10;
            config.ReplaceEnableInSendQueue     = false;
            config.ReplaceEnableInRecvQueue     = false;
            config.DiscardEnableInSendQueue     = false;
            config.DiscardEnableInRecvQueue     = false;
            config.BlockWaitEnableInSendQueue   = false;
            config.BlockWaitEnableInRecvQueue   = false;
            configDrive( mServerDriver, config );
		}
		else
		{
			return false;
		}
		
		if (!setting.getCoreInfo())
		{
			return false;
		}
		ServerMain::getInstance().addServer(setting.getCoreInfo()->id,-1);

		if ( setting.isServerLisiten())
		{

			if ( lisiten( mServerDriver,&(setting.getServerListenInfo()->addr) ) == false )
			{
				return false;
			}
			mUniqueFlag = setting.getServerListenInfo()->addr.getIP() * ::GetCurrentProcessId();
			if (setting.getConnectServers()->maxConnects > 0)
			{
				SServerSetting::ConnectionIt it = setting.getConnectServers()->connectServers.begin();
				for (; it != setting.getConnectServers()->connectServers.end(); it++)
				{
                    ConnectRemoteInfo* connectInfo = it->second;
					I32 netID = connect( mServerDriver, &(connectInfo->addr),true );
				}
			}
		}

        // 开启重新连接线程
		//Ptr ptr1;
        mReConnectThread.create(reConnectThread, this);
#ifdef _DEBUG
		Thread::SetThreadName(mReConnectThread.getThreadId(),"ServerNetApplyManager::mReConnectThread");
#endif // _DEBUG
		return true;
	}
Exemplo n.º 12
0
//! 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();
}