Search found 16 matches
- Sun May 10, 2020 4:48 am
- Forum: General
- Topic: How to correctly read text from keyboard
- Replies: 7
- Views: 8823
Re: How to correctly read text from keyboard
https://www.youtube.com/watch?v=-AQfQFcXac8 What do you want to do ? What do your classes represent ? To respond to the title of your post : Callback : https://love2d.org/wiki/love.keypressed Inside love.update: https://love2d.org/wiki/love.keyboard.isDown Sorry for not be clear I reedit my questio...
- Sun May 10, 2020 12:19 am
- Forum: General
- Topic: How to correctly read text from keyboard
- Replies: 7
- Views: 8823
How to correctly read text from keyboard
This is my class diagram: https://i.ibb.co/RNHVZh1/test.png and this is my code: require "views/functionView" function love.load () functionView = FunctionView() end function love.draw () functionView:draw() end function love.textinput (text) -- ??? end function love.update (dt) functionVi...
- Sun May 03, 2020 9:56 pm
- Forum: Support and Development
- Topic: Unexpected behaviour in events and objects
- Replies: 4
- Views: 2886
Re: Unexpected behaviour in events and objects
I believe this quirk happens because the events can be sent by a thread, therefore its contents need to be independent of the Lua context (because different threads use different Lua contexts in Löve), therefore the values need to be copied, not referenced. The metatable is not copied, but even if ...
- Sun May 03, 2020 6:22 am
- Forum: Support and Development
- Topic: Unexpected behaviour in events and objects
- Replies: 4
- Views: 2886
Re: Unexpected behaviour in events and objects
What you receive in the event handler is a copy of the table that has the original metatable stripped from it. function love.handlers.foo(t) print("received", t, getmetatable(t)) end local t = setmetatable({}, {}) print("sending", t, getmetatable(t)) love.event.push("foo&qu...
- Sun May 03, 2020 5:03 am
- Forum: Support and Development
- Topic: STI and collision
- Replies: 9
- Views: 12682
Re: STI and collision
Love2D documentation have a nice list of tutorials: https://love2d.org/wiki/Category:Tutorials The first in the list have a very nice explication about 2D collisions: https://sheepolution.com/learn/book/13 It have too a very compressive introduction to tiles and collisions: https://sheepolution.com/...
- Sun May 03, 2020 1:51 am
- Forum: Support and Development
- Topic: Unexpected behaviour in events and objects
- Replies: 4
- Views: 2886
Unexpected behaviour in events and objects
Hi, I implemented my object with the classic module: https://github.com/rxi/classic/blob/master/classic.lua Node = Object.extend(Object) function Node:new (imgDir) self.img = love.graphics.newImage(imgDir) end function Node:draw (y, scale) -- This if works for know if a node is in the middle of the ...