Giter VIP home page Giter VIP logo

joykey's Introduction

joykey and vjoy by Ponywolf

Demo

These two modules can be strung together to make an on screen joystick control that outputs key events, thereby reducing some of the complexity of writing game interface code. Read more about Corona SDK key events here... https://docs.coronalabs.com/api/event/key/index.html

joykey.lua

Converts joystick axis events into key events in Corona SDK

Usage:

Just add this line to your main.lua

require("com.ponywolf.joykey").start()

This module turns gamepad axis events into keyboard events so we don't have to write separate code for joystick and keyboard control. Axis 1 & 2 will return up/down/left/right keyboard events and Axis 3 & 4 will return w/a/s/d keyboard events.

vjoy.lua

A modern on-screen joystick and button class that emulate gamepad axis and key events. Basically, if you have a game that works with gamepad input these on screen controls can be customized to make it work with on-screen controls

Usage:

Require the module in your main.lua

local vjoy = require "com.ponywolf.vjoy"

Add a virtual joystick

vjoy.newStick(startAxis, innerRadius, outerRadius)
StartAxis

The first axis of the two for your joystick (defaults to 1)

innerRadius

Size of the joystick control (defaults to 48px) or a filename of an image to load for the joystick forground

outerRadius

Size of the joystick movement area (defaults to 496px) or a filename of an image to load for the joystick background

Add a virtual button

vjoy.newButton(key, radius)
key

The keyName of the button you want to fire (defaults to "buttonA")

radius

Size of the button control (defaults to 64px) or a filename of an image to load for the button

joykey's People

Contributors

superqix avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.