www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/02/21:56:43

Xref: news2.mv.net comp.os.msdos.djgpp:3361
From: nmarrone AT smartlink DOT net (Nicholas Marrone)
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro and GUI Routines
Date: Thu, 02 May 1996 01:39:34 GMT
Organization: SmartLink.net Premier ISP 805-294-1273
Lines: 83
Message-ID: <4m95c1$c0p@frodo.smartlink.net>
NNTP-Posting-Host: pm42-52.smartlink.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hullo,
	I've been using Allegro with a fair amount of success, and wanted to
make a PGN file reader (it has to do with chess files). I started to
make dialouges, and was able to use things like boxes and text, but
once I started to try out push buttons, DJGPP crashed! It's quite
frustrating because I can't see any difference between my code and the
example's, and that compiled correctly. Here is some of the code for
it so far, and this crashes pointing to the function  do_dialog. 

#include <nick/allegro.h>

int next_proc(int msg, DIALOG *d, int c);
int back_proc(int msg, DIALOG *d, int c);


DIALOG main_dlg[] =
{
   { d_clear_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, NULL },
   { d_ctext_proc, 320, 4, 1, 1, 255, 0, 0, 0, 0, 0, "PGN File Reader,
Version 1.0" },
   { d_ctext_proc, 320,  20, 1, 1, 255, 0, 0, 0, 0, 0, "By Nicholas
Marrone, 1996" },
   { d_box_proc, 20, 50, 360, 360, 255, 0,  0,  0, 0, 0, NULL },
   { d_list_proc, 450, 50, 120, 330, 255, 0,  0,  0, 0, 0, NULL },
   { next_proc, 450, 340, 50, 20, 255, 0, 0, 0,  0, 0, "Next" },
   { back_proc, 450, 340, 50, 20, 255, 0, 0, 0, 0, 0, "Back" },   
   { NULL }
};


void main()
{
   int c;

   allegro_init();
   install_keyboard();
   install_mouse();
   install_timer();

   if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) {
      allegro_exit();
      printf("Error setting graphics mode\n%s\n\n", allegro_error);
      exit(1);
   }
   
   gui_fg_color = 255;
   gui_bg_color = 16;
   set_pallete(desktop_pallete);
   
   do_dialog(main_dlg, -1);

   allegro_exit();

   exit(0);
}

int next_proc(int msg, DIALOG *d, int c)
{
   int ret = d_button_proc(msg, d, c);

   if (ret == D_CLOSE) {
      alert("You have selected Next", NULL, NULL, "Continue", NULL,
27, NULL);
      return D_REDRAW;
   }

   return ret;
}

int back_proc(int msg, DIALOG *d, int c)
{
   int ret = d_button_proc(msg, d, c);

   if (ret == D_CLOSE) {
      alert("You have selected Back", NULL, NULL, "Continue", NULL,
'C', NULL);
      return D_REDRAW;
   }

   return ret;
}


- Raw text -


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