Exemplo n.º 1
0
void* ptcVideo::Init(int w, int h, int bpp, bool fs)
{
	ptc_open("cpcVideo", w, h);

	_publicVideo = malloc(w*h*bpp/8);

	VideoPlugin::Init(w,h,bpp,fs);

	_publicPitch *= 2;
	return _publicVideo;
}
Exemplo n.º 2
0
u32 Gdl_init(char* appTitle, u32 width, u32 height) // open you a framebuffer
{   
	#ifndef GP32
		HEIGHT = height; WIDTH = width;
	#endif
	
    inikey();

	#ifdef GP32
		gp_enableCache();
		screenRefreshRate = height;
		currentFrequency = width;
		gpSetCpuSpeed(currentFrequency);
		screenBuffer[0] = (clDeep*)FRAMEBUFFER1;
		screenBuffer[1] = (clDeep*)FRAMEBUFFER2;
		screenBufferEnd[0] = &( (screenBuffer[0])[(320*240)-1] );
		screenBufferEnd[1] = &( (screenBuffer[1])[(320*240)-1] );
		pixel =  screenBuffer[nflip];

		currentFps = gp_initFramebuffer(screenRefreshRate);

		gp_initRTC();
		shell.set(-1,-1,24,14);
		shell.print("@0g@1d@0l @1i@0n@1i@0t @2ok\n");
		//printlr("current fps : %i",currentFps);
	#endif

    #ifdef useSdl
    	if(SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0)
        {  fprintf (stderr, "sdl init error (%s)\n",SDL_GetError()); return 0;
    	}

    	screen = SDL_SetVideoMode (WIDTH, HEIGHT, deepByte, SDL_SWSURFACE/*|SDL_NOFRAME*/ );// SDL_SWSURFACE)/;

    	if(!screen)
        {	fprintf (stderr, "error on set %ix%i.%i video mode (%s)\n",
                      WIDTH,HEIGHT,deepByte,SDL_GetError()); return 0;
    	}
        SDL_WM_SetCaption(appName,0);
	   //SDL_ShowCursor(SDL_DISABLE);
    
    	if(SDL_NumJoysticks() > 0)
        {	joy = SDL_JoystickOpen(0);
    		if(!joy)
            {	fprintf (stderr, "sdl link to joystick error (%s)\n",SDL_GetError()); return 0;
    		}
    	}

    	pixel = (clDeep*)(screen->pixels);
    	SDL_UnlockSurface(screen);
   	#endif
   	
   	#ifdef useRlyeh
   	       gp2x_init(1000, deepByte, 11025,16,1,60);
           pixel = gp2x_screen15;
   	#endif
   	
   	#ifdef usePtc
           fwidth  = WIDTH;
           fheight = HEIGHT;
           pixel = (clDeep*)malloc(WIDTH*HEIGHT*4);
   	       
		   if(!ptc_open(appTitle,&fwidth,&fheight))
		   {	showMsg("cannot render the backbuffer :|\n\nneed a minimum of :\n\t* 16b color deep\n\t* direct X 5 or more",appTitle);
				Gdl_exit();
		   }

   	       ptc_iniMsgCallBack(&Gdl_processMsg);
   	#endif

	#ifndef GP32
		#ifdef startAppWithFullPower
		   Gdl_setAppPower(1);
		 #else
		   Gdl_setAppPower(0);
		#endif   
	#endif
   	//atexit (Gdl_exit);
   	fullBlitLimit();
    return 1;
}