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; Hi, What if I want complex models in 3D? Do I have to write all the vertex-points my self?...
-
03-09-2009, 12:12 PM #9751QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Hi,
What if I want complex models in 3D?
Do I have to write all the vertex-points my self?
[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
03-09-2009, 12:39 PM #9752QJ Gamer Blue
- Registriert seit
- Nov 2007
- Beiträge
- 29
- Points
- 2.981
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Great, now i've realized what i've done wrong and it works now!
Practically, kuroneko was right all the time, it's all about the pointers and the usage of them. non-dynamic 2d arrays have set indexes in the memory, while dynamic don't (don't know whether i said it right, but nonetheless i understand now).
Now, i'm using one-dimentional array with the size of [17*30], not [17][30];
And the code -
That was idiotic of meCode:unsigned short * chipsetMap; chipsetMap = new unsigned short[mapHeight*mapWidth]; for(int i =0;i< mapHeight*mapWidth;i++){ mapName >> hex >> chipsetMap[i]; }
-
03-09-2009, 07:22 PM #9753QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
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-10-2009, 06:53 AM #9754QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Whether you are using arrays on the stack or on the heap, logically doesn't matter unless you are overrunning the buffer.
Logically, there are both the same. On the stack, the memory layout is also the same, they only differ if allocated on the heap and that's where symptoms appear if you overrun the buffer(s).Now, i'm using one-dimentional array with the size of [17*30], not [17][30];
And the code -
Read my previous reply. Given the data file you supplied, you are still going past the end of the file which is more like to be causing you problems. You either need to change the data to be correct (height 1, width 30 or 17 * 30 indexes) and/or put safety checks in the code for hitting the end of the file.Code:unsigned short * chipsetMap; chipsetMap = new unsigned short[mapHeight*mapWidth]; for(int i =0;i< mapHeight*mapWidth;i++){ mapName >> hex >> chipsetMap[i]; }Geändert von yaustar (03-10-2009 um 07:05 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-13-2009, 05:54 AM #9755QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Ok, another question.
What if I just want to make a 2D game like just printing images on the screen.
How would I do that? Would I have to use 3D too?[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
03-13-2009, 06:22 AM #9756QJ 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]
-
03-13-2009, 01:09 PM #9757QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Is there any libary that makes coding easier, I think there was one that started with a "O", but I'm not sure.
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-13-2009, 01:12 PM #9758QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
OSLib?
[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
03-13-2009, 01:14 PM #9759xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
OldSchool?
-edit-
to late =(
-
03-13-2009, 06:35 PM #9760QJ Gamer Green
- Registriert seit
- Jul 2008
- Ort
- In your pocket.
- Beiträge
- 192
- Points
- 5.875
- Level
- 49
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Ah that was the name thx both of you, is there any website with a list of all/most of the libs around?
Geändert von Digikid13 (03-13-2009 um 07:28 PM Uhr)
AIM: Digikid91 | PSN: Digikid13 | GaiaOnline: Digikid13
-
03-13-2009, 07:18 PM #9761xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
ps2dev.org?
Also im looking to display moving pictures on my psp screen. Whats the easiest way to do it? Also the lib plz.
-SLasher
-
03-13-2009, 07:25 PM #9762QJ Gamer Bronze
- Registriert seit
- May 2007
- Ort
- Ireland
- Beiträge
- 56
- Points
- 5.304
- Level
- 46
- Downloads
- 0
- Uploads
- 0
Display them the same way you would static pictures, just change the co-ordinates.
-
03-13-2009, 07:30 PM #9763xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Yes but what would be a good Library to display them?
LibPng? LibJpeg?
-
03-13-2009, 07:32 PM #9764QJ Gamer Bronze
- Registriert seit
- May 2007
- Ort
- Ireland
- Beiträge
- 56
- Points
- 5.304
- Level
- 46
- Downloads
- 0
- Uploads
- 0
Libpng and libjpeg are for loading the images, not displaying them. The last few posts have answered a question regarding displaying 2D images.
-
03-13-2009, 07:33 PM #9765xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Oh ok, im compiling SDL as we speak so can i use that and libPNG?
-
03-13-2009, 07:37 PM #9766QJ Gamer Bronze
- Registriert seit
- May 2007
- Ort
- Ireland
- Beiträge
- 56
- Points
- 5.304
- Level
- 46
- Downloads
- 0
- Uploads
- 0
AFAIK SDL has it's own image loading functions so you won't have to worry about what to use to load images.
-
03-13-2009, 07:37 PM #9767Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
What is the typical way to do collision detection between vector objects drawn with GU?
Best I can think of is to check coordinates of each object, but that's hardly going
to do the job for odd shaped objects.
For 2D programs I've been checking pixel colour, but don't know how to do that with GU.
-
03-13-2009, 07:38 PM #9768xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Bounding Box Method?
-
03-13-2009, 11:52 PM #9769QJ 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
I don't think bounding boxes would help very much for Non-rectangular polygons, maybe Circle Circle collision or
Conservation of Linear Momentum?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-14-2009, 01:13 AM #9770QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Hi,
I tried using Display Lists but it wont show up.
If I directly draw it is is there tho.
Code:void DrawScene( void ) { sceGuStart( GU_DIRECT, dList ); // clear screen sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); sceGumMatrixMode(GU_MODEL); sceGumLoadIdentity(); { ScePspFVector3 move; move.x = 0.0f; move.y = 0.0f; move.z = mapZ; sceGumTranslate( &move ); } // sceGumUpdateMatrix(); // Draw Triangle //sceGumDrawArray( GU_TRIANGLE_STRIP, GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D, // 4, 0, sqr ); sceGuCallList( mapList ); sceGuFinish(); sceGuSync(0,0); } void BuildLists( void ) { sceGuStart( GU_CALL, mapList ); sceGumDrawArray( GU_TRIANGLE_STRIP, GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D, 4, 0, sqr ); // Draw the Cube sceGuFinish(); } int main(int argc, char **argv) { pspDebugScreenInit(); SetupCallbacks(); sceRtcGetCurrentTick( &fpsTickLast ); tickResolution = sceRtcGetTickResolution(); dList = memalign( 16, 640 ); mapList = malloc( 1500 ); fbp0 = 0; InitGU(); SetupProjection(); BuildLists(); SceCtrlData pad; while( 1 ) { sceCtrlPeekBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_UP) { mapZ += 1.0f; } else if(pad.Buttons & PSP_CTRL_DOWN) { mapZ -= 1.0f; } DrawScene(); FPS(); //sceDisplayWaitVblankStart(); fbp0 = sceGuSwapBuffers(); } sceGuTerm(); // Terminating the Graphics System // Free Memory free( dList ); free( fbp0 ); sceKernelExitGame(); return 0; }[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
03-14-2009, 06:58 AM #9771
- Registriert seit
- Mar 2008
- Beiträge
- 22
- Points
- 2.831
- Level
- 32
- Downloads
- 0
- Uploads
- 0
Hello. I just started learning C++. I need some help. I can't figure out how to move text and change text color. Can someone write these two scripts. Thank you.
-
03-14-2009, 06:59 AM #9772Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
int main()
{
movetext();
changetextcolour();
}
You have to figure out how to write the functions though.
-
03-14-2009, 07:17 AM #9773QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
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-15-2009, 01:23 AM #9774QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
-
03-15-2009, 11:40 AM #9775
- Registriert seit
- Mar 2008
- Beiträge
- 22
- Points
- 2.831
- Level
- 32
- Downloads
- 0
- Uploads
- 0
I want to make moving image x coordinate.
Code:int y = 50; int i for(i=30;i<120;i++) blitAlphaImageToScreen(0 ,0 , 26, 8, bar, [i], y);
what is wrong ? :/
I'm new at C programing, older i were programing in lua and my code lookedCode:while true do screen.startDraw() screen.clear(0) if BarX > 350 then BarX = 130 end BarX = BarX + 1 Image.blit(BarX,215,BootBar) screen.endDraw() screen.flipscreen() screen.waitVblankStart() end
-
03-15-2009, 03:49 PM #9776It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
For one thing, there shouldn't be brackets around that i.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
03-16-2009, 03:18 AM #9777QJ Gamer Green
- Registriert seit
- Jun 2008
- Beiträge
- 60
- Points
- 2.664
- Level
- 31
- Downloads
- 0
- Uploads
- 0
-
03-16-2009, 07:52 AM #9778QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- Netherlands
- Beiträge
- 148
- Points
- 5.672
- Level
- 48
- Downloads
- 0
- Uploads
- 0
[SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
[i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]
-
03-16-2009, 10:18 AM #9779QJ Gamer Green
- Registriert seit
- Dec 2007
- Ort
- Lithuania
- Beiträge
- 37
- Points
- 3.001
- Level
- 33
- Downloads
- 0
- Uploads
- 0
How to make image moving all the time by X coordinate? What is wrong with this code :/ I see that it's different but it is simple think but don't work :/ Just blit image about 52 point by x from 0 and i think it only moves then loading?Code:int barx = 1.0; while(1){ barx += 0.1; blitAlphaImageToScreen(0 ,0 , 434, 26, bar, barx, 246); sceDisplayWaitVblankStart(); flipScreen(); } return 0;
-
03-16-2009, 10:23 AM #9780QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Integer = WHOLE number
Use a floating point type for decimal.


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