[C Help] Graphics Confusion

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
^L^
Posts: 19
Joined: Sat Jun 14, 2008 1:11 pm

[C Help] Graphics Confusion

Post by ^L^ »

Meh...
I've tried sooo hard.
I've looked for such a long time and posted in many, many places...
I want to make a game, but I don't know how to properly display graphics on the PSP using C.
I did many tutorials, but none of them help me out with what I need.
Can someone post a sample in C for what is needed to blit a white pixel on the screen and move it around with the D-Pad using X and Y variables?
I know C very well, and I've created many text based programs. I want to take the next step and develop an actual game.
This would help me out very greatly. Thanks in advance!
^L^
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

It's a bit more than justa white dot... it's a whole cursor with some other stuff.

http://forums.ps2dev.org/viewtopic.php?p=66475#66475

If you read from there down, there's an update to that code to work with the TV modes.

http://forums.ps2dev.org/viewtopic.php?p=66568#66568
^L^
Posts: 19
Joined: Sat Jun 14, 2008 1:11 pm

Post by ^L^ »

J.F. wrote:It's a bit more than justa white dot... it's a whole cursor with some other stuff.

http://forums.ps2dev.org/viewtopic.php?p=66475#66475

If you read from there down, there's an update to that code to work with the TV modes.

http://forums.ps2dev.org/viewtopic.php?p=66568#66568
Thanks very much for this. However, both of those have a lot of extra coding for TV Out. I was wanting just a simple example.
I was wanting something simple like this....

Code: Select all

	int x=70;
	int y=70;

int main() {
	SceCtrlData pad;
	pspDebugScreenInit();
	SetupCallbacks();
	initGraphics();
	printf("Test");


while(1){
	  sceCtrlReadBufferPositive(&pad, 1);
          if(pad.Buttons & PSP_CTRL_UP) {
          	y-=1;
          }
          if(pad.Buttons & PSP_CTRL_DOWN) {
          	y+=1;
          }
          if(pad.Buttons & PSP_CTRL_RIGHT) {
          	x+=1;
          }
          if(pad.Buttons & PSP_CTRL_LEFT) {
          	x-=1;
          }
       	  putPixelScreen(0xFFFFFFFF,x,y);
}

	flipScreen();

	sceKernelSleepThread();
	return 0;
}
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Post by Tinnus »

Maybe you should look into SDL :) MUCH easier, and faster, than plotting one pixel at a time :)

Also, you can code and debug your game in your desktop, and just recompile & tweak for PSP later.
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
^L^
Posts: 19
Joined: Sat Jun 14, 2008 1:11 pm

Post by ^L^ »

Tinnus wrote:Maybe you should look into SDL :) MUCH easier, and faster, than plotting one pixel at a time :)

Also, you can code and debug your game in your desktop, and just recompile & tweak for PSP later.
I've been doing it on my PSP. It's no big rush so I haven't minded.
And... I checked out SDL a while ago. I couldn't figure out how to set it up.
^L^
Posts: 19
Joined: Sat Jun 14, 2008 1:11 pm

Post by ^L^ »

Is bumping aloud here?
That's what this post is.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

There are plenty of PSP programs that use SDL that you can look at for how you use SDL on the PSP. There are also plenty of simple SDL examples out there that you could then try on the PSP. The only major difference between using SDL on the PC and on the PSP is the makefile.

If you google around, it's easy to find places that explain SDL... like this:
http://www.friedspace.com/cprogramming/sdlpixels.php
Tinnus
Posts: 67
Joined: Sat Jul 29, 2006 1:12 am

Post by Tinnus »

Honestly, as long as you can't understand something as simple as a program framework with SDL, you won't be able to program any games more complicated than "click the red rectangle". Just go slowly and learn stuff as you go. The idea is to go from the bottom up, not the other way around.
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

I don't recomend PSP's scene newcomers using libraries like SDL. That's because writing some dot to the screen could sound silly, but it's didactic, indeed. Loading and writing sprites on the screen without the knowledge of what happens behyond the scene isn't really useful. If i find it, i will post my very first approach to PSP's framebuffer...
^L^
Posts: 19
Joined: Sat Jun 14, 2008 1:11 pm

Post by ^L^ »

jean wrote:I don't recomend PSP's scene newcomers using libraries like SDL. That's because writing some dot to the screen could sound silly, but it's didactic, indeed. Loading and writing sprites on the screen without the knowledge of what happens behyond the scene isn't really useful. If i find it, i will post my very first approach to PSP's framebuffer...
I actually am really good with C, I just could never get the graphics.c to work with any program I made like other people could. And whenever I did, it would, the screen would flicker black and white whenever I would run the game.
J.F. wrote:There are plenty of PSP programs that use SDL that you can look at for how you use SDL on the PSP. There are also plenty of simple SDL examples out there that you could then try on the PSP. The only major difference between using SDL on the PC and on the PSP is the makefile.

If you google around, it's easy to find places that explain SDL... like this:
http://www.friedspace.com/cprogramming/sdlpixels.php
And I don't know how to install the SDL. I'm sure ti would be pretty easy to use, but I'm really unfamiliar with Cyqwin and PSPToolchain and whatnot.
pegasus2000
Posts: 160
Joined: Wed Jul 12, 2006 7:09 am

Re: [C Help] Graphics Confusion

Post by pegasus2000 »

^L^ wrote:Meh...
I've tried sooo hard.
I've looked for such a long time and posted in many, many places...
I want to make a game, but I don't know how to properly display graphics on the PSP using C.
I did many tutorials, but none of them help me out with what I need.
Can someone post a sample in C for what is needed to blit a white pixel on the screen and move it around with the D-Pad using X and Y variables?
I know C very well, and I've created many text based programs. I want to take the next step and develop an actual game.
This would help me out very greatly. Thanks in advance!
^L^
http://visilab.unime.it/~filippo/Nanode ... s/Docs.htm
Post Reply