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; The problem is that you enter a never ending loop before flipping the screen. So you never run the flipScreen() ...
-
02-28-2007, 02:51 PM #3001Developer

- Registriert seit
- Feb 2006
- Ort
- Norway
- Beiträge
- 384
- Points
- 5.359
- Level
- 47
- Downloads
- 0
- Uploads
- 0
The problem is that you enter a never ending loop before flipping the screen. So you never run the flipScreen() function.
move the function call over the while(1) loop.
-
02-28-2007, 03:14 PM #3002
- Registriert seit
- Dec 2006
- Beiträge
- 14
- Points
- 3.536
- Level
- 37
- Downloads
- 0
- Uploads
- 0
thanks works now
-
02-28-2007, 06:10 PM #3003QJ 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
mm Im having no luck with this
Zitat von BlackShark
Does DoomPSP use the SDL library?
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
02-28-2007, 07:20 PM #3004
HI, I not that good at C so i wen to modify Insomniac Full Game Tutorial but I got some problems here is the code:
Everything compiles fine i get no error no warning but when I load it up on my psp it just stays black I can exit with Home but that about it.Code:#include <pspkernel.h> #include <pspdisplay.h> #include <pspctrl.h> #include "graphics.h" #include "game.h" PSP_MODULE_INFO("Game Tutorial Part 1: Menu", 0, 1, 1); #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) /* Exit callback */ int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } /* Callback thread */ int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } /* Sets up the callback thread and returns its thread id */ int SetupCallbacks(void) { int thid = 0; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) { sceKernelStartThread(thid, 0, 0); } return thid; } //GLOBAL VARIABLES int DifficultySetting = 1; int main(void) { SetupCallbacks(); initGraphics(); SceCtrlData pad, lastpad; sceCtrlReadBufferPositive(&lastpad, 1); Image* Background; Background = loadImage("./Images/Background.png"); Color EasyMode = RGB(0, 0, 0); Color MediumMode = RGB(0, 0, 0); Color HardMode = RGB(0, 0, 0); int StartMenu = 1; int DifMenu = 0; int StartPos = 1; extern int DifficultySetting; while(1) { sceCtrlReadBufferPositive(&pad, 1); if(pad.Buttons != lastpad.Buttons) { lastpad = pad; if(pad.Buttons & PSP_CTRL_CROSS) { if (StartMenu == 1) { StartMenu = 0; DifMenu = 1; DifficultySetting = 1; StartPos = 0; } else if (StartPos == 2) { sceKernelExitGame(); } else if (DifMenu == 1) { //Start The Game Game(); StartMenu = 1; } } if(pad.Buttons & PSP_CTRL_CIRCLE) { if (DifMenu == 1) { StartMenu = 1; StartPos = 1; DifMenu = 0; } } if(pad.Buttons & PSP_CTRL_UP) { if (DifMenu == 1) { DifficultySetting--; if (DifficultySetting < 1) DifficultySetting = 3; } else if (StartMenu == 1){ StartPos--; if (StartPos < 1) StartPos = 2; } } if(pad.Buttons & PSP_CTRL_DOWN) { if (DifMenu == 1) { DifficultySetting++; if (DifficultySetting > 3) DifficultySetting = 1; } else if (StartMenu == 1){ StartPos++; if (StartPos > 2) StartPos = 1; } } blitAlphaImageToScreen(0, 0 , 480, 272, Background, 0, 0); if (StartPos == 1) { printTextScreen(170, 140, "Start Game", RGB(191, 0, 0)); printTextScreen(170,150, "Exit",RGB(191, 170, 0)); } else if (StartPos == 2) { printTextScreen(170, 140, "Start Game", RGB(191, 170, 0)); printTextScreen(170,150, "Exit",RGB(191, 0, 0)); } else if (DifMenu == 1) { if (DifficultySetting == 1) { EasyMode = RGB(191, 0, 0); MediumMode = RGB(191, 170, 0); HardMode = RGB(191, 170, 0); } else if (DifficultySetting == 2) { EasyMode = RGB(191, 170, 0); MediumMode = RGB(191, 0, 0); HardMode = RGB(191, 170, 0); } else if (DifficultySetting == 3) { EasyMode = RGB(191, 170, 0); MediumMode = RGB(191, 170, 0); HardMode = RGB(191, 0, 0); } printTextScreen(170, 140, "Easy", EasyMode); printTextScreen(170, 150, "Medium", MediumMode); printTextScreen(170, 160, "Hard", HardMode); } sceDisplayWaitVblankStart(); flipScreen(); } sceKernelSleepThread(); return 0; } }Free Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
02-28-2007, 08:44 PM #3005Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
You just had a } in the wrong place mate, I've commented where in the code.
Spoiler for Code:
I didn't check for any other errors, but that should at least get you something on the screen :)
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
-
03-01-2007, 01:36 AM #3006QJ 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
mm, does DoomPSP need Visual C++ to compile or can DevCPP and/or batch file compile it?
and How can I get the SDL library? svn commands do not work for me for some reason.NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
03-01-2007, 05:26 AM #3007
Insert_Witty_Name I place the bracket at the end but I still have nothing it stays black and if I delete the bracket I get a error:
main.c: In function 'main':
main.c:179: error: syntax error at end of input
make: *** [main.o] Error 1
You think you see any other error because I don't.Free Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
03-01-2007, 07:17 AM #3008words 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
Zero - You need to add the bracket to where it belongs, not just the end of the file.
Ex:
See, that would compile without an error, but is very wrong, Same condition your in. It should be:Code:int main(){ pspDebugScreenInit(); for(int i = 0; i<10; i++; ) { printf("i = %i",%i); return 0; } }
Also, I think IWN gave you the correct version of your code.Code:int main(){ pspDebugScreenInit(); for(int i = 0; i<10; i++; ) { printf("i = %i",%i); } return 0; }
...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
-
03-01-2007, 07:37 AM #3009QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 499
- Points
- 5.848
- Level
- 49
- Downloads
- 0
- Uploads
- 0
just to add, the writing style of the code above me is atrocious, and is shown below:
i would write it as:Code:int main(){ pspDebugScreenInit(); for(int i = 0; i<10; i++; ) { printf("i = %i",%i); } return 0; }
much nicer....Code:int main() { pspDebugScreenInit(); for(int i = 0; i<10; i++ ) { printf("i = %i",%i); } return 0; }
o, and there was an error in that you don't need a ; after i++
-
03-01-2007, 09:27 AM #3010Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
And I would write it as:
Even nicer ;)Code:int main() { pspDebugScreenInit(); for(int i = 0; i<10; i++) printf("i = %i",%i); return 0; }
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
-
03-01-2007, 10:32 AM #3011Developer

- Registriert seit
- Oct 2005
- Ort
- Dubuque
- Beiträge
- 423
- Points
- 12.154
- Level
- 72
- My Mood
-
- Downloads
- 1
- Uploads
- 0
And I would write it as...
So that it will actually compile, I don't know where the second %i came from, maybe a typo.. but initially declaring variables in the for loop won't compile unless you add the -std=c99 to the compiler flags.Code:int main() { pspDebugScreenInit(); int i; for(i = 0; i<10; i++) printf("i = %i",i); return 0; }
-
03-01-2007, 10:46 AM #3012Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Or are using C++ ;)

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
-
03-01-2007, 12:08 PM #3013
Post needs to be deleted!
Geändert von Mr305 (03-01-2007 um 02:15 PM Uhr)
-
03-01-2007, 04:45 PM #3014words 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
Ive been using C++ for about 2 months now, ever since I got my PSP back. Its just a habit, and honestly, you dont even need to know C++ to use it's benefits. Simply rename your main.c to main.cpp, and include -lstdc++ to your makefile libs line and your set.
MiG - As for my atrocious coding style, I'm sorry but I don't like typing more than I have to. Your method is ugly to me, as it has entire lines, all completely blank except for one {. Waste of space on that line, along iwth the closing bracket line, so it just adds to the file size of the source (despite how small the increment is, it still increases as there are extra newline chars, extra spaces, etc.). Please, keep your stereotypical coding style and comments to yourself. You code your stye, Ill code mine, let others decide for themselves there style (the way you came off, it soundedas if you were convincing others to code your style).
P.S. Sorry if this comes off as an insult, but yours certainly did to me.
-= Double Post =-
Also, a little offtopic, but does anyone know Twin891 (i think thats the numbers after it) 's MSN address? I need to talk to him and PMs aren't cutting it unfortunatly
Geändert von SG57 (03-01-2007 um 04:49 PM Uhr) Grund: Automerged Doublepost

...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
-
03-01-2007, 06:19 PM #3015QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
hmm need a little help with the srand call normaly it works like:
srand(time(NULL));
but i keep getting the error that time has not been declared
librarys i'm using:
#include <stdlib.h>
#include <pspgu.h>
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <stdlib.h>
#include <psprtc.h>
#include <pspgum.h>
and my makefile:
TARGET = celestialcunning
OBJS = ./main.o
INCDIR =
LIBDIR =
LDFLAGS =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBS= -lz -lpspsdk -lpspctrl -lpsprtc -lpspgum -lpspgu -lm
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = celestial cunning
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
./main.o: ./main.c
$(CXX) $(CXXFLAGS) -c ./main.c -o ./main.o
not sure why but that call always worked for my other games
-= Double Post =-
well nvm again as i found out i forgot the time.h header so now it works=-)Geändert von slicer4ever (03-01-2007 um 06:56 PM Uhr) Grund: Automerged Doublepost
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
03-01-2007, 10:25 PM #3016words 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
Im getting weird results with my skybox. The thing is, Im loading and setting the same texture envirorment settings for each texture, yet 3 out of the 6 have very pixelated look.
You can see here that the left wall, has blocky look (pixelated but very large) and the right wall is smooth, how i want it.
The walls that are the problem are, i believe, the west wall, and floor and ceiling. Would anyone happen to know why? If you need my texture envirorment settings for my skybox, just ask.
...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
-
03-02-2007, 01:47 AM #3017Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
From that screenshot it looks vertical striped, are you sure your tesselation isn't +/- 1 out vertically?

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
-
03-02-2007, 02:37 AM #3018QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
In that case, you are (arguably) not using C++. You are just using C in .cpp files. Programming in C++ is more then just renaming source files and including libraries.
Zitat von SG57
In which case, I recommend you read the coding standards here on JSF's site:MiG - As for my atrocious coding style, I'm sorry but I don't like typing more than I have to. Your method is ugly to me, as it has entire lines, all completely blank except for one {. Waste of space on that line, along iwth the closing bracket line, so it just adds to the file size of the source (despite how small the increment is, it still increases as there are extra newline chars, extra spaces, etc.). Please, keep your stereotypical coding style and comments to yourself. You code your stye, Ill code mine, let others decide for themselves there style (the way you came off, it soundedas if you were convincing others to code your style).
P.S. Sorry if this comes off as an insult, but yours certainly did to me.
http://forums.qj.net/f-psp-developme...rds-97963.html
Your coding style doesn't match any of the common standards out there:
http://astyle.sourceforge.net/
If is (argueably) fine if this is just for you but if you ever work in a team or company, then you are in trouble.Geändert von yaustar (03-02-2007 um 02:57 AM Uhr)
[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]
-
03-02-2007, 04:51 PM #3019words 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
One simple for loop doesn't show off one's entire coding style. I obviously wouldnt do a one-liner out of 2 lines of code in a for loop, as that gets to crowded. The most i go, is right there - 1 line. As for not using C++ - I couldve sworn Im using the bool data type, the std namespace and like in my snippet 'for(int i;;)'. I rarely uses classes, but Ill live.
-= Double Post =-
Ok, whoops.
Change in weapons.
There is an AK47, Desert Eagle, MP5, Sword and M4 Carbine, not UMP.
So far, the AK47 and Sword are implemented, rendered and have all animations and whatnot done. The deagle is being worked on.Geändert von SG57 (03-02-2007 um 05:05 PM Uhr) Grund: Automerged Doublepost

...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
-
03-02-2007, 05:34 PM #3020QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Yeah, that's not using C++ (at least in principle). You are still coding in C using a very small amount of what C++ actually offers and capable of. For example, look at smart pointers.
Zitat von SG57
[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]
-
03-03-2007, 02:12 AM #3021QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
I just followed Access_Denied's Image turtorial, but i get an error when trying to compile it. Look at the attachment.
Yes, i HAVE zlib and libpng installed.Geändert von gameo (01-01-2008 um 01:19 PM Uhr)
My PSP Projects:
___________________
None.
-
03-03-2007, 02:18 AM #3022QJ Gamer Green
- Registriert seit
- Sep 2006
- Ort
- Cape Town, South Africa
- Beiträge
- 714
- Points
- 5.795
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Did you download graphics.c and graphics.h and place them in the same folder as main.c?
Zitat von gameo
Also, intiGraphics should be initGraphics.
EDIT: It looks like you left out a " on line 26, along with a lot of other mistakes (some might just be there because of earlier syntax errors). It would be helpful if you posted your code.
-
03-03-2007, 02:53 AM #3023QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
2 sec.
/*
* Simple Image Example
* Create by Access_Denied
*January 22, 2006
*/
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdio.h>
#include <pspcallbacks.h>
#include "graphics.h"
#define prints printTextScreen
PSP_MODULE_INFO("Image Example",0,1,1);
int x = 100,y = 100;
int main() {
intiGraphics();
SceCtrlData pad;
SetupCallbacks();
Image* background;
background = loadImage("Grass.png");
Image* player = loadImage("Player.png');
for(;;) {
sceCtrlReadBufferPositive (&pad, 1);
blitAlphaImageToScreen(0, 0,480,272,background,0,0) ;
blitAlphaImageToScreen(0, 0,32,32,player,x,y);
if ((pad.Buttons & PSP_CTRL_UP) && (y > 3)) {
y = y - 4;
}
if ((pad.Buttons & PSP_CTRL_DOWN) && (y < 237)) {
y = y + 4;
}
if((pad.Buttons & PSP_CTRL_RIGHT) && (x < 445)) }
x = x + 4;
}
if((pad.Buttons & PSP_CTRL_LEFT) && (x > 3)
x = x - 4;
}
sceDisplayWaitVblankStart ()
flipScreen();
}
sceKernelSleepThread();
return 0;
}
NOTE: I have corrected the intiGraphics to InitGraphics.My PSP Projects:
___________________
None.
-
03-03-2007, 03:01 AM #3024Mushroom Man
- Registriert seit
- Sep 2005
- Ort
- UK
- Beiträge
- 318
- Points
- 7.283
- Level
- 56
- Downloads
- 0
- Uploads
- 0
From the screenshot it seems as if you are missing graphics.h and maybe graphics.c. You can download them both from Yeldarbs tutorial. Simply grab them and place them in the same directory as your main.c file.
Link to graphics.c/graphics.h/framebuffer.c/framebuffer.h:
http://www.psp-programming.com/tutorials/c/lesson04.zip
You may also need to change your makefile to include the following objects:
graphics.o & framebuffer.o
i.e.
OBJS = main.o graphics.o framebuffer.o
EDIT
Also:
Image* player = loadImage("Player.png');
should be
Image* player = loadImage("Player.png");Geändert von Psilocybeing (03-03-2007 um 03:07 AM Uhr) Grund: Automerged Doublepost
-
03-03-2007, 04:20 AM #3025QJ Gamer Bronze
- Registriert seit
- Sep 2006
- Ort
- Denmark
- Beiträge
- 664
- Points
- 9.316
- Level
- 64
- Downloads
- 0
- Uploads
- 0
I'll try it out. Thanks.
My PSP Projects:
___________________
None.
-
03-03-2007, 06:44 AM #3026
Accessing fonts within pgf file format ?
Hi all,
Does someone is aware of how to extract fonts from pgf file format ?
Trying to get header info and if it is compressed (probably not) ... But cannot find a way to achieve my goal...
The things I know : Original Latin font is FFT NewRodin Pro Latin (from fontworks.com japan fonts, probably sold out for only sony usage for legal reasons) in subset of files ltn0.pgf to ... ltnXx.pgf for normal, bold, italic, etc...
FFT means probably Macromedia Flash Font format to be used there.
This bit of code can do the job to convert TTF to FFT... :
Spoiler for Java Source Code for TTF2FFT (easy to port to C++) - Subject to license usage from Laszlo inc.:
N.B. : Replace "****" in code by "s h I t" cause this
Code tags replace it !!!
Now I need help to extract from pgf files...
Finally, any help on this tricky affair from "Sony proprietary file format (They did it again !!!)" for fonts should be appreciated...Geändert von Olimatou (03-03-2007 um 12:22 PM Uhr)
-
03-03-2007, 07:03 AM #3027Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
#include <string.h>
#include <stdio.h>
extern char *Replacing(const char* replacing, char replacement, char* string) // [[[[--- Function Start
{
char *string_ptr;
while((string_ptr=strpbrk (string,replacing))!=NULL )
*string_ptr=replacement;
return string;
} // ]]]]--- Function End
int main() { // Start of main program
char *buffer; // Create a new pointer
char test[] = "This is a testing string"; // create a string for replacing
printf("Before:\n%c", *buffer); // print before string
buffer = Replacing(" ", '.', test); // Using the Replacing function, the newly replaced string is now being converted into a buffer
printf("\nAfter:\n%s", buffer); // Since the Replacing function converts a pointer to a buffer, the buffer can now be printed via printf
sceKernelSleepThread(); // Pause this thread FOREVER
return 0; // ISO Standards state that the main program has to return a value (0)
} // end of main program
printf("Before:\n%c", *buffer);
doesnt that has to be ?
printf("Before:\n%c", test);
http://www.psp-programming.com/code/...=c:replacement
-
03-03-2007, 07:15 AM #3028QJ Gamer Green
- Registriert seit
- Sep 2006
- Ort
- Cape Town, South Africa
- Beiträge
- 714
- Points
- 5.795
- Level
- 49
- Downloads
- 0
- Uploads
- 0
should beCode:if((pad.Buttons & PSP_CTRL_RIGHT) && (x < 445)) } x = x + 4; } if((pad.Buttons & PSP_CTRL_LEFT) && (x > 3) x = x - 4; }
x = x + 4 can be shortened to x += 4.Code:if((pad.Buttons & PSP_CTRL_RIGHT) && (x < 445)) { x = x + 4; } if((pad.Buttons & PSP_CTRL_LEFT) && (x > 3)) { x = x - 4; }
-
03-03-2007, 11:08 AM #3029words 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
hallo - Yes. Somebody edited my page and changed it up. I still have the draft from that code, and this is it:
Note, your replacement wouldnt print out the before string, rather an @ sign since your specifying the test char array as if it were just a char. (%c, should be %s)Code:#include <string.h> #include <stdio.h> extern char *Replacing(const char* replacing, char replacement, char* string) { char *string_ptr; while((string_ptr=strpbrk(string,replacing))!=NULL ) *string_ptr=replacement; return string; } int main() { char *buffer; char test[] = "This is a testing string"; printf("Before:\n%s", test); buffer = Replacing(" ", '.', test); printf("\nAfter:\n%s", buffer); sceKernelSleepThread(); return 0; }
The page is being fixed. Will only take a second.
...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
-
03-03-2007, 11:18 AM #3030Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
yeah your pm box was full so i posted it here , dindt mention about the %c
=> char variabel , %s char variabel[] or char *variabel


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