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; Well heres my project, but it links to the graphics.h lib.... http://savefile.com/files/160310...
-
10-14-2006, 04:21 PM #1291QJ Gamer Blue
- Registriert seit
- Aug 2006
- Beiträge
- 145
- Points
- 4.580
- Level
- 43
- Downloads
- 0
- Uploads
- 0
-
10-14-2006, 04:50 PM #1292likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Code:
Errors:Code:#include "main.h" LOCAL char *readInput(FILE *fp) { char *retp = NULL; int curp = 0, ch; int cursz = EXP_INP_SZ_; retp = my_malloc(sizeof *retp * cursz); while ( (ch = fgetc(fp)) != EOF ) { if ( curp >= cursz ) { retp = my_realloc(retp, sizeof *retp * (cursz + EXP_INP_SZ_)); cursz += EXP_INP_SZ_; } retp[curp++] = ch; } if ( !curp ) { MY_FREE(retp); return NULL; } if ( retp[curp-1] == '\n' ) { retp = my_realloc(retp, sizeof *retp * curp); retp[curp-1] = 0; } else { retp = my_realloc(retp, sizeof *retp * (curp + 1)); retp[curp] = 0; } return retp; } LOCAL void printCipherMap(CipherText *ctptr) { int i, j; CipherChar *ccptr = ctptr->ciphermap; int *ciphermap = ctptr->plainmap; char *plainchars = ctptr->plainchars; for ( i = 0; i < ALPHA_SZ_; ++i ) { int current = ciphermap[i]; if ( !ccptr[i].isPresent ) continue; printf("%c => ", 'a' + i); if ( plainchars[i] == '?' ) { current = ciphermap[i]; for ( j = 0; j < ALPHA_SZ_; ++j ) { if ( current & aleph_codes[j] ) { printf("%c", 'a' + j); current &= ~aleph_codes[j]; if ( current ) printf(", "); } } } else printf("%c", plainchars[i]); printf("\n"); } } int main(int argc, char *argv[]) { char *txt; CipherText gctxt; clock_t start, end; double duration; int unsolved; if ( argc <= 1 ) txt = readInput(stdin); else { FILE *fp = fopen(argv[1], "r"); if ( !fp ) { perror("fopen failed"); fprintf(stderr, "Input file couldn't be opened\n"); exit(EXIT_FAILURE); } txt = readInput(fp); } if ( !txt ) { fprintf(stderr, "No input given!!\n"); exit(EXIT_FAILURE); } start = clock(); unsolved = solveQuip(txt, &gctxt); end = clock(); if ( !unsolved ) { printf("Original Text:\n"); printf("%s\n\n", gctxt.ociphertxt); printf("Deciphered Text:\n"); printf("%s\n\n", gctxt.plaintxt); printf("Cipher to Plain text mapping:\n"); printf("-----------------------------\n"); printCipherMap(&gctxt); duration = (double) (end - start) / CLOCKS_PER_SEC; printf("Solving time: %2.1f seconds\n", duration); } else exit(EXIT_FAILURE); return 0; }
-
10-14-2006, 04:54 PM #1293QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- Germany
- Beiträge
- 216
- Points
- 4.511
- Level
- 42
- Downloads
- 0
- Uploads
- 0
First of all, thanks for your answers!
As for the list of artist, I think the best delimiter would be a newline-character (\n) since it will never appear in an artistname; It would look like this:
I thought by sending along the lenght of the artist- album-names I could allocate exactly allocate the amount of memeory I needed, not more not less. No artists- or album-name would have been cut. But as I heard allocating memory using malloc slows down the PSP, so I'll go with your suggestions.Code:536 // First line, number of artists A perfect circle // Name of the artist (#1) 3 // Albumcount Emotive // Name of the album (#1) Mer de noms // Name of the album (#2) The thiteenth step // Name of the album (#3) Aphex Twin // Name of the artist (#2) 2 // albumcount Come to daddy // Name of the album (#1) Selected ambient works // Name of the album (#2) [...] // Name of the artist (#3)
There is only one question left: How do I read a varialble until the next newline as quickly as possible??
-
10-14-2006, 05:10 PM #1294Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
psp
12: Learn how to code before trying to copy/paste someone elses code into your own.
Problem fixed.
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
-
10-14-2006, 05:27 PM #1295likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
??
Zitat von Insomniac197
im trying to port cryptoquip
-= Double Post =-
okay heres my problem..
I have solveQuip declared as a function like this
but when i try to use it like this..Code:int solveQuip(char *txt, CipherText *ctptr) { CipherWord **cipherwordptrs; int i; int newmap[ALPHA_SZ_]; int ncipherwords; Bool nosolution = FALSE; char *ciphertxt = ctptr->ociphertxt; char plainmap[ALPHA_SZ_]; processInput(txt, ctptr); if ( ctptr->ncipherwords <= 0 ) return 1; cipherwordptrs = my_malloc(sizeof *cipherwordptrs * ctptr->ncipherwords); for ( i = 0; i < ctptr->ncipherwords; ++i ) { cipherwordptrs[i] = ctptr->cipherwords[i]; } for ( i = 0; i < ctptr->ncipherwords-1; ++i ) { int j; int ikey = cipherwordptrs[i]->len; for ( j = i+1; j < ctptr->ncipherwords; ++j ) { int jkey = cipherwordptrs[j]->len; if ( ikey < jkey ) { CipherWord *temp = cipherwordptrs[i]; cipherwordptrs[i] = cipherwordptrs[j]; cipherwordptrs[j] = temp; ikey = jkey; } } } for ( i = 0; i < ctptr->ncipherwords; ++i ) { CipherWord *wptr = cipherwordptrs[i]; getMatchingWordsFromDict(wptr, dicts + wptr->len - 1, ctptr->ciphermap); } ncipherwords = ctptr->ncipherwords; while ( 1 ) { int j; nosolution = solveWords(cipherwordptrs, ncipherwords, newmap); if ( !nosolution ) break; for ( i = 0; i < ncipherwords; ++i ) { if ( cipherwordptrs[i]->isIgnored ) continue; cipherwordptrs[i]->isIgnored = TRUE; fprintf(stderr, "Couldn't find a solution, Ignoring %s and trying others\n", cipherwordptrs[i]->word); break; } if ( i == ncipherwords ) break; for ( j = 0; j < ALPHA_SZ_; ++j ) { CipherChar *ccptr = ctptr->ciphermap + j; if ( ! ccptr->isPresent ) continue; ccptr->plainmap = ALEPH_ALL; } for ( ++i; i < ncipherwords; ++i ) { if ( cipherwordptrs[i]->isIgnored ) continue; cipherwordptrs[i]->curmatch = 0; if ( cipherwordptrs[i]->possiblewords ) MY_FREE(cipherwordptrs[i]->possiblewords); getMatchingWordsFromDict(cipherwordptrs[i], dicts + cipherwordptrs[i]->len - 1, ctptr->ciphermap); } } if ( nosolution ) { fprintf(stderr, "Couldn't find a solution!\n"); return 1; } else { convertMapToChars(ctptr->ciphermap, newmap, plainmap); memcpy(ctptr->plainmap, newmap, sizeof *newmap * ALPHA_SZ_); memcpy(ctptr->plainchars, plainmap, sizeof *plainmap * ALPHA_SZ_); ctptr->plaintxt = my_malloc(sizeof *ctptr->plaintxt * strlen(ctptr->ociphertxt)); strcpy(ctptr->plaintxt, ctptr->ociphertxt); ciphertxt = ctptr->plaintxt; for ( ; *ciphertxt; ciphertxt++ ) { char cipherchar = *ciphertxt; int isupper; if ( !isalpha((int) cipherchar) ) continue; isupper = isupper((int) cipherchar); cipherchar = tolower((int) cipherchar); *ciphertxt = isupper ? toupper((int)plainmap[CHAR_TO_INDEX(cipherchar)]) : plainmap[CHAR_TO_INDEX(cipherchar)]; } } return 0; }
it gives me these errorsCode:unsolved = solveQuip(txt, &gctxt);
Code:[email protected] /$ $ make psp-gcc -I. -I/usr/psp/sdk/include -O2 -G0 -Wall -c -o main.o main.c main.c : In function 'main': main.c(186) : error: called object 'solveQuip' is not a function make: *** [main.o] Error 1
Geändert von psphacker12. (10-14-2006 um 05:27 PM Uhr) Grund: Automerged Doublepost
-
10-14-2006, 07:36 PM #1296QJ Gamer Blue
- Registriert seit
- Aug 2006
- Beiträge
- 145
- Points
- 4.580
- Level
- 43
- Downloads
- 0
- Uploads
- 0
Again, heres my project:
http://savefile.com/files/160310
Please someone help, whats wrong with it? The graphics.h connects to it fine..I dont know whats wrong.
-
10-14-2006, 07:57 PM #1297QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
That's plain utter bull. malloc shouldn't be used inside inner loops of realtime-apps, yes, but even there it is possible to some extent. Whoever told you that, don't listen to him.
Zitat von Lukeson
Uh... read char by char into a buffer until one char turns up as newline. Stop. Repeat. Pretty simple :PThere is only one question left: How do I read a varialble until the next newline as quickly as possible??Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
10-14-2006, 07:59 PM #1298words 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
ugh...
1. Remove the ] bracket at the start of your main.c...
2. You dont need that extern C stuff since you're already saying it's in C by having main file main.c...
That should fix 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
-
10-14-2006, 08:20 PM #1299QJ Gamer Blue
- Registriert seit
- Aug 2006
- Beiträge
- 145
- Points
- 4.580
- Level
- 43
- Downloads
- 0
- Uploads
- 0
All right its actually working now :P
But is there a way to make it so when I press Up or Down he doesnt move like 1 inch?? Like when i press it he doesnt keep moving he just stops.
How do i make it so when i hold it down he keeps moving, and when i release he stops?
-
10-14-2006, 08:36 PM #1300words 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
Gonrai - You specifically said to make him only move once (in the code). Remove the UP and DOWN if statements (the button input) OUT of the if statement that says if oldpad ~=pad or w/e.

...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
-
10-15-2006, 01:24 AM #1301Developer

- Registriert seit
- Sep 2005
- Ort
- Sweden
- Beiträge
- 941
- Points
- 10.075
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Thanks for the code, I appreciate it. The code you gave me worked like a charm. But if only want a "regular" eboot I'll first have to type "make" then "make noex" (I have deleted the kxploit line). Is there a way to short it down so I'll only have to type one line in cygwin?
Zitat von Insomniac197
Psp
12.: Try changing 'int' to 'void', that works sometimes with errors like these. At least I had an error that said that it was not a function and it took me a day to figure out what was worng. But I still don't know why it didn't work when I was using int :)
Geändert von SodR (10-15-2006 um 01:36 AM Uhr)
-
10-15-2006, 01:48 AM #1302words 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
SodR - Im not sure what your question really is, but to spit out a NON kxploit eboot, just type 'make' rather than 'make kxploit'. Once again, Im not 100% what you and Insomniac had discussed and am a little too lazy to read back :o

...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
-
10-15-2006, 01:52 AM #1303Developer

- Registriert seit
- Sep 2005
- Ort
- Sweden
- Beiträge
- 941
- Points
- 10.075
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Lol, no that is not what I'm asking :) I just wondered if you could type make clean without first having to type make to generate the eboot. That is so I wont have to type two lines into cygwin ;)
Zitat von SG57
Geändert von SodR (10-15-2006 um 02:35 AM Uhr)
-
10-15-2006, 02:07 AM #1304QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- Germany
- Beiträge
- 216
- Points
- 4.511
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Sounds pretty slow...Uh... read char by char into a buffer until one char turns up as newline. Stop. Repeat. Pretty simple :P
Wouldn't it even be faster to write the string to a file and use fgets? That's pretty 'dirty' and I guess fgets does nothing else than doing the char-by-char-thing, but maybe not?
-
10-15-2006, 03:47 AM #1305AKA Homer

- Registriert seit
- Jan 2006
- Ort
- Sweden
- Beiträge
- 1.779
- Points
- 12.596
- Level
- 73
- Downloads
- 0
- Uploads
- 0
That would probably be the slowest way to do it. Just do something like
Zitat von Lukeson
It should be pretty fast.Code:for(int i=0;i<strlen(str);i++) { if(str[i]=='\n') //newline }
-
10-15-2006, 05:33 AM #1306QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Writing to a file just to read again byte for byte? How should that ever be faster? And yes, fgets also only reads byte for byte, but from a file instead of from memory which is hundreds times slower, plus the additional writing which is even more slower.
Zitat von Lukeson
That's somewhat how I imagined and it's the fastest way possible by any means. Do it like that.for(int i=0;i<strlen(str);i++)
{
if(str[i]=='\n') //newline
}Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
10-15-2006, 06:37 AM #1307Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
how do you do this:
let the program while in a loop return to the beginning of that loop
for exemple
you see , so it stay asking it ,untiln the variabel "leerlingen = 21" ofcoures;)Code:for(leerlingen=1; leerlingen<=21;) { cout<<"geef de score van leerling "<<leerlingen; cin>>punten[leerlingen]; cout<<"\n"; leerlingen +1; /************************************************ *********************return now to the beginning*******/ if (leerlingen=21) { break; } } }
-
10-15-2006, 07:34 AM #1308Developer

- Registriert seit
- Sep 2005
- Ort
- Sweden
- Beiträge
- 941
- Points
- 10.075
- Level
- 67
- Downloads
- 0
- Uploads
- 0
I don't really understand what you mean but here is an example of a while loop;
Zitat von hallo007
I hope it'll helpCode:int x = 0; // Endless loop if we don't break it using 'break;' while(1) { x++; // If the integer x = 21 we'll break the loop if(x==21) { break; } } // This code will only run when we have broke out of the loop
-
10-15-2006, 07:46 AM #1309Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
no i dont help , lol
i understand what a loop is
but i wanne repeat the loop
so if the user put a value for number 1 , it ask a value for number 2 , i have that , the only thing i need to do is that it's start again from the beginning
for exempla
understand?? srry , i know my english is badCode:what's the value of number 1? 4 /*now it repeats and x is one more so it prints number 2 and save the value to arrey 2*/ what's the value of number 2? 7
-
10-15-2006, 08:04 AM #1310AKA Homer

- Registriert seit
- Jan 2006
- Ort
- Sweden
- Beiträge
- 1.779
- Points
- 12.596
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Why don't you do it like this
Or in your caseCode:int a = 0; while(1) { cin>>var; a++; if(a==21) break; /*else { //Not needed at all, just showing you the continue statement continue; }*/ }
Code://Reset to avoid any memory problems leerlingen = 0; while(1) { cout<<"geef de score van leerling "<<leerlingen; cin>>punten[leerlingen]; cout<<"\n"; leerlingen++; if (leerlingen==21) break; }
-
10-15-2006, 08:05 AM #1311QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
You could also put the loop inside another loop. Then, in the inside loop, make it check which run through the outside loop it is. Example:
Or...Code:for(x=0;x<5;x++) { for(y=0;y<5;y++) { switch(x) { case 0: // something to do the first time through break; case 1: // something to do the second time through break; case 2: // something to do the third time through break; case 3: // something to do the fourth time through break; case 4: // something to do the fifth time through break; } } }Code:for(x=0;x<5;x++) { printf("What's the value of number %i?\n", x); //get input here... however you want to do it }[I fail @ life]
-
10-15-2006, 08:07 AM #1312QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Should be:Code:for(leerlingen=1; leerlingen<=21;) { cout<<"geef de score van leerling "<<leerlingen; cin>>punten[leerlingen]; cout<<"\n"; leerlingen +1; // This line doesn't do anything to 'leerlingen' /************************************************ *********************return now to the beginning*******/ if (leerlingen=21) { break; } } }
Code:for( leerlingen = 0; leerlingen < 21; ++leerlingen ) { cout << "geef de score van leerling " << leerlingen; cin >> punten[leerlingen]; cout << endl; }
-
10-15-2006, 08:12 AM #1313QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Heh. Looks like we all missed that he wasn't incrementing the value, except for you. Also:
will start storing values in the second array element.Code:for( leerlingen = 0; leerlingen < 21; ++leerlingen ) { cout << "geef de score van leerling " << leerlingen; cin >> punten[leerlingen]; cout << endl; }will start from the first :)Code:for( leerlingen = 0; leerlingen < 21; ++leerlingen ) { cout << "geef de score van leerling " << leerlingen; cin >> punten[leerlingen-1]; cout << endl; }[I fail @ life]
-
10-15-2006, 08:14 AM #1314Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
so when i put in the first value , the program do first the second loop (and repeats it 100times ) and then it crashes
-
10-15-2006, 08:20 AM #1315Developer

- Registriert seit
- Sep 2005
- Ort
- Sweden
- Beiträge
- 941
- Points
- 10.075
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Now I got a question for you guys:
I use this posted by Insomniac :) at psp-programming to generate a random number:
Then I got an array that looks like this:Code:int getRandomNum(int lo, int hi) { SceKernelUtilsMt19937Context ctx; u32 rand_val = sceKernelUtilsMt19937UInt(&ctx); rand_val = lo + rand_val % hi; return (int)rand_val; }
The numbers are offsets if anyone wonders.Code:char color[5]; // Yellow color[1] = 0; // Green color[2] = 29; // Black color[3] = 58; // Red color[4] = 87; // Blue color[5] = 116;
Then I generate a random number between 1 and 5 like this:
Then I finaly want to use the random number and blit the image:Code:int RandomNum; RandomNum = getRandomNum(1,5);
This compiles fine but when I try it on the psp it'll always generate the number 1 = the color/offset is always 0/yellow. I know I can do this fix it "the lazy way" using alot of if statements but I got [f]Alot[/f] of different images I'm bliting and it would take forever to write if statements to them all.Code:blitAlphaImageToScreen(color[RandomNum],0,29,25, hex_image, 132, 222); blitAlphaImageToScreen(color[RandomNum],0,29,25, hex_image, 132, 247);
Any thoughts?
-
10-15-2006, 08:21 AM #1316QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Woah. That would start from -1 not 0. On the first loop, leerlingen = 0, it doesnt increment until the end of the first loop.
Zitat von FreePlay
-
10-15-2006, 08:23 AM #1317Developer

- Registriert seit
- Feb 2006
- Ort
- Norway
- Beiträge
- 384
- Points
- 5.359
- Level
- 47
- Downloads
- 0
- Uploads
- 0
You need to seed the randomizer.
Not sure how you do it with that way.
but you could do:
srand(time(NULL));
RandomNum = rand() % (5+1);
-
10-15-2006, 08:30 AM #1318Developer

- Registriert seit
- Sep 2005
- Ort
- Sweden
- Beiträge
- 941
- Points
- 10.075
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Thanks It worked fine. I guess there is no "magic" way of making the integer change every time you use it? I.e.
Zitat von waterbottle
That would save me alot of time/space in the source.Code:// First a number is generated here: blitAlphaImageToScreen(color[RandomNum],0,29,25, hex_image, 132, 222); // A new number is automaticly generated using the same integer blitAlphaImageToScreen(color[RandomNum],0,29,25, hex_image, 132, 247);
-
10-15-2006, 08:33 AM #1319Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
thnx , i m nearly there now i want to parts the punten[leerlingen]
but how do you adds them up if you dont know how many there gonna be????????
-
10-15-2006, 09:08 AM #1320Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
If you read the full post mate it shows how to seed the Mersenne Twister etc.
Zitat von SodR
http://www.psp-programming.com/dev-f...pic.php?t=1076
I found it a lot more random than using the rand() stuff.
-= Double Post =-
I think you could do something like this...:Code:// First a number is generated here: blitAlphaImageToScreen(color[RandomNum],0,29,25, hex_image, 132, 222); // A new number is automaticly generated using the same integer blitAlphaImageToScreen(color[RandomNum],0,29,25, hex_image, 132, 247);
Code:blitAlphaImageToScreen(color[GetRandomNum(0, 10)],0,29,25, hex_image, 132, 222);
Geändert von Insomniac197 (10-15-2006 um 09:08 AM Uhr) Grund: Automerged Doublepost

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


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