Page 1 of 2

Image not Displaying Right

Posted: Wed Oct 05, 2016 8:33 am
by yetneverdone
Hi, im trying to draw this image:
title screen.gif
title screen.gif (176.53 KiB) Viewed 5418 times
But when I draw it using the love.graphics.draw function, it shows this:
Screenshot_2016-10-05_16-20-12.png
Screenshot_2016-10-05_16-20-12.png (15.84 KiB) Viewed 5418 times
I tried applying (255,255,255,255) as the love.graphics.setColor() before drawing the image, but still that happens

Note: the text at the second image is my title screen text


EDIT: Thank you for everything! This love2d community is really helpful for a love2d-beginner like me.

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 8:35 am
by sherpal
If you don't provide the code snippet you have now, it will be difficult to help :)

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 9:51 am
by zorg
Off the top of my head, löve doesn't support gif files... out of the box, i mean; there's at least one gif loader library that handles them.

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 1:39 pm
by yetneverdone
zorg wrote:Off the top of my head, löve doesn't support gif files... out of the box, i mean; there's at least one gif loader library that handles them.
It's not a .gif file

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 1:41 pm
by yetneverdone
sherpal wrote:If you don't provide the code snippet you have now, it will be difficult to help :)
Okay, here is the code for the whole class I made:
I used the classic OOP library

Code: Select all

local Anim = Object:extend()
function Anim:new(path,name,fw,fh,iw,ih)
	self.path = path
	self.name = name
	self.fw = fw
	self.fh = fh
	self.iw = iw
	self.ih = ih

	self.rowFrames = self.iw / self.fw
	self.colFrames = self.ih / self.fh
	self.totalFrames = self.rowFrames * self.colFrames

	self.image = love.graphics.newImage(self.path)

	self.animationFrames = {}

	--total number per frames
	for i = 1, self.totalFrames do
		--make per rows
		for row = 1, self.rowFrames do
			--make per columns 
			for col = 1, self.colFrames do
				--x
				for x = 1, self.iw, self.fw do
					--y
					for y = 1, self.ih, self.fh do
						i = love.graphics.newQuad(x,y,self.fw,self.fh,self.image:getWidth(),self.image:getHeight())
					end
				end
			end
		end

		table.insert(self.animationFrames,i)
	end
end

function Anim:update(dt)
	
end

function Anim:draw()
	love.graphics.setColor(255,255,255,255)
	for i = 1, #self.animationFrames do
		love.graphics.draw(self.image,self.animationFrames[i],i*,0,0,0.5,0.5)
	end
end

return Anim

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 1:47 pm
by yetneverdone
Oh, another thing is, even i tried to display it the normal way, like
function love.load()
image = love.graphics.newImage("assets/image.png")
end

function love.draw()
love.graphics.setColor(255,255,255,255)
love.graphics.draw(image,0,0)
end
Displays the same

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 2:08 pm
by zorg
yetneverdone wrote:
zorg wrote:Off the top of my head, löve doesn't support gif files... out of the box, i mean; there's at least one gif loader library that handles them.
It's not a .gif file
I'm sorry, i just assumed it was, given what you said in the first post:
yetneverdone wrote:Hi, im trying to draw this image:
[title screen.gif]
Also, the other image was so vastly different than the first, without code, i don't think we could have helped.
A love file could be helpful.

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 2:16 pm
by yetneverdone
zorg wrote:
yetneverdone wrote:
zorg wrote:Off the top of my head, löve doesn't support gif files... out of the box, i mean; there's at least one gif loader library that handles them.
It's not a .gif file
I'm sorry, i just assumed it was, given what you said in the first post:
yetneverdone wrote:Hi, im trying to draw this image:
[title screen.gif]
Also, the other image was so vastly different than the first, without code, i don't think we could have helped.
A love file could be helpful.
Sorry about that.

Well it would be my whole project haha is it okay?

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 4:15 pm
by pgimeno
Maybe you're setting something else before calling love.graphics.draw? Like a stencil, a blend mode, a shader...?

If not, then yes, attaching a .love file to your post should help. Preferably a trimmed down version that still exhibits the problem, but it's OK if it's the whole project.

Re: Image not Displaying Right

Posted: Wed Oct 05, 2016 4:17 pm
by yetneverdone
pgimeno wrote:Maybe you're setting something else before calling love.graphics.draw? Like a stencil, a blend mode, a shader...?

If not, then yes, attaching a .love file to your post should help. Preferably a trimmed down version that still exhibits the problem, but it's OK if it's the whole project.
There is no shader, stencil, or blend mode. Okay I will attach it