"Questions that don't deserve their own thread" thread

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Locked
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Jasoco »

Zilarrezko wrote:I'm putting my question here because I think I'm starting to clutter stuff up with my own topics.

So I've been working with 3D for the past few weeks. Mostly looking forward into concepts that I'll need in the future.

...
I'd love to see it but it seems to crash on line 9 of the model loader because apparently io.load is not returning anything on my system. Can you not use the built-in filesystem stuff?
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Jasoco wrote:
Zilarrezko wrote:I'm putting my question here because I think I'm starting to clutter stuff up with my own topics.

So I've been working with 3D for the past few weeks. Mostly looking forward into concepts that I'll need in the future.

...
I'd love to see it but it seems to crash on line 9 of the model loader because apparently io.load is not returning anything on my system. Can you not use the built-in filesystem stuff?
ah, Here's the same thing I believe, just using the Löve API instead of Lua's filesystem io.open. As far as I know it does the same thing, right down to the error in 3ddraw.
Attachments
_Workspace.love
Here's the fix
(484.14 KiB) Downloaded 114 times
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Jasoco »

After racking my brain for much more time than I should have, and so much code changing and testing, I came upon a solution for you.

The following changes should remove the error: (Though I don't see anything draw)

Change the following line with the a, b, c, d to:

Code: Select all

local a, b, c, d = tonumber(face[t][1]), tonumber(face[t][2]), tonumber(face[t][3]), tonumber(face[t][4])
For some reason I guess a, b, c and d are being converted to strings instead of staying as numbers.

And secondly, you are passing your polygon points as an incorrectly structured table.

You're passing what would be like so: { { x, y }, { x, y }, { x, y }, { x, y } }

What you need to do is pass it as a flat table: { x, y, x, y, x, y, x, y }

This code helps stuff it all into a flat table, I'm sure there's a better way:

Code: Select all

local p = {}
for j = 1, #poly do
	p[#p+1] = poly[j][1]
	p[#p+1] = poly[j][2]
end
gfx.polygon("line", p)
Of course I don't see anything being drawn, but the error is gone.
M_Bison
Prole
Posts: 2
Joined: Tue Aug 26, 2014 1:13 pm

Re: "Questions that don't deserve their own thread" thread

Post by M_Bison »

I'm trying to create a collider table, I think I tried almost everything, not sure how to handle adding and removing colliders (I want to add and remove bullet colliders in a top-down shooter)

Code: Select all

bulletsCollider = {}

table.insert(bulletsCollider,Collider:addCircle(playerX,playerY,bulletRadius))
all other values like in the tutorial
Attachments
test.love
(21.62 KiB) Downloaded 259 times
lumlune
Prole
Posts: 12
Joined: Fri May 02, 2014 9:50 pm

Re: "Questions that don't deserve their own thread" thread

Post by lumlune »

Is anyone aware of a way I can artificially bold a font? I find that my mock-ups in Photoshop often look much nicer because the text is more heavy-set where it's scrawny in-game.

I don't expect it to look identical, but what is there as far as font manipulation goes?
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Ah! got it!

you got me thinking, but I did it. Still have stuff behind you still rendering. I'm going to need another week to think about that. and like 5 weeks to implement it because I'm slow like that.
Attachments
_Workspace.love
(483.87 KiB) Downloaded 107 times
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by Jasoco »

Well keep at it. If you're good enough, eventually you can have something as cool as this:

Image
(A GIF that is once again completely outdated)
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Dang, well... Don't think I'll get to where that gif is anytime soon. I'm not sure if I'll ever get to the point of doing shaders well enough to make any thing out of em. So spheres will just look like circles. But by taking some code from here and there, Jamie King for Culling and Oysi for the things that render behind you (although not by using clipping, which is probably better frame wise by not using clipping), I made a jump in development.

Of course though still, Concave polygon structures like the torus and the monkey head and kicking my arse by still rendering polygons behind the structure. I thought of a way to fix it through 2D collision detection and z vertex calculating, but it would require some serious frame loss.

Alas, just hitting walls now. Anyone know how to render textures to 3D triangles? I'd like to do that without changing code structure too much. But I know in the end I'll just be building it back up again to accommodate shaders (but I can't even get those to do something practical in 2D). Not sure where to go from here, but there is a weird bug when you spawn more than one type of object and then move around.

Here's my update, although I should probably stop posting here, I'm getting off topic :/.
Attachments
_Workspace.love
(501.15 KiB) Downloaded 100 times
User avatar
Cryogenical
Prole
Posts: 49
Joined: Mon Apr 28, 2014 5:23 pm

Re: "Questions that don't deserve their own thread" thread

Post by Cryogenical »

How should I go about making my window able to be toggled to windowed-borderless and back again?

Code: Select all

function love.keypressed(key, unicode)
if key == "5" then
end
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: "Questions that don't deserve their own thread" thread

Post by Zilarrezko »

Cryogenical wrote:How should I go about making my window able to be toggled to windowed-borderless and back again?

Code: Select all

function love.keypressed(key, unicode)
if key == "5" then
end
Here's your magic function!

here's how I would do it just to make it what you said.

Code: Select all

local resizeable = false --Notice the spelling, not important, it's just for clarity 

function love.keypressed(key, unicode)
      if key == "5" then
           resizeable = not resizeable
           love.window.setMode(1080, 720, {resizable = resizeable}) --The key "resizable" Must be called resizable, no spelling mistakes
      end
end
See how that works, and Play around with it.
Locked

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests