![]() |
|
#21
|
||||
|
||||
|
sceDisplayWaitVblankStart(); after each time the button is pressed and added it inside a for loop so it would pause for a certain amount of time after the button was pushed. Everything flows smooth now. What that function does is it waits until the vsynch gets called to the os. Its tied into the screen refresh rate, the PSP refreshes 60 times a second. Overall, you did a really god job of porting that game over to the PSP. Good job. Here is the link: http://www.mediafire.com/?9nxdyyjydg3
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here www.psp-hacks.com/forums/viewtopic.php?id=65403 Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/view...693884#p693884 Want to learn how to program C++ ? Check out that tutorial here www.psp-hacks.com/forums/viewtopic.php?id=28694 |
|
#22
|
|||
|
|||
|
Quote:
A better solution is to keep track of the previous state of the pad and compare it with the current state. Then you can simply use this pseudo code to check for a distinct button press. Code:
if button is pressed down now but was not pressed down last frame then
do some stuff
end
Code:
SceCtrlData currentPadState, previousPadState;
while( 1 )
{
// At the top of the loop
sceCtrlReadBufferPositive(¤tPadState, 1);
// Check for a button press
if( currentPadState.Buttons & PSP_CTRL_UP && 0 == previousPadState.Buttons & PSP_CTRL_UP )
{
// Do some stuff
}
// At the bottom of the loop
previousPadState = currentPadState;
sceDisplayWaitVblankStart();
}
|
|
#23
|
||||
|
||||
|
Your code does the exact same end result as my code but I kept mine a little bit simplier since this is a beginner's game and lesson. Plus with my code you can actually control how much time passes between each button press to conform to each individual program. There is nothing wrong with your code, there are just different ways to code and get the same end result.
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here www.psp-hacks.com/forums/viewtopic.php?id=65403 Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/view...693884#p693884 Want to learn how to program C++ ? Check out that tutorial here www.psp-hacks.com/forums/viewtopic.php?id=28694 |
|
#24
|
|||
|
|||
|
thanks nobugging. i'm still learning what kinds of functions the psp has built in. that's a new one.
__________________
|
|
#25
|
|||
|
|||
|
Ok I'm having a bit of a problem. I downloaded the installer and installed everything correctly. then i edited the pspdev.bat like the tutorial said. but when i double click on it a box pops up that says "C:\WINDOWS\system32\cmd.com is not a valid win32 application" I don't know what im doing wrong. I followed everything correctly. Please help.
__________________
|
|
#26
|
|||
|
|||
|
take the .com off.
__________________
|
|
#27
|
||||
|
||||
|
O_o, that reminds me of a virus (which I installed on purpose). It makes a whole load of .com files to trick the computer into loading them (ie cmd.com, so when you specify "cmd" it launches the .com file instead of the .exe)
|
|
#28
|
|||
|
|||
|
Quote:
Your code does work as intended without any adverse effects as it is a turn based game but there are bad side effects that were not mentioned and not visible in this program. Quote:
Code:
currentPadState.Buttons & PSP_CTRL_UP |
|
#29
|
||||
|
||||
|
@nobugging: Stopping the game is actually the purpose here. This isn't an action game, so using an independent timer is just making things overly complex, and unnecessary.
In either case, using an independent timer, the game would still have to freeze, so it's completely pointless in this case. |
|
#30
|
||||
|
||||
|
I was just about to say the same things Zingaburga. There are a million ways of coding to end up with the same result. What Zingaburga suggested and my code are not wrong, nobugging. My code works just fine to get the desired results that killaj was looking for. IF you actually played the game, nobugging, you would see that for yourself. There are probably over a hundred different ways to display helloworld on your psp. None of them would be wrong. If you want to talk about "Correct" code, nobugging, then the "Correct" code would be the simplest and fastest code to get your desired result. If that was the case, then my code and what zingaburga suggested would be the "correct" code as you would say.
@itsalldasame2me, yeah do what Zingaburga suggested and scan your computer for viruses. That might solve the problem. Post if it doesn't and then i'll look more into it for you.
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here www.psp-hacks.com/forums/viewtopic.php?id=65403 Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/view...693884#p693884 Want to learn how to program C++ ? Check out that tutorial here www.psp-hacks.com/forums/viewtopic.php?id=28694 |
![]() |
|
|
|||
|
|||
|
|
| Thread Tools | |
| Display Modes | |
|
|