Printing text behind an image *SOLVED*

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
BleedObsidian
Prole
Posts: 2
Joined: Tue Aug 14, 2012 4:52 pm

Printing text behind an image *SOLVED*

Post 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!
Last edited by BleedObsidian on Tue Aug 14, 2012 6:23 pm, edited 1 time in total.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Printing text behind an image

Post 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
Help us help you: attach a .love.
BleedObsidian
Prole
Posts: 2
Joined: Tue Aug 14, 2012 4:52 pm

Re: Printing text behind an image

Post by BleedObsidian »

Ah, thanks!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests