Newbie Image Question

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
keithf25
Prole
Posts: 2
Joined: Mon Jan 11, 2010 4:21 am

Newbie Image Question

Post by keithf25 »

ok, i have just started mucking about with LOVE (great so far, btw). I am running into a very basic problem. I am trying to draw some simple images to the screen, and i just get a white box, albeit in the right position and size. I am using lua code straight from the hamster ball demo. I even tried a .png from another demo, thinking perhaps it was my file. That gets me a white box as well. Could this be something external from LOVE itself? Hardware or drivers or something, possibly? Maybe my directX is out of date? Any pointers would be greatly appreciated. Here's my basic hacky code:

Code: Select all

function love.load()
   hamster = love.graphics.newImage("images/tulip.png")
   card_one = love.graphics.newImage("images/card_1.png")
   --x = 50
   --y = 50
   --speed = 100
end


function love.update(dt)
	mouse_x = love.mouse.getX()
	mouse_y = love.mouse.getY()
end



function love.draw()

  --love.graphics.print("Hello World", 400, 300)
  --love.graphics.circle("fill", 300, 300, 50)
  love.graphics.print( "Mouse X: ".. mouse_x .. " Mouse Y: " .. mouse_y, 10, 20 )
  --love.graphics.draw(hamster, 50, 50)
  love.graphics.draw(card_one, 300, 50)
end
User avatar
Fourex
Citizen
Posts: 53
Joined: Tue Nov 10, 2009 2:33 am
Location: Earth

Re: Newbie Image Question

Post by Fourex »

I can't figure out what you're doing wrong, unless you're forgetting to put the images in a file called "images". But, I'm not exactly an expert...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Newbie Image Question

Post by bartbes »

With older videocards/drivers you get those white boxes when your images are not correctly sized, their width and height need to be a power of two (but width doesn't need to be the same as height), so, for example 256x128.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Newbie Image Question

Post by TechnoCat »

keithf25
Prole
Posts: 2
Joined: Mon Jan 11, 2010 4:21 am

Re: Newbie Image Question

Post by keithf25 »

Yup, it was the power of 2 issue. Thanks everybody for your help!
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests