Esempio n. 1
0
int
Android_VideoInit(_THIS)
{
    SDL_DisplayMode mode;

    mode.format = Android_ScreenFormat;
    mode.w = Android_ScreenWidth;
    mode.h = Android_ScreenHeight;
    mode.refresh_rate = Android_ScreenRate;
    mode.driverdata = NULL;
    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
        return -1;
    }

    SDL_AddDisplayMode(&_this->displays[0], &mode);

    Android_InitKeyboard();

    Android_InitTouch();

    Android_InitMouse();

    /* We're done! */
    return 0;
}
int
OFFSCREEN_VideoInit(_THIS)
{
    SDL_DisplayMode mode;
    SDL_Mouse *mouse = NULL;

    /* Use a fake 32-bpp desktop mode */
    mode.format = SDL_PIXELFORMAT_RGB888;
    mode.w = 1024;
    mode.h = 768;
    mode.refresh_rate = 0;
    mode.driverdata = NULL;
    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
        return -1;
    }

    SDL_zero(mode);
    SDL_AddDisplayMode(&_this->displays[0], &mode);

    /* Init mouse */
    mouse = SDL_GetMouse();
    /* This function needs to be implemented by every driver */
    mouse->GetGlobalMouseState = OFFSCREEN_GetGlobalMouseState;
    
    /* We're done! */
    return 0;
}
Esempio n. 3
0
int
Android_VideoInit(_THIS)
{
    SDL_DisplayMode mode;

    mode.format = Android_ScreenFormat;
    mode.w = Android_ScreenWidth;
    mode.h = Android_ScreenHeight;
    mode.refresh_rate = Android_ScreenRate;
    mode.driverdata = NULL;

    // Urho3D: merge patch found in https://bugzilla.libsdl.org/show_bug.cgi?id=2291 submitted by Thomas Faller
    SDL_PixelFormat pixelFormat;
    Uint32 mask;
    int bitCount;

    /* We need to set color sizes */
    if(!SDL_InitFormat(&pixelFormat, mode.format)){
        for(mask = pixelFormat.Rmask >> pixelFormat.Rshift,
            bitCount = 0; mask > 0; mask >>= 1)
            bitCount += 1;
        SDL_GL_SetAttribute(SDL_GL_RED_SIZE, bitCount);
        for(mask = pixelFormat.Gmask >> pixelFormat.Gshift,
            bitCount = 0; mask > 0; mask >>= 1)
            bitCount += 1;
        SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, bitCount);
        for(mask = pixelFormat.Bmask >> pixelFormat.Bshift,
            bitCount = 0; mask > 0; mask >>= 1)
            bitCount += 1;
        SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, bitCount);
        for(mask = pixelFormat.Amask >> pixelFormat.Ashift,
            bitCount = 0; mask > 0; mask >>= 1)
            bitCount += 1;
        SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, bitCount);
    }

    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
        return -1;
    }

    SDL_AddDisplayMode(&_this->displays[0], &mode);

    Android_InitKeyboard();

    Android_InitTouch();

    Android_InitMouse();

    /* We're done! */
    return 0;
}
Esempio n. 4
0
int
WIN_VideoInit(_THIS)
{
	SDL_DisplayMode mode;

	mode.format = SDL_PIXELFORMAT_ABGR8888;
	get_screen_size(mode.w, mode.h);
	mode.refresh_rate = 0;
	mode.driverdata = NULL;
	if (SDL_AddBasicVideoDisplay(&mode) < 0) {
		return -1;
	}

	SDL_AddDisplayMode(&_this->displays[0], &mode);

    return 0;
}
void
PSL1GHT_InitModes(_THIS)
{
    deprintf(1, "+PSL1GHT_InitModes()\n");
    SDL_DisplayMode mode;
    PSL1GHT_DisplayModeData *modedata;
    videoState state;

    modedata = (PSL1GHT_DisplayModeData *) SDL_malloc(sizeof(*modedata));
    if (!modedata) {
        return;
    }

    assert(videoGetState(0, 0, &state) == 0); // Get the state of the display
    assert(state.state == 0); // Make sure display is enabled

    // Get the current resolution
	videoResolution res;
    assert(videoGetResolution(state.displayMode.resolution, &res) == 0);

    /* Setting up the DisplayMode based on current settings */
    mode.format = SDL_PIXELFORMAT_ARGB8888;
    mode.refresh_rate = 0;
    mode.w = res.width;
    mode.h = res.height;

    modedata->vconfig.resolution = state.displayMode.resolution;
    modedata->vconfig.format = VIDEO_BUFFER_FORMAT_XRGB;
    modedata->vconfig.pitch = res.width * 4;
    mode.driverdata = modedata;

    /* Setup the display to it's  default mode */
    assert(videoConfigure(0, &modedata->vconfig, NULL, 1) == 0);

	// Wait until RSX is ready
	do{
		SDL_Delay(10);
		assert( videoGetState(0, 0, &state) == 0);
	}while ( state.state == 3);

    /* Set display's videomode and add it */
    SDL_AddBasicVideoDisplay(&mode);

    deprintf(1, "-PSL1GHT_InitModes()\n");
}
Esempio n. 6
0
int
DUMMY_VideoInit(_THIS)
{
    SDL_DisplayMode mode;

    /* Use a fake 32-bpp desktop mode */
    mode.format = SDL_PIXELFORMAT_RGB888;
    mode.w = 1024;
    mode.h = 768;
    mode.refresh_rate = 0;
    mode.driverdata = NULL;
    SDL_AddBasicVideoDisplay(&mode);
    SDL_AddRenderDriver(0, &SDL_DUMMY_RenderDriver);

    SDL_zero(mode);
    SDL_AddDisplayMode(0, &mode);

    /* We're done! */
    return 0;
}
int
DUMMY_VideoInit(_THIS)
{
    SDL_DisplayMode mode;

    /* Use a fake 32-bpp desktop mode */
    mode.format = SDL_PIXELFORMAT_RGB888;
    mode.w = 1024;
    mode.h = 768;
    mode.refresh_rate = 0;
    mode.driverdata = NULL;
    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
        return -1;
    }

    SDL_zero(mode);
    SDL_AddDisplayMode(&_this->displays[0], &mode);

    /* We're done! */
    return 0;
}
Esempio n. 8
0
int NACL_VideoInit(_THIS) {
    SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
    SDL_DisplayMode mode;

    SDL_zero(mode);
    mode.format = driverdata->format;
    mode.w = driverdata->w;
    mode.h = driverdata->h;
    mode.refresh_rate = 0;
    mode.driverdata = NULL;
    if (SDL_AddBasicVideoDisplay(&mode) < 0) {
        return -1;
    }

    SDL_AddDisplayMode(&_this->displays[0], &mode);
    
    PSInterfaceInit();
    driverdata->instance = PSGetInstanceId();
    driverdata->ppb_graphics = PSInterfaceGraphics3D();
    driverdata->ppb_message_loop = PSInterfaceMessageLoop();
    driverdata->ppb_core = PSInterfaceCore();
    driverdata->ppb_fullscreen = PSInterfaceFullscreen();
    driverdata->ppb_instance = PSInterfaceInstance();
    driverdata->ppb_image_data = PSInterfaceImageData();
    driverdata->ppb_view = PSInterfaceView();
    driverdata->ppb_var = PSInterfaceVar();
    driverdata->ppb_input_event = (PPB_InputEvent*) PSGetInterface(PPB_INPUT_EVENT_INTERFACE);
    driverdata->ppb_keyboard_input_event = (PPB_KeyboardInputEvent*) PSGetInterface(PPB_KEYBOARD_INPUT_EVENT_INTERFACE);
    driverdata->ppb_mouse_input_event = (PPB_MouseInputEvent*) PSGetInterface(PPB_MOUSE_INPUT_EVENT_INTERFACE);
    driverdata->ppb_wheel_input_event = (PPB_WheelInputEvent*) PSGetInterface(PPB_WHEEL_INPUT_EVENT_INTERFACE);
    driverdata->ppb_touch_input_event = (PPB_TouchInputEvent*) PSGetInterface(PPB_TOUCH_INPUT_EVENT_INTERFACE);
    
    
    driverdata->message_loop = driverdata->ppb_message_loop->Create(driverdata->instance);
    
    PSEventSetFilter(PSE_ALL);
    
    /* We're done! */
    return 0;
}