Page 5 of 15

Re: Textured Polygons for All!

Posted: Sun Jan 27, 2013 10:35 am
by xXxMoNkEyMaNxXx
Ref, you need to send it the new sizeY! The forgettable SO ANNOYING variable.

Re: Textured Polygons for All!

Posted: Sun Jan 27, 2013 11:52 am
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:

Re: Textured Polygons for All!

Posted: Sun Jan 27, 2013 4:34 pm
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!

Re: Textured Polygons for All!

Posted: Mon Jan 28, 2013 10:01 pm
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?

Re: Textured Polygons for All!

Posted: Mon Jan 28, 2013 10:03 pm
by Nixola
love.filesystem.load?

Re: Textured Polygons for All!

Posted: Mon Jan 28, 2013 10:05 pm
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"

Re: Textured Polygons for All!

Posted: Mon Jan 28, 2013 10:08 pm
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

Re: Textured Polygons for All!

Posted: Mon Jan 28, 2013 11:18 pm
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

Re: Textured Polygons for All!

Posted: Tue Jan 29, 2013 7:01 am
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.

Re: Textured Polygons for All!

Posted: Tue Jan 29, 2013 12:33 pm
by Robin
Have you tried
love.filesystem.load("Perspective.lua")("Perspective.lua")?

(By the way, boo module)