forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[C Help] Graphics Confusion

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
^L^



Joined: 14 Jun 2008
Posts: 19

PostPosted: Sat Jun 14, 2008 1:15 pm    Post subject: [C Help] Graphics Confusion Reply with quote

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^
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jun 14, 2008 2:29 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message AIM Address
^L^



Joined: 14 Jun 2008
Posts: 19

PostPosted: Sat Jun 14, 2008 11:15 pm    Post subject: Reply with quote

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:
   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;
}
Back to top
View user's profile Send private message
Tinnus



Joined: 29 Jul 2006
Posts: 67

PostPosted: Sun Jun 15, 2008 12:12 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
^L^



Joined: 14 Jun 2008
Posts: 19

PostPosted: Sun Jun 15, 2008 4:06 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
^L^



Joined: 14 Jun 2008
Posts: 19

PostPosted: Fri Jun 20, 2008 6:54 am    Post subject: Reply with quote

Is bumping aloud here?
That's what this post is.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Jun 20, 2008 7:26 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message AIM Address
Tinnus



Joined: 29 Jul 2006
Posts: 67

PostPosted: Fri Jun 20, 2008 7:29 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Jun 20, 2008 6:56 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
^L^



Joined: 14 Jun 2008
Posts: 19

PostPosted: Mon Jun 23, 2008 11:50 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
pegasus2000



Joined: 12 Jul 2006
Posts: 160

PostPosted: Mon Jun 23, 2008 4:53 pm    Post subject: Re: [C Help] Graphics Confusion Reply with quote

^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/Nanodesktop/PSP_PSPE/Docs/Docs.htm
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group