alijaya / ctrl Goto Github PK
View Code? Open in Web Editor NEWA input manager that handle input from user for flash/haXe
A input manager that handle input from user for flash/haXe
A input manager for flash/haXe So you don't have to write addEventListener to get keyboard input or mouse input You don't have to remember the keycode, just pass the string... It's used like this... In your main game loop, add Ctrl.instance.update(); in the end of the loop... For a shortcut you can store the singleton instance in a local variable for quick access... var c = Ctrl.instance; For checking whether a key is just pressed, use like this c.isPressed(theKey); For a key is down c.isDown(theKey); For a key is just released, use like this c.isReleased(theKey); For a key is up, use like this c.isUp(theKey); The "theKey" is a string, it can be "A", "B", "c", "1", "F1", "BacKSpace", "[", "up", etc... It's case insensitive, so UpperCase or LowerCase is work well... For mouse handling c.mouseLeave : a bool variable, to check if the mouse is in the swf or not c.mouseDown : a bool variable, to check if the mouse is down or not c.mousePressed : a bool variable, to check if the mouse is just pressed or not c.mouseUp : a bool variable, to check if the mouse is up or not c.mouseReleased : a bool variable, to check if the mouse is just released or not c.mouseX : a float variable, indicate mouse X position c.mouseY : a float variable, indicate mouse Y position c.mouseWheel : a int variable, indicate the mouse wheel delta And you can get the lastPressed key and lastReleased key too... And... support key buffering, so you can track user input for several input. And... check capsLock or numLock thingy and another feature... get justPressed character, usefull for text field thingy... c.getChar() it will give you the just pressed char, it depends on whether you hold shift or capslock is on or off.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.