Search found 4835 matches
- Sun Nov 19, 2017 4:39 pm
- Forum: General
- Topic: Mixins, Composition, and Inheritance Guidelines
- Replies: 8
- Views: 10763
Re: Mixins, Composition, and Inheritance Guidelines
Please don't double (or triple) post.
- Sun Nov 12, 2017 11:31 am
- Forum: Support and Development
- Topic: Coloring a spriteBatch sprite
- Replies: 4
- Views: 2680
Re: Coloring a spriteBatch sprite
Like love.graphics.setColor does without SpriteBatches, SpriteBatch:setColor affects the colour of the sprites added after the call.
- Sun Nov 12, 2017 10:20 am
- Forum: General
- Topic: Local iterator functions slower than global?
- Replies: 14
- Views: 11469
Re: Local iterator functions slower than global?
But as was explained above, that's because the iterators specifically have special codepaths that are apparently sensitive to the function name. We have also seen that if you name the locals the same, it does have a (very small) positive effect. Anyway, it seems like the moral of the story, as ever,...
- Sat Nov 11, 2017 12:20 pm
- Forum: Support and Development
- Topic: cut out a part of a screen and draw it
- Replies: 3
- Views: 2980
Re: cut out a part of a screen and draw it
If you just want to draw it, can't you just the entire screen to a Canvas when you want to create the "screenshot", then draw part of that Canvas with a Quad?
- Fri Nov 10, 2017 5:10 pm
- Forum: Support and Development
- Topic: loading from love filesystem issue
- Replies: 5
- Views: 2630
Re: loading from love filesystem issue
If you just want one string containing all of the file's contents you can just use love.filesystem.read. Alternatively, if you want to iterate over all lines, there is love.filesystem.lines. Lastly, if you need something more complex you can create a File object and read it that way.
- Thu Nov 09, 2017 11:58 am
- Forum: Support and Development
- Topic: Need help with upscaling to fullscreen resolution
- Replies: 2
- Views: 4711
Re: Need help with upscaling to fullscreen resolution
Well, let's see how we could calculate the scale factor and offset: local xscale = actual_width/desired_width local yscale = actual_height/desired_height local scale = math.min(xscale, yscale) -- Maybe also call math.floor, if you want local xoffset = (actual_width-desired_width*scale)/2 local yoffs...
- Sat Nov 04, 2017 3:09 pm
- Forum: Libraries and Tools
- Topic: HooECS, the wise choice!
- Replies: 13
- Views: 14225
Re: HooECS, the wise choice!
I suggets: self.active = (active == true) In this special case you mean probably this?: self.active = (type(active) == "boolean") and active or true; The intended default for the ommited parameter is true here. I can't believe neither of you posted the obvious solution: self.active = acti...
- Sat Nov 04, 2017 3:05 pm
- Forum: Support and Development
- Topic: event driven mqtt subscription in love2d
- Replies: 3
- Views: 2737
Re: event driven mqtt subscription in love2d
I took a quick look at the library, and it seems to expect you to call the message_loop function in order to actually receive messages.
- Mon Oct 30, 2017 11:00 am
- Forum: Support and Development
- Topic: Referencing "self" inside of class functions outside of class creation
- Replies: 3
- Views: 4130
Re: Referencing "self" inside of class functions outside of class creation
I should probably note that the setmetatable call is useless, since it sets the metatable of a temporary table you immediately discard. The usual way people do this is by creating these functions once, instead of for every object, and then making objects have a metatable with an __index metafield th...
- Mon Oct 30, 2017 10:49 am
- Forum: Support and Development
- Topic: Referencing "self" inside of class functions outside of class creation
- Replies: 3
- Views: 4130
Re: Referencing "self" inside of class functions outside of class creation
Well, the call site change is simple: newPlayer.load(newPlayer) -- is equivalent to newPlayer:load() As for the definition site, you can just name the first parameter self. A similar shorthand exists there: function sometable:somefunc(arg) end -- is equivalent to function sometable.somefunc(self, ar...