hello. attached is a menu game that i have made. i would like to know if there is a way of replacing the text for pictures
thx
menu pictures
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
menu pictures
- Attachments
-
- menu game.love
- (1.58 KiB) Downloaded 120 times
Re: menu pictures
Yes of course You will have to replace the love.graphics.print() with love.graphics.draw(image, ...) in the draw() code of your button:
The wiki page shows an example for loading and drawing an image:
http://love2d.org/wiki/love.graphics.draw
Code: Select all
local image = love.graphics.newImage("hamster.png");
function button_draw()
for i,v in ipairs(button) do
if v.mouseover == false then
love.graphics.setColor(255,255,255)
end
if v.mouseover == true then
love.graphics.setColor(255,0,0)
end
love.graphics.setFont(medium)
-- love.graphics.print(v.text,v.x,v.y)
love.graphics.draw(image, v.x, v.y);
end
end
http://love2d.org/wiki/love.graphics.draw
Re: menu pictures
Just a quick question. why do you have to use "local image". plus is there a way to do it so you draw the buttons in main.lua like in my example with text?
also, plzz could you send my a .love file with the changes made.
thx
also, plzz could you send my a .love file with the changes made.
thx
Re: menu pictures
local images is a local variable. You should avoid using global variables whenever you can.CrocDev wrote:Just a quick question. why do you have to use "local image"
I'm not quite sure what you are asking hereCrocDev wrote:plus is there a way to do it so you draw the buttons in main.lua like in my example with text?
Re: menu pictures
Hope this help you
add the table as well for multiple!
add the table as well for multiple!
- Attachments
-
- menuImage.love
- (7.03 KiB) Downloaded 106 times
Re: menu pictures
thx a lot.but pielago, is there a way too add more buttons. (a newbie!)
Re: menu pictures
add more buttons to menu??? of course u can but not sure what you want exactly? different buttons or many same buttons???
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot], Hugues Ross and 8 guests