delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/21/13:57:16

From: "The Lee, You Know Who" <lklusr AT mbox4 DOT removethis DOT singnet DOT com DOT sg>
Newsgroups: comp.os.msdos.djgpp
Subject: help on allegro menus
Date: Mon, 22 Feb 1999 02:27:00 +0800
Organization: Singapore Telecommunications Ltd
Lines: 86
Message-ID: <36D04FF4.E9500D62@mbox4.removethis.singnet.com.sg>
NNTP-Posting-Host: qtns01703.singnet.com.sg
Mime-Version: 1.0
X-Mailer: Mozilla 4.04 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


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