Textured Polygons for All!

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: Textured Polygons for All!

Post by xXxMoNkEyMaNxXx »

Ref, you need to send it the new sizeY! The forgettable SO ANNOYING variable.
User avatar
IndieKid
Citizen
Posts: 80
Joined: Sat Dec 22, 2012 7:05 pm
Contact:

Re: Textured Polygons for All!

Post by IndieKid »

xXxMoNkEyMaNxXx wrote:@IndieKid If you can get the positions on screen, it will put an image on it, so it should already support that... This basically replaces the part where you call love.graphics.polygon with a funtion that will draw the polygon and put an image on it.
Sure, thanks. Gotta try that. :megagrin:
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: Textured Polygons for All!

Post by Ref »

xXxMoNkEyMaNxXx wrote:Ref, you need to send it the new sizeY! The forgettable SO ANNOYING variable.
Knew it was something obvious.
Thanks xXxMonNkEyMaNxXx!
Now working great!
Previous demo replaced.
Effect definitely works with canvases!
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Polygons for All!

Post by Jasoco »

So any idea on how to fix the "module unloaded after setMode" problem? I can't have my game change its resolution while in game and still have the texture module work. As soon as I call setMode the module stops working and it doesn't work again until I restart because I can't just require the module again because it doesn't work. Any way to force it?
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Textured Polygons for All!

Post by Nixola »

love.filesystem.load?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Polygons for All!

Post by Jasoco »

Nixola wrote:love.filesystem.load?
MonkeyMan said it should be loaded as a module. Which is what I am doing.

Code: Select all

texture=require 'Perspective'
"This was made to be a module, PLEASE USE IT AS A MODULE"
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Textured Polygons for All!

Post by Nixola »

Well, lf.load does the same thing, except it will execute the file again if already loaded and it allows you to have multiple instances of a module, if it doesn't use globals
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: Textured Polygons for All!

Post by xXxMoNkEyMaNxXx »

What is the problem with reloading the module?
This was made to be a module, PLEASE USE IT AS A MODULE
I was upset because my uber-efficient code (at least in my eyes) had been butchered. You can obviously do whatever you want, but I can only hope that you will be efficient. :P
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Polygons for All!

Post by Jasoco »

xXxMoNkEyMaNxXx wrote:What is the problem with reloading the module?
This was made to be a module, PLEASE USE IT AS A MODULE
I was upset because my uber-efficient code (at least in my eyes) had been butchered. You can obviously do whatever you want, but I can only hope that you will be efficient. :P
It doesn't work. Using love.filesystem.load that is. If I try to load it I get the following errors:

love.filesystem.load("Perspective.lua")()

Code: Select all

Error: Perspective.lua:151: bad argument #1 to 'module' (string expected, got no value)
stack traceback:
	[C]: in function 'module'
	Perspective.lua:151: in main chunk
	main.lua:107: in function 'load'
	main.lua:61: in function <main.lua:56>
	[C]: in function 'xpcall'
Occurs at loadup.

love.filesystem.load("Perspective.lua")

Code: Select all

Error: draw.lua:89: attempt to index global 'texture' (a function value)
stack traceback:
	draw.lua:89: in function 'drawTriangles'
	draw.lua:12: in function 'drawGamePolys'
	game.lua:51: in function 'draw'
	main.lua:148: in function 'draw'
	main.lua:86: in function <main.lua:56>
	[C]: in function 'xpcall'
Occurs when texture is attempted to be used.

Just using texture = require 'Perspective' after it has already been loaded and setMode has been used results in the textures not working anymore.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Textured Polygons for All!

Post by Robin »

Have you tried
love.filesystem.load("Perspective.lua")("Perspective.lua")?

(By the way, boo module)
Help us help you: attach a .love.
Post Reply

Who is online

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