Search found 57 matches

by HDPLocust
Wed Jan 08, 2020 3:44 am
Forum: Support and Development
Topic: Selecting multiple functions in one class depending on the modificator/table index
Replies: 5
Views: 1395

Re: Selecting multiple functions in one class depending on the modificator/table index

raidho36 wrote:
Tue Jan 07, 2020 3:27 pm
but having to navigate up the metatable tree is rather costly.
Not as costly as it seems.
Image

Just do not make >3-5 layers of abstractions.
by HDPLocust
Tue Jan 07, 2020 8:03 am
Forum: Support and Development
Topic: Is it possible to make a file explorer?
Replies: 6
Views: 986

Re: Is it possible to make a file explorer?

It's simple task using ffi-luafilesystem reimplementation like this: https://github.com/3scale/luafilesystem ... fs_ffi.lua.
No binaries, also it can read/write utf8-names instead of default lfs on windows, that can be very useful.
by HDPLocust
Tue Jan 07, 2020 7:57 am
Forum: Support and Development
Topic: [SOLVED] How do I import files from specific folder in the game directory?
Replies: 5
Views: 1436

Re: [SOLVED] How do I import files from specific folder in the game directory?

You sould use [\\] (it's regular backslash character). Backslash is the escape character in lua strings: print("Backslash is here \\") --> Backslash is here \ Also multiline/unescaped strings can be achived with [[]] syntax: print([[Backslash is here \]]) --> Backslash is here \ Backslash is used fo...
by HDPLocust
Tue Jan 07, 2020 7:39 am
Forum: Support and Development
Topic: Selecting multiple functions in one class depending on the modificator/table index
Replies: 5
Views: 1395

Re: Selecting multiple functions in one class depending on the modificator/table index

I think, the better way it's simple OOP inheritance. local Enemy = Class('enemy') -- main class function Enemy:init(...) ... end function Enemy:update(dt) ... end -- basic behavior function Enemy:draw() ... end local FlyingEnemy = Class(Enemy, 'estrong') -- children class function FlyingEnemy:init(....
by HDPLocust
Sat Dec 21, 2019 6:11 pm
Forum: Support and Development
Topic: Are sprite batches the solution to my low FPS?
Replies: 3
Views: 1323

Re: Are sprite batches the solution to my low FPS?

Every call of love.graphics.draw it's two-part process: 1. Send data to GPU (image + verticies + transform info, it's slow) 2. Draw data by GPU (it's mostly fast, if you don't use heavy shaders) Love2d have autobatching, so if you send one image a lot of times in a row, it may be transformed to one ...
by HDPLocust
Thu Jul 04, 2019 8:17 am
Forum: Support and Development
Topic: rectangles in line mode
Replies: 3
Views: 2134

Re: rectangles in line mode

Also you can love.graphics.translate(.5, .5) before rendering stuff (except text, it nicely renders with round coords)
by HDPLocust
Mon May 27, 2019 9:34 am
Forum: Support and Development
Topic: Polygon render errors [v11.2] [SOLVED]
Replies: 4
Views: 2608

Re: Polygon render errors [v11.2]

TheHUG wrote:
Sun May 26, 2019 7:08 pm
Why do you want to avoid triangulation?
Yea, it sometimes can't triangulate, so I use meshes now.
by HDPLocust
Sun May 26, 2019 4:39 pm
Forum: Support and Development
Topic: Polygon render errors [v11.2] [SOLVED]
Replies: 4
Views: 2608

Re: Polygon render errors [v11.2]

zorg wrote:
Sun May 26, 2019 4:33 pm
So unless you make it so it's convex and simple from the get-go, you will always need to triangulate it.
Ah, my bad. But this is bad too, hmm.
by HDPLocust
Sun May 26, 2019 2:59 pm
Forum: Support and Development
Topic: Polygon render errors [v11.2] [SOLVED]
Replies: 4
Views: 2608

Polygon render errors [v11.2] [SOLVED]

Hmm, it like render error (with non-convex polygons), how it can be solved without triangulation? It's just this love.graphics.polygon('fill', polygon_table) -- every point tries to make triangle with first point in list -- and love.graphics.polygon('line', polygon_table) -- drawed correctly nothing...
by HDPLocust
Fri May 17, 2019 12:10 am
Forum: Support and Development
Topic: Android language
Replies: 6
Views: 2145

Re: Android language

You can use locale shell command, but no guarantees. It's ok, don't use it, just ask user about preferred language at first launch. It's better way, srsly.