Page 14 of 21 FirstFirst ... 4910111213141516171819 ... LastLast
Results 196 to 210 of 307

Thread: Coder's Hang-out

  1. #196
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Short version: Yep.

    Longer version: I hope you understand the * operator. Now, we have a pointer, p.
    *p returns the value which p points to (p holds the memory address of that value.). p+1 is the next element from that address, and so forth. So, *(p+1) is the value of the next element from p. Shorthand form of it is p[1]. So, sprites[0] is pretty unnecessary, since it converts to *(sprites+0). As you can see now, (*sprites).x is the same as sprites->x. ( a->n converts to (*a).b)
    The reason you can't use simply the . operator is because C passes copies of a variable into a function, most likely. That would mean that modifying it wouldn't do you any good, since it's just a copy, that gets discarded when you exit the function. However, if that variable is a memory address (pointer) you can just as well point to the same area with a copy, therefore allowing you to manipulate the data stored at that address with ease.

    If the above didn't make much sense, don't worry, I suck at explaining stuff. Also, probably the only thing that you'll be able to screw up, no matter how experienced you are, are pointers.

  2. #197
    Join Date
    May 2002
    Location
    Méxique
    Posts
    10,738
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Even shorter: Use -> for pointers (i.e. dynamic memory), and . for arrays and such (static memory?)...

  3. #198
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    Thanks both of you. That made no sense so no problem. I know abouts pointers but I still need to work with them more. Unsure about all the different ways you can declare one. Still, thanks for clearing that up for me.

    Just one thing, "sprites[0]" is not unnecssary. The GBA can store a maximum of 128 different sprites and they are all stored in the Object Attribute Memory. So you know, I have to tell which sprite it is I'm using, out of all those 128 ones. And you can't just write a single one to the memory. All of them have to be copied at ones. So basically, I have created a structure array with 128 fields, each for one sprite.

    Thanks again, really helped me understand that stuff better.

  4. #199
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    I was just pointing out that "sprites[0]" is totally and exactly the same as "*sprites". Obviously if you're using more than one, it just makes sense to access even the first element with the array subscript operator, so yeah.

  5. #200
    Join Date
    May 2002
    Location
    Méxique
    Posts
    10,738
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Or simply "sprite", at least it works that way in Java, so piss off...

    BTW, I hate Java... XD

  6. #201
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    And that's why you are using it?

    By the way, jumping is working now. It's horrible though. I have to speed it down and well, implant proper graviation. But at least I've come this far.
    Attached Files Attached Files

  7. #202
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    http://www.epforums.org/showthread.php?t=43397

    Hmm, this looks pretty ok, might sort it out alphabetically and in an relevant order, such as console programming etc etc.

  8. #203
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Hmm, I have a small inquiry regarding C

    I would like to create something that when a single character is entered you are prompted

    for example I would enter the letter "c" then because I entered this single character an option would come up?

  9. #204
    Join Date
    Jan 2007
    Posts
    1,156
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hmm, I have a small inquiry regarding C

    I would like to create something that when a single character is entered you are prompted

    for example I would enter the letter "c" then because I entered this single character an option would come up?
    You could use a switch statement to do that.

  10. #205
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Hmm, a simple thing I could have looked over, if it turns out to be the case, I'm going to kick myself.

  11. #206
    Join Date
    Feb 2005
    Location
    Finland
    Posts
    473
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Anyone know good sytes for allegro?
    Definition: "love" is making a shot to the knees of a target 120 kilometers away using a Aratech sniper rifle with a tri-light scope


    :: There are one-zero kinds of people. Those who understand binary and F others who understand hex ::




    Webmaster of:
    http://Irregular-Network.22web.net


    My PSX ISO's List:
    updated 4.01.2006 (way pass expiration date, but I still got all what's on the list so request away)
    Here

  12. #207
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

  13. #208
    Join Date
    Feb 2005
    Location
    Finland
    Posts
    473
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's a good syte, thanks.
    Definition: "love" is making a shot to the knees of a target 120 kilometers away using a Aratech sniper rifle with a tri-light scope


    :: There are one-zero kinds of people. Those who understand binary and F others who understand hex ::




    Webmaster of:
    http://Irregular-Network.22web.net


    My PSX ISO's List:
    updated 4.01.2006 (way pass expiration date, but I still got all what's on the list so request away)
    Here

  14. #209
    Join Date
    Aug 2004
    Posts
    6,802
    Thanks
    30
    Thanked 98 Times in 49 Posts
    EP Points
    205

    Default

    Hmm, I'm going to be dabbling in some DS programming there are actually quite a few small tutorials, but for the time being I'm going to try out this one http://www.dsprogramming101.com/

  15. #210
    Join Date
    Jan 2007
    Posts
    1,156
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The NES programming link has died
    http://www.epforums.org/programming-...x.html?t=43397

Similar Threads

  1. Visit The Hang Out!
    By Georgyw5k in forum Free 4 All
    Replies: 5
    Last Post: 28th-November-2003, 05:18
  2. Do You Hang Up On Advertisement Callers?
    By ((KvN)) in forum Free 4 All
    Replies: 52
    Last Post: 21st-July-2003, 11:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About Us

We are the oldest retro gaming forum on the internet. The goal of our community is the complete preservation of all retro video games. Started in 2001 as EmuParadise Forums, our community has grown over the past 18 years into one of the biggest gaming platforms on the internet.

Social