www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/06/14:11:50

Date: Tue, 6 May 1997 10:53:24 -0700 (PDT)
From: KaRNaGE <dlydiard AT linknet DOT kitsap DOT lib DOT wa DOT us>
To: djgpp AT delorie DOT com
Subject: Re: allegro: textout_centre() / gfx_mode_select()
In-Reply-To: <Pine.GSO.3.96.970505222458.9193A-100000@linknet.kitsap.lib.wa.us>
Message-ID: <Pine.GSO.3.96.970506103356.4176B-100000@linknet.kitsap.lib.wa.us>
MIME-Version: 1.0

>Would this by any chance be in a mode-X resolution?

>If so, you are either using an old version of Allegro, which had a bug w
>solid text backgrounds in mode-X (upgrade to v2.2), or you are using a
>customised proportional font (just yesterday I found a bug with regard t
>solid text backgrounds with proportional fonts in mode-X :-)  If this is
>the case, edit modex.c and in the _x_draw_character() function, replace:

no, i'm using 640x480 (autodetect, but this problem exist on other
resolutions also) the thing that baffles me is, when i use the mouse and
click 'ok' or just double click the resolution....the background and
textcolor of the text are both the same...when i use the keyboard and just
press enter...it works 100% fine....well here's the parts that you can
look at...i'll explain it the best i can:

/* ok first i initialize allegro like this */
allegro_init();
install_keyboard();
install_mouse();
install_timer();
initialise_joystick();

 
set_gui_color(); //just sets the palette, just used it from your ex?.c files
set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
set_pallete(desktop_pallete); // set the palette
/* VIDEO_MAX_? are just 'int' */
if (!gfx_mode_select(&video_card, &VIDEO_MAX_X, &VIDEO_MAX_Y))
{
  allegro_exit();
  exit(1);
}
/* ok i do that first 'video_card' is type 'int' */

/* ... init all my 3d engine code / load .3ds mesh */

/* then i set the gmode */
if (set_gfx_mode(video_card, VIDEO_MAX_X, VIDEO_MAX_Y, 0, 0) != 0)
{
  allegro_exit();
  printf("Error setting graphics mode\n%s\n\n", allegro_error);
  exit(1);
}

/* BITMAP *vir_seg; .....load_texture loads a 128x128 texture (and sets
the pallete */
vir_seg = create_bitmap(VIDEO_MAX_X, VIDEO_MAX_Y);
load_texture("3d.dat", texture);

/* then it goes into a main loop */
while(...)
{   
  clear(vir_seg); //clear dubble buffer
  ....
  .....
  sprintf(sbuffer, "blah %3d", x_angle);
  textout_centre(vir_seg, font, sbuffer, SCREEN_W >> 1, SCREEN_H - 40, 255);
  /* unsigned char sbuffer[255] */
  blit(vir_seg, screen, 0, 0, 0, 0, VIDEO_MAX_X, VIDEO_MAX_Y);
  vsync();
  /* that's pretty mutch all you need to know i think...*/
}

but the thing si it's probaly not the code...cuz it has to do with using
the mouse or keyboard to pick the video mode....

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019