Page 1 of 1

Printing text behind an image *SOLVED*

Posted: Tue Aug 14, 2012 4:59 pm
by BleedObsidian
Hello,

The text I print onto the screen is behind an image but I want it to be on top.
How can I do this?

Main.love:

Code: Select all

function love.load()
	GameState = "titlemenu"

	--Title Screen
		require "titlescreen"
		
		--Load Images
			TitleScreenLoadImages()
end

function love.update()
	--Title Screen Update Functions
		TitleScreenUpdate()
end

function love.draw()
	if GameState == "titlemenu" then
		TitleScreenDraw()
	end
end
titlescreen.love:

Code: Select all

function TitleScreenLoadImages()
	--Background
		TitleMenuBackground =  love.graphics.newImage("res/titlescreenbackground.png")
		
	--Buttons
		TitleMenuButton1 =  love.graphics.newImage("res/buttons/newgame.png")
		
		TitleMenuButtonS1 =  love.graphics.newImage("res/buttons/newgameS.png")
end

function TitleScreenUpdate()
	--Set variables
		TitleScreenFPS = 0
		TitleScreenMouseXPos = 0
		TitleScreenMouseYPos = 0
	
	--Get FPS and Mouse Postion
		TitleScreenFPS = love.timer.getFPS()
		TitleScreenMouseXPos = love.mouse.getX()
		TitleScreenMouseYPos = love.mouse.getY()
end

function TitleScreenDraw()
	--Draw Background
		love.graphics.draw(TitleMenuBackground, 0, 0)
		
	--Draw Mouse Postion and FPS
		love.graphics.getColor(0, 0, 0)
		
		love.graphics.print("FPS: " .. TitleScreenFPS, 100, 2)
		love.graphics.print("Mouse: " .. TitleScreenMouseXPos .. ", " .. TitleScreenMouseYPos, 2, 4)
		
	--Draw Buttons
		--love.graphics.draw(TitleMenuButton1, 100, 0)
end
Thanks!

Re: Printing text behind an image

Posted: Tue Aug 14, 2012 5:03 pm
by Robin
You mean like this?

Code: Select all

function TitleScreenDraw()
	--Draw Background
		love.graphics.draw(TitleMenuBackground, 0, 0)
		
	--Draw Buttons
		love.graphics.draw(TitleMenuButton1, 100, 0)

	--Draw Mouse Postion and FPS
		love.graphics.getColor(0, 0, 0)
		
		love.graphics.print("FPS: " .. TitleScreenFPS, 100, 2)
		love.graphics.print("Mouse: " .. TitleScreenMouseXPos .. ", " .. TitleScreenMouseYPos, 2, 4)
end

Re: Printing text behind an image

Posted: Tue Aug 14, 2012 5:36 pm
by BleedObsidian
Ah, thanks!