예제 #1
0
파일: gr.c 프로젝트: gameplayer22/d1x
int gr_set_mode(u_int32_t mode)
{
    unsigned int w,h;
    char *gr_bm_data;

#ifdef NOGRAPH
    return 0;
#endif
//	mode=0;
    if (mode<=0)
        return 0;

    w=SM_W(mode);
    h=SM_H(mode);

    //if (screen != NULL) gr_palette_clear();

//	ogl_init_state();

    gr_bm_data=grd_curscreen->sc_canvas.cv_bitmap.bm_data;//since we use realloc, we want to keep this pointer around.
    memset( grd_curscreen, 0, sizeof(grs_screen));
    grd_curscreen->sc_mode = mode;
    grd_curscreen->sc_w = w;
    grd_curscreen->sc_h = h;
    grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*3,grd_curscreen->sc_h*4);
    grd_curscreen->sc_canvas.cv_bitmap.bm_x = 0;
    grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0;
    grd_curscreen->sc_canvas.cv_bitmap.bm_w = w;
    grd_curscreen->sc_canvas.cv_bitmap.bm_h = h;
    //grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = screen->pitch;
    grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = w;
    grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_OGL;
    //grd_curscreen->sc_canvas.cv_bitmap.bm_data = (unsigned char *)screen->pixels;
//	mprintf((0,"ogl/gr.c: reallocing %p to %i\n",grd_curscreen->sc_canvas.cv_bitmap.bm_data,w*h));
    grd_curscreen->sc_canvas.cv_bitmap.bm_data = realloc(gr_bm_data,w*h);
    gr_set_current_canvas(NULL);
    //gr_enable_default_palette_loading();

    ogl_init_window(w,h);//platform specific code

    ogl_get_verinfo();

    OGL_VIEWPORT(0,0,w,h);

    ogl_set_screen_mode();

    gamefont_choose_game_font(w,h);

    return 0;
}
예제 #2
0
파일: gr.c 프로젝트: CDarrow/DXX-Retro
int gr_set_mode(u_int32_t mode)
{
	unsigned int w, h;
	char *gr_bm_data;

	if (mode<=0)
		return 0;

	w=SM_W(mode);
	h=SM_H(mode);

	if (!gr_check_mode(mode))
	{
		con_printf(CON_URGENT,"Cannot set %ix%i. Fallback to 640x480\n",w,h);
		w=640;
		h=480;
		Game_screen_mode=mode=SM(w,h);
	}

	gr_bm_data=(char *)grd_curscreen->sc_canvas.cv_bitmap.bm_data;//since we use realloc, we want to keep this pointer around.
	memset( grd_curscreen, 0, sizeof(grs_screen));
	grd_curscreen->sc_mode = mode;
	grd_curscreen->sc_w = w;
	grd_curscreen->sc_h = h;
	grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameCfg.AspectX,grd_curscreen->sc_h*GameCfg.AspectY);
	gr_init_canvas(&grd_curscreen->sc_canvas, d_realloc(gr_bm_data,w*h), BM_OGL, w, h);
	gr_set_current_canvas(NULL);

	ogl_init_window(w,h);//platform specific code
	ogl_get_verinfo();
	OGL_VIEWPORT(0,0,w,h);
	ogl_init_state();
	gamefont_choose_game_font(w,h);
	gr_remap_color_fonts();
	gr_remap_mono_fonts();

	return 0;
}
예제 #3
0
파일: vid.c 프로젝트: btb/d2x
int vid_set_mode(uint32_t mode)
{
	short w, h;

#ifdef NOGRAPH
return 0;
#endif
//	mode=0;
	if (mode<=0)
		return 0;

	if (mode == Vid_current_mode)
		return 0;

	w=SM_W(mode);
	h=SM_H(mode);
	Vid_current_mode = mode;

	//if (screen != NULL) gr_palette_clear();

//	ogl_init_state();

	gr_init_screen(BM_OGL, w, h, 0, 0, w, NULL);

	//gr_enable_default_palette_loading();
	
	ogl_init_window(w,h);//platform specific code

	ogl_get_verinfo();

	OGL_VIEWPORT(0,0,w,h);

	ogl_set_screen_mode();

//	gamefont_choose_game_font(w,h);
	
	return 0;
}