delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/29/22:20:05

From: Nicolas Blais <alphaqt AT phreaker DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Small Allegro Problem
Date: Thu, 29 Oct 1998 19:53:38 -0500
Organization: Alpha Quark Technologie
Lines: 48
Message-ID: <36390E11.B6CAE0F@phreaker.net>
NNTP-Posting-Host: ts1-33.f2005.quebectel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.5b2 [en] (Win95; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
Hi, I made an small program that goes in graphic mode.&nbsp; It works great
actually, but the problem is that I want the user to know if the text to
graphic change was successful.&nbsp; Here is the code that I used.&nbsp;
It doesn't bug the program, it just goes in a black screen (in text) when
I change my gfx_driver to ATI for example (which I don' t have).&nbsp;
But in auto_detect it works fine.
<BR>res_x = 800
<BR>res_y = 600
<BR>color_depth = 15
<P>short engine::init_graphics(ushort res_x, ushort res_y, ushort color_depth)
<BR>{
<BR>cout &lt;&lt; "Loading Graphic system at " &lt;&lt; res_x &lt;&lt;
"x" &lt;&lt; res_y &lt;&lt; "x" &lt;&lt; color_depth &lt;&lt; "bits...\n";
<BR>clear_keybuf();
<BR>fade_out(1);
<BR>set_color_depth(color_depth);
<BR>short int g_result = set_gfx_mode(GFX_ATI, res_x, res_y, 0, 0); //
*** TO CAUSE THE ERROR, WORS IN AUTO_DETECT
<BR>if (g_result &lt; 0)
<BR>&nbsp;&nbsp; {
<BR>&nbsp;&nbsp; stop(1);
<BR>&nbsp;&nbsp; textcolor(LIGHTRED);
<BR>&nbsp;&nbsp; cprintf("Error, graphic initialisation failed...Aborting...\n\r");
<BR>&nbsp;&nbsp; cprintf("Possible error(s):\n\r");
<BR>&nbsp;&nbsp; textcolor(WHITE);
<BR>&nbsp;&nbsp; cprintf("%s", allegro_error);
<BR>&nbsp;&nbsp; exit(1);
<BR>&nbsp;&nbsp; }
<BR>else cout &lt;&lt; endl;
<BR>return g_result;
<BR>}
<P>void engine::stop(ushort error_num)
<BR>{
<BR>allegro_exit();
<BR>clrscr();
<BR>textcolor(WHITE);
<BR>textbackground(RED);
<BR>cprintf("Stoping Omega Engine&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
");
<BR>normvideo();
<BR>cout &lt;&lt; "All systems unloaded..." &lt;&lt; error_num &lt;&lt;
" errors.\n\n";
<BR>textcolor(WHITE);
<BR>}
<P>Thanks, Nicolas Blais</HTML>

- Raw text -


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