Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 10, 2012, 01:09:51 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: C++ Input system  (Read 2994 times)
AlphaDingDong
Combat Muskrat
All-Around Dev
Hero Member
*

Karma: +32/-3
Offline Offline

Posts: 882
2044.69 points

View Inventory
Send Money to AlphaDingDong
Hey... Are you gonna eat that?


View Profile
« on: February 04, 2009, 03:42:32 PM »

I find myself including this in most of my projects now that I've started using C++.  Hopefully someone else can get some use out of it.  I tried to write some Doxy style comments in the header but I didn't bother to actually try running them through Doxygen so they may not work right.  (You can still just read them though.)

Anyway this is intended simply as a sort of mnemonic tool for input checking.  It has a couple of very small tricks but nothing too fancy.  To use it just add input.o to your makefile OBJS and include input.h in your project.  Once that's done you should call Input::initialize() while setting up, then when you want to poll input call Input::update() to capture the pad state and use any of the other functions to check button states in different ways:

press - whether the button is down
trigger - whether the button just now started to be pressed
release - whether the button was just now released
repeat - simulates keyboard-style repeating

It also has analog support (please read comments) and has a 'dir4()' function for simplifying digital pad direction handling via a 'switch' block.

Any suggestions for improvement can be PM'ed to me and I'll try to take time to respond.  I'm not really looking to add functionality though. (Except that eventually I'll actually fill in the code for dir8().)

Oh, and this isn't intended to compete with anyone else's input systems or anything.  It doesn't do anything really special.  It just simplifies input handling a little.
Logged


AlphaDingDong
Combat Muskrat
All-Around Dev
Hero Member
*

Karma: +32/-3
Offline Offline

Posts: 882
2044.69 points

View Inventory
Send Money to AlphaDingDong
Hey... Are you gonna eat that?


View Profile
« Reply #1 on: February 14, 2010, 01:07:31 PM »

Attachment appears to be non-functional.

Here's a link:
http://mayobe.webs.com/input_sys.rar
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.158 seconds with 25 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com