hi all,
can any1 show me how to create and handle button action? coz all the tutorial are in a forever loop to check if user press any key.
maybe in a form of interrupt or whatsoever...
also can any1 show me how to create a lightweight thread to run some job, perhaps a helloworld thread....
thanks
Help in Button event and Thread
Re: Help in Button event and Thread
pspsdk/src/samples/controller/basiczniter81 wrote: can any1 show me how to create and handle button action? coz all the tutorial are in a forever loop to check if user press any key.
maybe in a form of interrupt or whatsoever...
that sample has a while loop ;)
pspsdk/src/samples/kernel/threadstatus
so basically: take a look at sample sources and the documentation.
Re: Help in Button event and Thread
the pspsdk/src/sample/controller/basic are using while loop. but it wasting processing power looping and doing nothing. is there a way to implement it as a interrupt or other, so that when press it activate a function?weak wrote:pspsdk/src/samples/controller/basiczniter81 wrote: can any1 show me how to create and handle button action? coz all the tutorial are in a forever loop to check if user press any key.
maybe in a form of interrupt or whatsoever...
that sample has a while loop ;)
pspsdk/src/samples/kernel/threadstatus
so basically: take a look at sample sources and the documentation.
etc j2SE when button is press it has a actionListener...
thx
Re: Help in Button event and Thread
sceCtrlReadBufferPositive() is a blocking call - so no wasted processing. Use sceCtrlPeek* if you want to see if there's any button press/release events to check for without blocking.zniter81 wrote: the pspsdk/src/sample/controller/basic are using while loop. but it wasting processing power looping and doing nothing.
Adam
Re: Help in Button event and Thread
so what u mean is that if user didn't press anything it will stop at sceCtrlReadBufferPositive(). proceed untill a key is pressed.zilt wrote: sceCtrlReadBufferPositive() is a blocking call - so no wasted processing. Use sceCtrlPeek* if you want to see if there's any button press/release events to check for without blocking.
Adam
thats not quite accurate.... sceCtrlReadBufferPositive reads the buttons, and then waits for vblank before it returns (thus it isnt "blocking"). the vblank routine internally allows other threads to run while its waiting (so there is no cpu time wasted while doing so). the sceCtrlPeek* functions only read the buttons and then immediatly return, so you have to take care of the above yourself.sceCtrlReadBufferPositive() is a blocking call - so no wasted processing. Use sceCtrlPeek* if you want to see if there's any button press/release events to check for without blocking.
as for an interrupt, i think you could register one, but i think it can only be done in kernel mode - and i dont think its generally a good idea either.