delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/23/01:02:39

From: "Laine" <laine AT iwn DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Help!!! Allegro and color-things?
Date: Fri, 21 Nov 1997 09:01:45 +0200
Organization: ***
Lines: 49
Message-ID: <653cea$aei$1@news.clinet.fi>
NNTP-Posting-Host: dialup210.iwn.fi
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello!

I'm doing a menu-screen for my game and I've
thought I'd do it by changing some colors in the
palette every time the player presses up or down.
It doesn't work. Every time I press up or down, it
crashes (it just quits the program with no explanations).

Here's the code, why doesn't it work?

// The getcolor-part:

set_palette(paletti);

get_color(224,blue);
 get_color(225,gray);

// And the routine to change the colors:

 y=1; // This is just to know which option is selected


e(!key[KEY_ESC]){  
      if(key[KEY_UP]){
           set_color(224+y,gray);  // 224 is the index of the first color
                                                    // I use in the options, Here I make the current color (224+y)
                                                    // gray so that it's not selected anymore
            y--; 
           set_color(224+y,blue);  // And after changing "y", we change the new color to blue
    }
    if(key[KEY_DOWN]){    // Same thing but going down
          set_color(224+y,gray);
          y++;
          set_color(224+y,blue);
    }
  }

Thanks for your help! 

Jarkko
----------------------------------------------------------------------------
                        Jarkko  Laine
          e-mail: Jarkko DOT Laine AT ks DOT iwn DOT fi
WWW: http://www.geocities.com/SiliconValley/Peaks/7734
-----------------------------------------------------------------------------




- Raw text -


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