GithubHelp home page GithubHelp logo

boipushy's People

Contributors

a327ex avatar davisdude avatar harrisi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boipushy's Issues

Documentation: when to call `input:update()`

I just spent a bit of time figuring out that the reason :down(..) would work but :pressed(..), etc. wouldn't was because I was calling input:update() before checking the state of the inputs.

It might be worth highlighting this in the README.md with an example :)

For example:

function love.update(dt)
    if input:pressed('down') then print('down was pressed!') end
    -- your other input checks here..
    input:update()
end

License header

For a single-file library it makes sense to add a LICENSE header:

-- Copyright (c) 2015-2017 SSYGEN
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.

local input_path = (...):match('(.-)[^%.]+$') .. '.'
local Input = {}
Input.__index = Input

...

Is the LICENSE file up to date (2015 adnnnzzzZZ)?

Anyway, I thought you might consider changing it.

not all mouse codes included

if i add a print here

function Input:mousepressed(x, y, button)
    print(button)
    self.state[button_to_key[button]] = true
end

my mouse buttons cause it to print 'l' and 'r', and then crash because those are not in the button_to_key table.

r
Error: libs/Input.lua:258: table index is nil
stack traceback:
        libs/Input.lua:258: in function <libs/Input.lua:256>
        libs/Input.lua:62: in function <libs/Input.lua:60>
        [string "boot.lua"]:425: in function <[string "boot.lua"]:399>
        [C]: in function 'xpcall

i'm using nixos

input:pressed and input:released broken

Since I updated to new version, my game broke and after some debugging I encounter that input:pressed() and input:released() seems to be broken. input:pressed() acts the same as input:down() and input:released() just returns nothing.

EDIT: after some tests I found that love.update and all the other callbacks gets overwritten. so when boipushy registers the callbacks, it does nothing, they gets overwritten with the actual function on the main.lua file.

Arguments

How do i deal with arguments?

Example, how can i get the x,y passed into mousepressed? The button is there with mousepressed1 and so on, but how about the x,y?

Thanks

Touch Inputs

This input library is very useful! Although i was wondering if you plan to implement touch inputs like the love.touchpressed and love.touchreleased functions

input:pressed doesn't work

Your example if input:pressed('print') then print(1) end actually doesn't work, input:pressed only works when the key has been bind with a function, but not with a name.

How to add new controllers doc

Hi, @adonaac

Can you document how to add support for new controllers, please? I own a generic Multilaser joystick and I'd like to use it to play test my game. I'm on OS X.

Thanks in advance! 😄

Stability?

Is the master branch kept stable enough to be based upon in development? Also are you planning on implementing some sort of versioning system so users can tell if a change will break past compatibility?

Way to bind all keys to an action

Is there any way to bind all keys to a certain action (aside from manually doing each one)?
Something like:

input:bind( 'all', function() self.jumped = true end )

Infinite loop with tricky requires (?)

It could be my fault, but when I'm using Thranduil and it requires this module, the part that does... something with the path goes into an infinite loop.
Relevant code:

local current_path = ''
local current_index = 0
while debug.print ( #current_path ) ~= debug.print ( #input_path ) do
    local _, index, temp = input_path:find( '(.-)%.', current_index )
    if not index then current_path = input_path break end
    if love.filesystem.exists( current_path .. temp ) then -- Allow for . in folder names (even though this isn't currently allowed using require...)
        current_path = current_path .. temp .. '/'
        current_index = index + 1
    end
end

I've grepped the project to see if these variables are used anywhere and couldn't find anything, so I simply commented it out in my local repo.

Does not work inside a .love

When you put this inside of a .love you get an error. Maybe it could be backed inside of the save directory?

Error

main.lua:3: module 'Utilities.thomas.input' not found:
no field package.preload['Utilities.thomas.input']
no file 
blah blah blah blah blah...

Order of Calling

If you check input:pressed or input:released after input:update it will always register as false.
Don't know if this is intentional or not, but you may want to add it to the documentation.

Invalid key constant error with Love2D 11.0

According to the changelog

Changed love.keyboard.isDown and love.keyboard.isScancodeDown to error if an invalid enum value is given.

the check on line 171 will now error on Love2D 11.0 for mouseX keycodes.

Problem with the "input:down" function

I'm running through the Love2d tutorial and the below code causes the below error

function love.update(dt)
if input:down('kp+', 0.25) then increment() end
end

"Error

libraries/boipushy/input.lua:166: bad argument #1 to 'ipairs' (table expected, got nil)

Traceback

[C]: in function 'ipairs'
libraries/boipushy/input.lua:166: in function 'down'
main.lua:51: in function main.lua:48
libraries/boipushy/input.lua:61: in function 'update'
[C]: in function 'xpcall'"

Better way of handling inputs?

Hey, i have questions. Consider the following:

local keys = {
  a = "printA",
  b = function() print("b") end,
}
local input = Input()
for k,v in pairs(keys) do
  input:bind(k, v)
end

local function printA() print("a") end

If i press "a", it will call the printA function.
If i press "b" it will use the anonymous function passed.

Now, what if i want to check in update the key "a" if it is down?

function love.update(dt)
  if input:down("a") then printA() end
  --or
  if input:down("printA") then printA() end
end

Isnt this repetitive?

I suggest, add an argument to bind that determines whether the binded key is for "down", "keypress", or "keyreleased" like

input:bind("a", "printA", "down") --default would be "keypressed"

This way, the library can check and call it internally without having to redo the if-statements

Clarify me if im wrong.

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.