love.graphics.oldPrint = love.graphics.print
function love.draw()
love.graphics.scale(2, 2)
love.graphics.print("Hardcore LOVE", 1, 1)
end
function love.graphics.print(text, x, y)
love.graphics.oldPrint(text, x, y)
end
This doesn't (only the position of love.graphics.scale has changed):
love.graphics.oldPrint = love.graphics.print
function love.draw()
love.graphics.print("Hardcore LOVE", 1, 1)
end
function love.graphics.print(text, x, y)
love.graphics.scale(2, 2)
love.graphics.oldPrint(text, x, y)
end
This might sound silly but try putting the print function before draw this might be wrong but I had a problem just link this in a standard lua function when calling functions like you are maybe it will work maybe not but at lest its a try ?
Sir Kittenface Möko IDE Codename (Erös) Returns Soon
I am dyslexic so if any of my replys confusing please just ask me to reword it as this will make things a lot easier for all parties lol.
crow wrote:This might sound silly but try putting the print function before draw this might be wrong but I had a problem just link this in a standard lua function when calling functions like you are maybe it will work maybe not but at lest its a try ?
Yeah I messed around with positioning a bit myself, it doesn't seem to help.
crow wrote:This might sound silly but try putting the print function before draw this might be wrong but I had a problem just link this in a standard lua function when calling functions like you are maybe it will work maybe not but at lest its a try ?
This shouldn't be a problem, Lua doesn't statically find functions like C/C++. If it's in the global namespace when called, it's all good.
I'm not really sure why it's not working, although I think should only need to call love.graphics.scale once, in love.load or something. But, I might be wrong.
BlackBulletIV wrote:I'm not really sure why it's not working, although I think should only need to call love.graphics.scale once, in love.load or something. But, I might be wrong.
You are, in fact, wrong. You need to do it every frame before drawing the things you want scaled (also: look at love.graphics.push and -pop).
Not sure why the code in the OP doesn't work. I would suggest not to redefine any API functions, which will probably only lead to people crying and being confused.
love.graphics.oldPrint = love.graphics.print1
function love.graphics.print1(...)
love.graphics.scale(2, 2)
love.graphics.oldPrint(...)
end
function love.draw()
love.graphics.print("Hardcore LOVE", 1, 1)
end
That's an horrible idea though. I would not recommend doing that. If you need that extra functionality, just add a new function. You don't even need to define it inside the love.graphics namespace.
Robin wrote:I would suggest not to redefine any API functions
Looking at that, I think you might need to call love.graphics.print once, and then redefine it (or, you could use the method shown above of course). That'll probably work. But as said, it's not a good idea to go hacking around with the Love internals like that.
EmmanuelOga wrote:
That's an horrible idea though. I would not recommend doing that. If you need that extra functionality, just add a new function. You don't even need to define it inside the love.graphics namespace.
Robin wrote:I would suggest not to redefine any API functions
I agree.
Well that is certainly interesting. I wonder why they did it that way, thanks for your answer though.
I understand overriding the API is usually a bad idea, but there's a very specific reason I'm doing this and it's important for testing without having to rewrite a bunch of code.