Mail Archives: djgpp/1999/02/21/13:57:16
hi guys, i'm taking beginner lessons in djgpp/allegro and i have 2
questions regarding output of the short program below.
1.) why does the background color of the textout() functions alternate
between red and black? (e.g. click on "rectangle", background of textout
is black, click on "circle", background of textout is red, click on
"triangle", background of textout is black, etc ...)
2.) why is there a tick beside the 'circle' menu option? how can i
remove that tick?
thanks in advance.
#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>
#define MAX_MAIN_MENU 4
void SetMenu(MENU []);
void main() {
int Option;
MENU MenuItems[MAX_MAIN_MENU + 1];
allegro_init();
install_keyboard();
install_mouse();
install_timer();
if (!set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0)) {
set_palette(desktop_palette);
SetMenu(MenuItems);
Option = 0;
while (Option != MAX_MAIN_MENU - 1) {
Option = do_menu(MenuItems, 10, 10);
switch(Option) {
case 0:
textout(screen, font, "Triangle", 250, 250, 2);
readkey();
break;
case 1:
textout(screen, font, "Circle", 250, 250, 2);
readkey();
break;
case 2:
textout(screen, font, "Rectangle", 250, 250, 2);
readkey();
break;
}
clear(screen);
}
}
}
void SetMenu(MENU MenList[]) {
char *MenText[] = {"&Triangle", "&Circle", "&Rectangle", "&Exit"};
int Item;
gui_fg_color = 7;
gui_bg_color = 1;
for (Item = 0; Item < MAX_MAIN_MENU; Item++) {
MenList[Item].text = MenText[Item];
MenList[Item].proc = NULL;
MenList[Item].child = NULL;
}
MenList[MAX_MAIN_MENU].text = '\0';
}
--
regards,
lee, you know who.
===========================================================
figure out what to remove in email address. i tire of spam.
===========================================================
Suppose you were an idiot. And suppose you were a member of
Congress. But I repeat myself. -- Mark Twain
===========================================================
- Raw text -