Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 755 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using a #define value in a vslider definition #208071
05/24/08 15:19
05/24/08 15:19
Joined: Mar 2008
Posts: 12
M
miko93 Offline OP
Newbie
miko93  Offline OP
Newbie
M

Joined: Mar 2008
Posts: 12
Hello all.

I'm trying to use a "#define XX" value in my vslider definition, but somehow this won't work. Please take a look at this code here:

Code:
#include <acknex.h>
#include <default.c>
#include <stdio.h>
#include <windows.h>

#define MYRANGE 50

BMAP* bmSlider = "slider.bmp";
var   SliderPosition = 1;

PANEL* pPanel1 = // This works ok.
{
	flags =  VISIBLE; 
	vslider = 494, 2, 125, bmSlider, 1, 50, SliderPosition;
}

PANEL* pPanel2 = // This gives a syntax error, pointing to MYRANGE.
{
	flags =  VISIBLE; 
	vslider = 494, 2, 125, bmSlider, 1, MYRANGE, SliderPosition;
}


function main(void)
{
	video_mode = 8; // 1024x768
	fps_max = 60;
		
	level_load("");
	wait(3);
	
	while (1)
	{
    	wait (1);
	}
}


The problem is that as soon as I try to use the #define'd value in my definition of vslider (2nd panel), the compiler gives out a "number syntax" error.

Any hints why this is not working? Thanks a lot.

Re: Using a #define value in a vslider definition [Re: miko93] #208072
05/24/08 15:22
05/24/08 15:22
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
Maybe the compiler does simply not allow macros in panel definitions?


MfG, Christian__A. Visit my Site: www.chris-a.de


Re: Using a #define value in a vslider definition [Re: Christian__A] #208142
05/25/08 08:15
05/25/08 08:15
Joined: Mar 2008
Posts: 12
M
miko93 Offline OP
Newbie
miko93  Offline OP
Newbie
M

Joined: Mar 2008
Posts: 12
Christian, thanks, yes. After some more tests, this is the most obvious reason, I think.
Although not being a real problem, it is some sort of "inconsistency", as preprocessor constants should be available everywhere in the code (at least, imho).

Maybe, I should point this out at the bughunt forum...


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1