delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/02/16:39:57

From: "Brian" <none AT noemail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: My program's a machine killer!
Lines: 59
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <2d1m4.294$oU2.94919@tw12.nn.bcandid.com>
NNTP-Posting-Host: 216.54.139.55
X-Trace: tw12.nn.bcandid.com 949526462 216.54.139.55 (Wed, 02 Feb 2000 14:21:02 MST)
NNTP-Posting-Date: Wed, 02 Feb 2000 14:21:02 MST
Organization: bCandid - Powering the world's discussions - http://bCandid.com
Date: Wed, 02 Feb 2000 21:21:02 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

When I run the short little program below, my PC reboots. I don't have VESA
so I set my graphics mode to VGA 320x200. I don't know if this is a problem.
(SciTech wouldn't work with my machine) Can anyone spot the problem on the
code below? Specifically the clear_to_color() function. I'm just trying to
load a list box and turn the background color to black. I'm new to graphics
programming, so if there's an easier way to do this, please tell.

#include <stdio.h>
#include <stdlib.h>

#include "allegro.h"

char *listbox_getter(int index, int *list_size)
{
    static char *strings[] =
    {
        "Entry 1", "Entry 2", "Entry 3"
    };

    if (index < 0)
    {
        *list_size = 3;
        return NULL;
    }
    else
        return strings[index];
}

DIALOG the_dialog[] =
{
    { d_list_proc,    0,      100,    320,    100,
                      0,      255,    0,      0,
                      0,      0,      listbox_getter },

    { NULL,           0,      0,      0,      0,
                      0,      0,      0,      0,
                      0,      0,      NULL }
};

#define LISTBOX_OBJECT      3

int main(int argc)
{
    int ret;

    allegro_init();
    install_keyboard();
    set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
    clear_to_color(screen, 0);
    ret = do_dialog(the_dialog, -1);

    readkey();
    return 0;
}

Thanks,
Brian


- Raw text -


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