gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Pointers to included arrays

#2312 - krozen - Sat Feb 01, 2003 11:33 pm

Hello,
He he, im really botherin u guys now. Just wondering, I have a piece of software which produces a map, which i then use in my game via a .h file. This map is a big 1D array. I was just wonderin if it is possible to have a pointer which points a different included maps i.e If i have a function which reads the contents of an array, and uses that to draw to screen, can I have a pointer in this function which switches between different included arrays/maps, or when ur pointing to arrays, does it need to be always declared within the code.
Thanks for your help

#2314 - Splam - Sun Feb 02, 2003 12:24 am

The arrays will just be named (by you) as something sensible like Leve1Map Level2Map, you can then either have an array of pointers holding each of those names or a switch statement which sets up a pointer which equals one of those map names. Either method you just have a (something like) CurrentMap pointer and when it comes to choose the level you want to display you just do (in the case of the switch method) CurrentMap=Level?Map; depending on which map you want to display.

#2322 - Maddox - Sun Feb 02, 2003 2:32 am

Welcome to kindergarden.
_________________
You probably suck. I hope you're is not a game programmer.

#2355 - krozen - Sun Feb 02, 2003 11:58 am

Hello,
Thanks for help Splam.
Quote:
Welcome to kindergarden.

Sorry Maddox, not all of us were born, like you, with a game boy advance in hand, and an innate ability for developing software.
Ive seen u on this before, all you do is give abuse to people who ask what you consider to be foolish questions. We all have to start somewhere.
Im sure you did too.

#2366 - tepples - Sun Feb 02, 2003 3:45 pm

Maddox:

The nice way to help a newbie is to give the URL of a web page that answers that question as well as several other questions. When I was a regular in the comp.os.msdos.djgpp newsgroup, people found that strategy much more helpful than a mere "RTFM" or, worse, insulting the poster's intelligence.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#2375 - Maddox - Sun Feb 02, 2003 7:03 pm

Quote:
The nice way to help a newbie is to give the URL of a web page that answers that question as well as several other questions.


book

book

book

book

book

book

book

book

book

book

book

book

book

book

book

book

book

book

book

book

I hope this is enough to get you started. I placed the ones I feel would be most useful to you at the top.

I have to warn you, though. I just don't know if any of them spell it out for you like splam was nice enough to do.

Quote:
Sorry Maddox, not all of us were born, like you, with a game boy advance in hand, and an innate ability for developing software.
Ive seen u on this before, all you do is give abuse to people who ask what you consider to be foolish questions. We all have to start somewhere.
Im sure you did too.


Contrary to the obvious, I was not born with a GBA in my hand, but a brain in my head! It's true! We all have to start somewhere. I started by reading books. I still read books--they're awesome! I assume that if you can figure out how to post on a forum, you can also read. Good for you! You should go read a book. If you can't afford a book and its not near Christmas or your birthday or whatever, you can actually go to a search engine, say google.com, and type something like, "C programming tutorial." That way people won't catch you on the forum posting, "How can I use C/C++/ASM to change my maps. Gee willakers, there must be someway because Mario has more than one map, I think..."
_________________
You probably suck. I hope you're is not a game programmer.

#2457 - animension - Tue Feb 04, 2003 10:11 am

Maddox, I think you should read this book:

http://www.amazon.com/exec/obidos/tg/detail/-/1558535969/qid=1044349316/sr=8-1/ref=sr_8_1/103-7516559-6039005?v=glance&s=books&n=507846

Perhaps this might give you some dearly needed insight on how to be a human being and not an arrogant jackass. We all have our shortcomings and should be tolerant of others. I still have yet to meet someone who actually earned the privilege of thinking, worse yet, acting like they are cut above the rest of human society. Get off your high horse. If you're going to bother posting a reply, make it a useful one and not a waste of our time.

I agree that a lot of individuals should first try things on their own and then ask questions when they get stuck, but some people learn more effectively by discussion and Q&A rather than strict reference reading. I challenge you to learn the Portuguese language, strictly by reading a book or two, never asking a question of someone who might know something of the language, and see how productive that is.

BTW, your signature has a typo in it. "Your" should be "you're", as in a contraction for "you are". "Kindergarden" is "kindergarten". Learn how to use a dictionary, jackass.

Welcome to kindergarten.
_________________
"Beer is proof that God loves us and wants us to be happy."
-- Benjamin Franklin

#2601 - slapout - Sat Feb 08, 2003 7:26 pm

Maybe after enough newbies (and I consider myself in that category) have asked questions here, someone can put together a FAQ list of the most asked ones. Then we they ask a "simple" question someone can just say "check out question 8 on the FAQ." Maybe newbies can put "newbie" somewhere in the subject line so those who don't want to deal with them can just ignore those post.

What's the point of having a message board if it's not to help each other out.

#2629 - tepples - Sun Feb 09, 2003 5:29 pm

FAQ list? I'm working on one.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.