I'm making a 13h, DJGPP-compiled game. I just
wrote a function that writes letters to the
screen (and it took me a long time. Not a good
programmer )The function accepts two parameters;
a position-variable, and a text-string...
Code:
#define A 0
#define B 1
#define C 2
class cXYCOORD{
public:
int x;
int y;
};
void WriteText(cXYCOORD Position, char *string){
int StringLength = strlen(string);
int Pixels = Position.x;
for(int i=0;i<StringLength;i++){
int choice = string[i];
switch(choice){
case 65: Alphabet[A]->image->DrawImage(Position); break;
case 66: Alphabet[B]->image->DrawImage(Position); break;
...
/*More Lines of Code. Moves to another line,
etc. They aren't important, though*/
}
}
}
Here's my question. Back at the old, blue cprog
board, I asked how to pass a text-string along
a function. Someone said I should declare a
char pointer as a parameter. I did. char *string.
What exactly is this variable holding when I
pass a string through it, though? Pointers hold
variable-addresses, right? What am I assigning to
this pointer? It isn't an address... Is this a
bad way of passing a string? Will my program/game
screw up later?
WriteText(RightHere, "Write This");
Thanks a lot,
ethic.