Logic Prob and Images Questions
Displaying 1-11 of 11 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ever-b

Hello there,

I'm having a bit of a problem in VERGE with my while statement.

It gives me an error when I do the following, or at least, this is where the error comes from:

while (x > -100)

I thought maybe there was something I missed in C++ class, but I guess I didn't. Could someone fill me in why this doesn't work?

Second Q,

After you've drawn stuff the screen? How do you clear it? For example, I made this lame little program that draws a bunch of rectangles and blit's an image repeatedly, but all of the previous rectangles and blit's remain and I can't seem to decipher anywhere in the alpha documentation how to clear previous drawings. Help?

Posted on 2004-04-24 05:19:38

rpgking

Right now, to do negative numbers in Verge, you have to use "0-" instead of just "-". So in your code it would be:


while(x > 0-100)

Posted on 2004-04-24 05:37:46 (last edited on 2004-04-24 05:38:10)

resident

Dunno if theres a cls(); function, but if there isn't it's easy enough to make one. Just rectfill(); the whole screen in the colour of your choice.

I love easy questions. They make me feel smart :D

Posted on 2004-04-24 09:51:48 (last edited on 2004-04-24 09:57:47)

Overkill

If you use maps then Render(); will clear the screen and redraw the map.

Otherwise, as resident stated, use:

RectFill(0,0,ImageWidth(screen),ImageHeight(screen),rgb(0,0,0),screen);

Posted on 2004-04-24 18:24:24

mcgrue

A hint for sanity's sake: I find it useful to have global color variables so you're not repeating rgb() all over the place.

int clrBlack;

clrBlack = RGB(0,0,0);

etc. Also, if you make variables for menu colors and menu borders, you can make sexy config menu options to change them. Yay.

Posted on 2004-04-24 23:44:36

Zip

For even more sanity's sake:
RGB(0,0,0) returns, unsurprisingly, 0.

int cWhite = RGB(255, 255, 255); at the top of your code somewhere is useful though (but adds to my ever expanding list of global variables - yet another bad programming habit being hammered into me by verge)

As a side note, the ints you pass RGB get a % 255 to keep them within limit, leading to all sorts of funky overflow effects.

Negative numbers in v3 are very odd at them moment, negative values are stored, but often interpreted as 0. For the moment at least, staying positive will save you a lot of headaches.

Zip

Posted on 2004-04-25 00:38:44

Gayo

You might as well use #defines for the eight basic colours to save on memory. #define COLOR_BLACK $000000, and so on.

Posted on 2004-04-25 03:33:55

mcgrue

Gayo.

Memory is *NOT* a big deal any more. It doesn't need to be saved.

Posted on 2004-04-25 03:39:55

Gayo

But it doesn't need to be wasted either! I mean, there's no conceivable advantage to having them as variables instead of defines.

Posted on 2004-04-25 08:46:50

andy

The compiler can be more helpful if it's a variable. It'll say 'cRed' instead of dumping some weird hex value if you use it someplace you can't.

(this is one reason why it'd be good if the preprocessor was eradicated altogether)

Posted on 2004-04-25 19:38:17 (last edited on 2004-04-25 19:38:55)

RageCage

I still agree with gayo, #defines are MEANT for things like this. It some how seems so much cleaner that way too.

Posted on 2004-04-26 00:27:52


Displaying 1-11 of 11 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.