//-----------------------------------------------------------------------------
// Description: Platform specific input initialization
// Parameters:	pPlatformData - Platform specific data
// Returns:
// Notes:
//-----------------------------------------------------------------------------
bool FWInput::platformInit(void *pPlatformData)
{
	FWInputDevicePad		*pPad;
	FWInputDeviceKeyboard	*pKeybd;
	FWInputDeviceMouse		*pMouse;
	long				i;

	// stop unused parameter warning
	(void)pPlatformData;

	cellPadInit(FW_MAX_PAD_NUM);

	for(i = 0; i < FW_MAX_PAD_NUM; i ++)
	{
		sOldPadStatus[i] = 0;
		pPad = new FWInputDevicePad((void *)new FWCellPadInfo(i));
	}

	cellKbInit(FW_MAX_KEYBD_NUM);

	for(i = 0; i < FW_MAX_KEYBD_NUM; i ++)
	{
		sOldKeybdStatus[i] = 0;
		pKeybd = new FWInputDeviceKeyboard((void *)i);

		cellKbSetCodeType(i, CELL_KB_CODETYPE_RAW);
	}

	cellMouseInit(FW_MAX_MOUSE_NUM);

	for(i = 0; i < FW_MAX_MOUSE_NUM; i ++)
	{
		sOldMouseStatus[i] = 0;
		pMouse = new FWInputDeviceMouse((void *)i);
	}

	return true;
}
Exemple #2
0
static SDL_VideoDevice*	CELL_CreateDevice		(int devindex)
{
	/* Allocate memory for sdl video device */
	CELL_VideoDevice = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
	if(CELL_VideoDevice)
	{
		SDL_memset(CELL_VideoDevice, 0, (sizeof *CELL_VideoDevice));
		CELL_VideoDevice->hidden = &CELL_Video;
		SDL_memset(&CELL_Video, 0, sizeof(CELL_Video));
	}
	else
	{
		SDL_OutOfMemory();
		return(0);
	}

	/* Set the function pointers */
	//General
	CELL_VideoDevice->VideoInit = CELL_VideoInit;
	CELL_VideoDevice->ListModes = CELL_ListModes;
	CELL_VideoDevice->SetVideoMode = CELL_SetVideoMode;
	//ToggleFullScreen(this, int on)
	//UpdateMouse(this)
	//SDL_Overlay *(*CreateYUVOverlay)(_THIS, int width, int height, Uint32 format, SDL_Surface *display);
	CELL_VideoDevice->SetColors = CELL_SetColors;
	CELL_VideoDevice->UpdateRects = CELL_UpdateRects;
	CELL_VideoDevice->VideoQuit = CELL_VideoQuit;

	//Accel
	CELL_VideoDevice->AllocHWSurface = CELL_AllocHWSurface;
	//int (*CheckHWBlit)(_THIS, SDL_Surface *src, SDL_Surface *dst);
	CELL_VideoDevice->FillHWRect = CELL_FillHWRect;
	//int (*SetHWColorKey)(_THIS, SDL_Surface *surface, Uint32 key);
	//int (*SetHWAlpha)(_THIS, SDL_Surface *surface, Uint8 value);
	CELL_VideoDevice->LockHWSurface = CELL_LockHWSurface;
	CELL_VideoDevice->UnlockHWSurface = CELL_UnlockHWSurface;
	CELL_VideoDevice->FlipHWSurface = CELL_FlipHWSurface;
	CELL_VideoDevice->FreeHWSurface = CELL_FreeHWSurface;

	//Gamma
	//int (*SetGamma)(_THIS, float red, float green, float blue);
	//int (*GetGamma)(_THIS, float *red, float *green, float *blue);
	//int (*SetGammaRamp)(_THIS, Uint16 *ramp);
	//int (*GetGammaRamp)(_THIS, Uint16 *ramp);

	//OpenGL
	//int (*GL_LoadLibrary)(_THIS, const char *path);
	//void* (*GL_GetProcAddress)(_THIS, const char *proc);
	//int (*GL_GetAttribute)(_THIS, SDL_GLattr attrib, int* value);
	//int (*GL_MakeCurrent)(_THIS);
	//void (*GL_SwapBuffers)(_THIS);

	//Window manager
	CELL_VideoDevice->SetCaption = CELL_CAPTION_Set;
	//void (*SetIcon)(_THIS, SDL_Surface *icon, Uint8 *mask);
	//int (*IconifyWindow)(_THIS);
	//SDL_GrabMode (*GrabInput)(_THIS, SDL_GrabMode mode);
	//int (*GetWMInfo)(_THIS, SDL_SysWMinfo *info);

	//Cursor
	CELL_VideoDevice->FreeWMCursor = CELL_CURSOR_Free;
	CELL_VideoDevice->CreateWMCursor = CELL_CURSOR_Create;
	CELL_VideoDevice->ShowWMCursor = CELL_CURSOR_Show;
	//void (*WarpWMCursor)(_THIS, Uint16 x, Uint16 y);
	CELL_VideoDevice->MoveWMCursor = CELL_CURSOR_Move;
	//void (*CheckMouseMode)(_THIS);

	//Events
	CELL_VideoDevice->InitOSKeymap = CELL_EVENTS_Init;
	CELL_VideoDevice->PumpEvents = CELL_EVENTS_Pump;

	//Clean up
	CELL_VideoDevice->free = CELL_DeleteDevice;

	/* Initialize CELL input libs */
	cellKbInit(1);
	cellMouseInit(1);
	cellPadInit(7);

	/* Setup PSGL */
	CELL_PSGL_Setup(CELL_VideoDevice);

	/* Read the RC File */
	CELL_RC_GetData();
	return CELL_VideoDevice;
}