C/C++ Programming Help Thread
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Ok, i am still looking for 2 things: 1) How to flip an image using oslib (my signature sprite from ...
-
01-10-2008, 06:45 PM #7441QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Ok, i am still looking for 2 things:
1) How to flip an image using oslib (my signature sprite from right to left)
2) A good scrolling tile engine (i tried to make one...not so well). If i can just get a good example...i have been asking for this quite some months now...
Sorry for being an idiot.
Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
01-10-2008, 07:13 PM #7442QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
I didnt know how to go about it. Why research C structs if im not sure i need them. I was just asking for a push in the right direction, i could do the rest myself. And i apologised about the bad explaination. Im sorry for not knowing everything about C, which you obviously do.
Zitat von _dysfunctional
@TMNT, thanks, iv never used switch statements before, they seem perfect for what i want to do after reading a little about them
-
01-10-2008, 07:21 PM #7443Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Wow. i just looked and found it within 5 seconds:
Zitat von TMNT
oslMirrorImageH(img)
oslMirrorImageV(img)
Mirrors an image horizontally (H) or vertically (V). You can then draw it using oslDrawImage.
Note: For experimented users, the image is not really mirrored, but just its internal coordinates that are modified, so it's very fast.
from the docs.--------------------------------------------------------------------------------------
-
01-10-2008, 07:28 PM #7444QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
I knew what a mirror was, lol. But i was too busy looking for "flip" so i overlooked it. Thank you and i found it too in the docs.
Zitat von Grimfate126
Thanks Grim!Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
01-10-2008, 07:31 PM #7445QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
My point is that if you obviously know so little about C, you should not be using it. Go read a book.
-
01-10-2008, 08:14 PM #7446Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
if you dont use it, you will stop learning the language. just because you suck at something doesnt mean you have to stop using it. i agree with the book part though. books help.
--------------------------------------------------------------------------------------
-
01-10-2008, 11:58 PM #7447words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Wouldn't scaling the image, horizontally and/or vertically, by a factor of negative 1 produce the same effect? I always was going to rely on that should i ever need to flip an image, didn't know there was function for it

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
01-11-2008, 12:12 AM #7448
wasn't this thread about helping each other? i've read C and C++ books, but still can't understand everything. especially how unsigned integers work.
I most definitely agree with grimfate. i learnt most of my coding skills from actually working with the code. I used a lot of src code to get to where I am today, not to mention the value of all those maths classes...
just my little thought =]
-
01-11-2008, 12:25 AM #7449QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
The one from the Aap lander beta Source code should help you quite a bit, it has the functions to Read, and Draw maps that you specify, its all so pretty Fast, as it doesn't draw the tiles out side the screen AND it uses osl's clipping function. If you need help weeding the things out that are game specific, then go ahead and post parts of the source thats a problem. I don't mind, since Aap lander will be open source from the get go any way. As for the map format, its very simple, it first reads the width and height of a map in the first line, and then loads them into a ray, each number seperated by spaces. and in the DRAW function, it goes through 2 for loops one for x and one for y to draw what ever number is there. It also scrolls if the maps are bigger than the screen, and stops when approaching edges.
Zitat von TMNT
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
01-11-2008, 04:52 AM #7450Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
actually, i think its a macro O.o
Zitat von SG57
i dunno about scaling, but it might work.--------------------------------------------------------------------------------------
-
01-11-2008, 04:55 AM #7451QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
OMG!!! You are back! I missed you so much. Yes, that is a good idea.
Zitat von SG57
Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
01-11-2008, 12:28 PM #7452QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Unsigned just means the value cannot be less then zero...
Zitat von pHysiX
-
01-11-2008, 12:48 PM #7453It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
It also means you get basically twice as many positive values. So an int usually goes from -2^31 to 2^31-1. However, an unsigned int goes from 0 to 2^32-1.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
01-11-2008, 02:27 PM #7454
My site has a small snippet on structures. Maybe I should make one on switch statements too.
Zitat von Xsjado7
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
01-11-2008, 04:35 PM #7455Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
switches are extremely easy to understand. search on google, and youll have them in no time. structures too, but theyre a bit more complicated, when you get into pointers.
--------------------------------------------------------------------------------------
-
01-11-2008, 05:57 PM #7456
Yeah, switches are so usefull, and that's why I was pissed when I found out they weren't in Lua. :Argh: And pointers are stupid altogether. :mad:
Zitat von Grimfate126
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
01-11-2008, 06:54 PM #7457Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Oh yeah pointers are totally stupid...
You could just pass all the data around through functions, but then you'd be back asking questions about pointers when your program won't get above 1 FPS.
Pointers are your friend.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
01-11-2008, 08:58 PM #7458sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
Pointer are magic ;)
You can't live with 'em, you can't live without 'em.
-
01-11-2008, 09:18 PM #7459Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
pointers are gods in disguise. if you cant use em, them yes, they "suck", but thats not their fault ;)
--------------------------------------------------------------------------------------
-
01-12-2008, 07:00 AM #7460
When I said pointers are stupid, I meant I hate using them. Sometimes they can be so difficult. That doesn't mean I don't think they're useful. Hopefully after I've been programming a few years, I'll be better with them. (I'm only going on one year of programming in C.)
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
01-12-2008, 03:18 PM #7461QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
So am I...
Zitat von Judas
-
01-12-2008, 04:22 PM #7462QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Finland
- Beiträge
- 752
- Points
- 7.385
- Level
- 57
- Downloads
- 0
- Uploads
- 0
Yeah but we all know that you're just inhuman.
Zitat von _dysfunctional
wheeee =:D
-
01-12-2008, 08:39 PM #7463QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
For a second, I thought you were about to post something relevant to C <_<.
Zitat von MaTiAz
Anyway, I started C in December 2006 and had pointers down way less than one year after I started. Pointers are extremely useful. I don't see how you can actually hate them Judas. At first I didn't see the actual point of accessing a variable using pointers, but that changed after I read a paper about them.
This post isn't really related to helping people in C, but I felt that I wanted to share that little bit <_< .[CODE]Random Facts:
irc://irc.malloc.us #wtf #**********
[/CODE]
[SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]
-
01-12-2008, 09:05 PM #7464Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
exactly. i remember i made a post in this thread a couple years ago saying "pointers seem pointless". boy was i wrong...
--------------------------------------------------------------------------------------
-
01-13-2008, 08:07 AM #7465
That's exactly why I never like them. They added more difficulty to something that I was already struggling with. And on top of that, I couldn't see a real use to using one. Now that I'm a little more advanced in C, I see the purpose of one, but still don't use them that much. Maybe when I start using them a lot, they'll become a bit more friendly.
Zitat von Grimfate126
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
01-13-2008, 09:31 AM #7466QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Gah, pointers. Hate the buggers. Dangling pointers, uninitialised pointers, pointers to pointers, deep and shallow copying, etc.
I generally avoid raw pointers as much as possible and use C++ references or write wrapper classes (RAII) to minimise memory leaks. I can't wait till smart pointers are part of the standard.[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
01-13-2008, 10:13 AM #7467
hey if i wanted to make a formula with an exponent, i have
result = pi*r^2;
this is wrong though i get errors.
how would i make an exponent, ive also tryed re2, r^=2, but nothing has worked.
-
01-13-2008, 10:24 AM #7468QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
^ is a bitwise XOR in C, use the pow() function from math.h.
Zitat von Blackbelttcon
-
01-13-2008, 10:34 AM #7469
um so i should put
result= pi*r pow(2)
srry im just a little confused
-
01-13-2008, 11:28 AM #7470QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum