cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/26/21:13:57

From: eblazecka <eblazecka AT bc DOT sympatico DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro mode setting problem
Date: Sun, 26 Jan 1997 12:38:42 -0800
Organization: BCTEL Advanced Communications
Lines: 50
Message-ID: <32EBC0D2.5C7F@bc.sympatico.ca>
Reply-To: eblazecka AT bc DOT sympatico DOT ca
NNTP-Posting-Host: nwmr01m04-156.bctel.ca
Mime-Version: 1.0
CC: CC
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I am trying to write a program in C++ using DJGPP 2 and
Allegro 2.1, but am having problems with the mode-setting
code. My application needs to switch between the available
graphics modes, but when I try to do so, I get unusual
results. If I try to change the graphics mode more than
once, weird things start happening. The mouse no longer
displays properly, text just looks like a rectangle,
random blips appear on the screen, etc etc.

I stepped through the source code for the functions that I
called, but couldn't find anything. I even tried completely
shutting down Allegro (by calling allegro_exit()) and
re-initializing it before setting a new graphics mode, but
that didn't work either (it actually made things worse
since it screwed up the atexit functions). I reduced the
code down to this, which produces the exact same results
as my program.


#include <stdio.h>
#include <allegro.h>

int main(void)
{
  int card, w, h;
  allegro_init();
  install_timer();
  install_mouse();
  install_keyboard();
  set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
  gfx_mode_select(&card, &w, &h);
  set_gfx_mode(card, w, h, w, h);
  show_mouse(screen);
  int done = FALSE;
  while(!done) {
    if(keypressed())
      if((readkey() & 0xFF) == ' ')
        gfx_mode_select(&card, &w, &h);
        set_gfx_mode(card, w, h, w, h);
        textout(screen, font, "This is a test string", 32, 32, 255);
      }
      else
        done = TRUE;
  }
}

Thanks in advance.

Ryan Blazecka
eblazecka AT bc DOT sympatico DOT ca

- Raw text -


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