Exemplo n.º 1
0
void gamefont_loadfont(int gf,int fi){
	if (cfexist(font_conf[gf].font[fi].f.name)){
		gamefont_unloadfont(gf);
		Gamefonts[gf]=gr_init_font(font_conf[gf].font[fi].f.name);
	}else {
		if (Gamefonts[gf]==NULL){
			Gamefonts[gf]=gr_init_font(Gamefont_filenames_l[gf]);
			font_conf[gf].cur=-1;
		}
		return;
	}
	font_conf[gf].cur=fi;
}
Exemplo n.º 2
0
void gamefont_loadfont(int gf,int fi){
	if (cfexist(font_conf[gf].font[fi].f.name)){
		gamefont_unloadfont(gf);
		Gamefonts[gf]=gr_init_font(font_conf[gf].font[fi].f.name);
	}else {
		hud_message(MSGC_GAME_FEEDBACK,"Couldn't find font file %s!",font_conf[gf].font[fi].f.name);
		if (Gamefonts[gf]==NULL){
			Gamefonts[gf]=gr_init_font(Gamefont_filenames_l[gf]);
			font_conf[gf].cur=-1;
		}
		return;
	}
	font_conf[gf].cur=fi;
}
Exemplo n.º 3
0
static void gamefont_loadfont(int gf,int fi)
{
	if (PHYSFSX_exists(font_conf[gf].font[fi].f.name,1)){
		gamefont_unloadfont(gf);
		Gamefonts[gf]=gr_init_font(font_conf[gf].font[fi].f.name);
	}else {
		if (!Gamefonts[gf]){
			Gamefonts[gf]=gr_init_font(Gamefont_filenames_l[gf]);
			font_conf[gf].cur=-1;
		}
		return;
	}
	font_conf[gf].cur=fi;
}
Exemplo n.º 4
0
void ui_init()
{
	grs_font * org_font;

	if (Initialized) return;

	Initialized = 1;

	org_font = grd_curcanv->cv_font;
	ui_small_font = gr_init_font( "pc6x8.fnt" );
	grd_curcanv->cv_font =org_font;

	CBLACK = gr_find_closest_color( 1, 1, 1 );
	CGREY = gr_find_closest_color( 45, 45, 45 );
	CWHITE = gr_find_closest_color( 50, 50, 50 );
	CBRIGHT = gr_find_closest_color( 58, 58, 58 );
	CRED = gr_find_closest_color( 63, 0, 0 );
	
	//key_init();

	gr_set_fontcolor( CBLACK, CWHITE );

	ui_pad_init();
	
	atexit(ui_close );

}
Exemplo n.º 5
0
void init_editor()
{
	minit();

	ui_init();

	init_med_functions();	// Must be called before medlisp_init

	ui_pad_read( 0, "segmove.pad" );
	ui_pad_read( 1, "segsize.pad" );
	ui_pad_read( 2, "curve.pad" );
	ui_pad_read( 3, "texture.pad" );
	ui_pad_read( 4, "object.pad" );
	ui_pad_read( 5, "objmov.pad" );
	ui_pad_read( 6, "group.pad" );
	ui_pad_read( 7, "lighting.pad" );
	ui_pad_read( 8, "test.pad" );

	medkey_init();

	editor_font = gr_init_font( "pc8x16.fnt" );
	
	menubar_init( "MED.MNU" );

	canv_offscreen = gr_create_canvas(LVIEW_W,LVIEW_H);
	
	Draw_all_segments = 1;						// Say draw all segments, not just connected ones

	init_autosave();
  
//	atexit(close_editor);

	Clear_window = 1;	//	do full window clear.
}
Exemplo n.º 6
0
void UI_WINDOW::create( int _x, int _y, int _w, int _h, int _flags )
{
	x = _x;
	y = _y;
	w = _w;
	h = _h;
	flags = _flags;
	first_gadget = NULL;
	selected_gadget = NULL;
	tooltip_handler = NULL;  // pointer to function to handle custom tooltips
	ignore_gadgets = 0;
	use_hack_to_get_around_stupid_problem_flag = 0;

	f_id = gr_init_font("font01.vf");

	if (_x < 0)
		_x = 0;
	if (_x + _w - 1 >= gr_screen.max_w_unscaled)
		_x = gr_screen.max_w_unscaled - _w;
	if (_y < 0)
		_y = 0;
	if (_y + _h - 1 >= gr_screen.max_h_unscaled)
		_y = gr_screen.max_h_unscaled - _h;

	game_flush();
}
Exemplo n.º 7
0
int ui_init()
{

	if (Initialized) return 1;

	const grs_font *org_font = grd_curcanv->cv_font;
	ui_small_font = gr_init_font(*grd_curcanv, "pc6x8.fnt");
	if (!ui_small_font)
	{
		Warning("Could not find pc6x8.fnt");
		return 0;
	}
	grd_curcanv->cv_font =org_font;

	CBLACK = gr_find_closest_color( 1, 1, 1 );
	CGREY = gr_find_closest_color( 45, 45, 45 );
	CWHITE = gr_find_closest_color( 50, 50, 50 );
	CBRIGHT = gr_find_closest_color( 58, 58, 58 );
	CRED = gr_find_closest_color( 63, 0, 0 );
	
	//key_init();

	gr_set_fontcolor(*grd_curcanv, CBLACK, CWHITE);

	ui_pad_init();
	
	atexit(ui_close );

	Initialized = 1;

	return 1;
}
Exemplo n.º 8
0
void gamefont_init()
{
	int i;

	if (Gamefont_installed) return;
	Gamefont_installed = 1;

	for (i=0; i<MAX_FONTS; i++ )
		Gamefonts[i] = gr_init_font(Gamefont_filenames[i]);

	atexit( gamefont_close );
}
Exemplo n.º 9
0
int gr_init(void)
{
    gglInit(&gr_context);
    GGLContext *gl = gr_context;

    gr_mem_surface.data = NULL;

    gr_init_font();
    gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
    if (gr_vt_fd < 0) {
        gr_vt_fd = open("/dev/tty", O_RDWR | O_SYNC);
    }
    if (gr_vt_fd < 0) {
        // This is non-fatal; post-Cupcake kernels don't have tty0.
        perror("can't open /dev/tty0");
    } else {
        ioctl(gr_vt_fd, KDGETMODE, &gr_vt_mode);
        if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
            // However, if we do open tty0, we expect the ioctl to work.
            perror("failed KDSETMODE to KD_GRAPHICS on tty0");
            gr_exit();
            return -1;
        }
    }

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    if (gr_fb_fd < 0) {
        perror("unable to get framebuffer");
        gr_exit();
        return -1;
    }

    get_memory_surface(&gr_mem_surface);

    fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
            gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);

    /* start with 0 as front (displayed) and 1 as back (drawing) */
    gr_active_fb = 0;
    set_active_framebuffer(0);
    gl->colorBuffer(gl, &gr_mem_surface);

    gl->activeTexture(gl, 0);
    gl->enable(gl, GGL_BLEND);
    gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);

    gr_fb_blank(true);
    gr_fb_blank(false);

    return 0;
}
Exemplo n.º 10
0
int gr_init(void)
{
    gglInit(&gr_context);
    GGLContext *gl = gr_context;

    gr_init_font();
    gr_vt_fd = open("/dev/tty0", O_RDWR | O_SYNC);
    if (gr_vt_fd < 0) {
        // This is non-fatal; post-Cupcake kernels don't have tty0.
    } else if (ioctl(gr_vt_fd, KDSETMODE, (void*) KD_GRAPHICS)) {
        // However, if we do open tty0, we expect the ioctl to work.
        perror("failed KDSETMODE to KD_GRAPHICS on tty0");
        gr_exit();
        return -1;
    }

    gr_fb_fd = get_framebuffer(gr_framebuffer);
    if (gr_fb_fd < 0) {
        perror("Unable to get framebuffer.\n");
        gr_exit();
        return -1;
    }

    get_memory_surface(&gr_mem_surface);

    fprintf(stderr, "framebuffer: fd %d (%d x %d)\n",
            gr_fb_fd, gr_framebuffer[0].width, gr_framebuffer[0].height);

    /* start with 0 as front (displayed) and 1 as back (drawing) */
    gr_active_fb = 0;
    if (!has_overlay)
        set_active_framebuffer(0);
    gl->colorBuffer(gl, &gr_mem_surface);

    gl->activeTexture(gl, 0);
    gl->enable(gl, GGL_BLEND);
    gl->blendFunc(gl, GGL_SRC_ALPHA, GGL_ONE_MINUS_SRC_ALPHA);

#ifdef TW_SCREEN_BLANK_ON_BOOT
    printf("TW_SCREEN_BLANK_ON_BOOT := true\n");
    gr_fb_blank(true);
    gr_fb_blank(false);
#endif

    if (!alloc_ion_mem(fi.line_length * vi.yres))
        allocate_overlay(gr_fb_fd, gr_framebuffer);

    return 0;
}