Example #1
0
static int Init()
{
    nInitedSubsytems = SDL_WasInit(SDL_INIT_VIDEO);

    if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
        SDL_InitSubSystem(SDL_INIT_VIDEO);
    }

    nUseBlitter = nVidBlitterOpt[nVidSelect] & 0xFF;

    nGameWidth = nVidImageWidth;
    nGameHeight = nVidImageHeight;

    nRotateGame = 0;
    if (bDrvOkay) {
        // Get the game screen size
        BurnDrvGetVisibleSize(&nGameWidth, &nGameHeight);

        if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
            if (nVidRotationAdjust & 1) {
                int n = nGameWidth;
                nGameWidth = nGameHeight;
                nGameHeight = n;
                nRotateGame |= (nVidRotationAdjust & 2);
            } else {
                nRotateGame |= 1;
            }
        }

        if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
            nRotateGame ^= 2;
        }
    }

    nSize = VidSoftFXGetZoom(nUseBlitter);
    bVidScanlines = 0;								// !!!

    if (nVidFullscreen) {

        nVidScrnWidth = nVidWidth;
        nVidScrnHeight = nVidHeight;

        if ((sdlsFramebuf = SDL_SetVideoMode(nVidWidth, nVidHeight, nVidDepth, SDL_HWSURFACE | SDL_ANYFORMAT | SDL_DOUBLEBUF | SDL_FULLSCREEN)) == NULL) {
            dprintf(_T("*** Couldn't enter fullscreen mode.\n"));
            return 1;
        }
    } else {
        if ((sdlsFramebuf = SDL_SetVideoMode(nGameWidth * nSize, nGameHeight * nSize, 0, SDL_RESIZABLE | SDL_HWSURFACE)) == NULL) {
            return 1;
        }
    }

    SDL_SetClipRect(sdlsFramebuf, NULL);

    // Initialize the buffer surfaces
    BlitFXInit();

    if (VidSoftFXInit(nUseBlitter, nRotateGame)) {
        if (VidSoftFXInit(0, nRotateGame)) {
            Exit();
            return 1;
        }
    }

    return 0;
}
static int Init()
{
	nInitedSubsytems = SDL_WasInit(SDL_INIT_VIDEO);

	if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
		SDL_InitSubSystem(SDL_INIT_VIDEO);
	}

	nGamesWidth = nVidImageWidth;
	nGamesHeight = nVidImageHeight;

	nRotateGame = 0;

	if (bDrvOkay) {
		// Get the game screen size
		BurnDrvGetVisibleSize(&nGamesWidth, &nGamesHeight);

		if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
			printf("Vertical\n");
			nRotateGame = 1;
		}

		if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
			printf("Flipped\n");
			bFlipped = true;
		} 
	}

	if (!nRotateGame) {
		nTextureWidth = GetTextureSize(nGamesWidth);
		nTextureHeight = GetTextureSize(nGamesHeight);
	} else {
		nTextureWidth = GetTextureSize(nGamesHeight);
		nTextureHeight = GetTextureSize(nGamesWidth);
	}

	nSize = 2;
	bVidScanlines = 0;

	RECT test_rect;
	test_rect.left = 0;
	test_rect.right = nGamesWidth;
	test_rect.top = 0;
	test_rect.bottom = nGamesHeight;

	printf("correctx before %d, %d\n", test_rect.right, test_rect.bottom);
	VidSScaleImage(&test_rect);
	printf("correctx after %d, %d\n", test_rect.right, test_rect.bottom);

	screen = SDL_SetVideoMode(test_rect.right * nSize,
				  test_rect.bottom * nSize, 32, SDL_OPENGL);
	SDL_WM_SetCaption("FB Alpha", NULL);

	// Initialize the buffer surfaces
	BlitFXInit();

	// Init opengl
	init_gl();

	return 0;
}
static int Init()
{
	nInitedSubsytems = SDL_WasInit(SDL_INIT_VIDEO);

	if (!(nInitedSubsytems & SDL_INIT_VIDEO)) {
		SDL_InitSubSystem(SDL_INIT_VIDEO);
	}

	nUseBlitter = 0;
	nGameWidth = nVidImageWidth; nGameHeight = nVidImageHeight;
	nRotateGame = 0;
    //nVidRotationAdjust = 1; // add_shin

	if (bDrvOkay) {
		// Get the game screen size
		BurnDrvGetVisibleSize(&nGameWidth, &nGameHeight);

		printf( "vid_sdlfx.Init: nGame: %ix%i", nGameWidth, nGameHeight );

	    if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
			if (nVidRotationAdjust & 1) {
				int n = nGameWidth;
				nGameWidth = nGameHeight;
				nGameHeight = n;
				nRotateGame |= (nVidRotationAdjust & 2);
			} else {
				nRotateGame |= 1;
			}
		}

		if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) {
			nRotateGame ^= 2;
		}
	}

	nSize = VidSoftFXGetZoom(nUseBlitter);
	bVidScanlines = 0;								// !!!

	if( ( sdlFramebuf = SDL_SetVideoMode(nGameWidth * nSize, nGameHeight * nSize, 0, SDL_RESIZABLE | SDL_HWSURFACE ) ) == NULL )
		return 1;

	printf("android_sdlfx.Init: SDL_SetVideoMode( %i, %i )", nGameWidth * nSize, nGameHeight * nSize );

	printf("android_sdlfx.Init: sdlFramebuf PixelFormat = %s",
				SDL_GetPixelFormatName(
						SDL_MasksToPixelFormatEnum(
								sdlFramebuf->format->BitsPerPixel,
								sdlFramebuf->format->Rmask,
								sdlFramebuf->format->Gmask,
								sdlFramebuf->format->Bmask,
								sdlFramebuf->format->Amask) ) );

	printf("android_sdlfx.Init: ( %i, %u, %u, %u, %u )",
			sdlFramebuf->format->BitsPerPixel,
			sdlFramebuf->format->Rmask,
			sdlFramebuf->format->Gmask,
			sdlFramebuf->format->Bmask,
			sdlFramebuf->format->Amask );

	SDL_SetClipRect(sdlFramebuf, NULL);

	// Initialize the buffer surfaces
	BlitFXInit();

	if (VidSoftFXInit(nUseBlitter, nRotateGame)) {
		if (VidSoftFXInit(0, nRotateGame)) {
			Exit();
			return 1;
		}
	}

	printf( "vid_sdlfx.Init: nRotateGame=%i", nRotateGame );

	return 0;
}