From: William F B L. <zh...@nt...> - 2003-07-28 12:27:15
|
thanks ----- Original Message ----- From: "Neil Roy" <ne...@co...> To: <all...@li...> Sent: Sunday, July 27, 2003 10:24 PM Subject: Re: [AL] help understanding a few things > William F B Labbett wrote: > > > hi again, > > > > i really want to understand this > > file (attached) which Marcel > > wrote to help me do something > > as i think i could learn a fair bit from it. The trouble is i've > > never learnt any C++ and am reluctant to do so until > > i feel better about programming in C. > > Marcel has said there's only > > a little C++ in it so i should be okay if i try a little harder. > > The C++ portions of that code is where he defines the variables in the > middle of the code, this is about the only thing I don't like about C++, > I think it is messy and variables should be defined at the beginning of > a function. > I am no expert on C++ but I am wondering if it is even okay to define a > constant variable in the middle of a loop like that? > > > I don't understand the contents of the for loop. > > For instance where are things like getb etc deifined? > > getb() is an allegro function, it gets the blue component of an RGB > value (the pixel colour he read from Source was stored in CS and then > getb() was used to extract how much BLUE was in that pixel). > > > Also, i'd like to understand what the first define does; > > > > #define ALLEGRO_USE_CONSOLE > > Probably tells Allegro that you will be using the console as opposed to > windows. (console mode = dos text mode) > > > i've only ever used defines for defining > > constant values. > > It is simply defining that label really, with no value. Allegro will > check to see if if has been defined something like this... > > #ifdef ALLEGRO_USE_CONSOLE > //do stuff here if it is defined > #endif > > But remember, #defines aren't really C/C++ code but rather compiler > directives. When you use something like #include you are telling the > COMPILER to include that files contents at the beginning of the current > file you are working on. When you #define it is similar, the compiler > checks to see if ALLEGRO_USE_CONSOLE is defined in that above #ifdef and > if it is, it will compile the code in between #ifdef and #endif. If it > isn't defined than that code will not be compiled at all and never be > part of the final executable. > > > -- > Neil Roy - http://home.cogeco.ca/~nroy15 > > "My religion consists of a humble admiration of the illimitable superior > spirit who reveals himself in the slight details we are able to perceive > with our frail and feeble mind." - Albert Einstein > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > -- > https://lists.sourceforge.net/lists/listinfo/alleg-main |