Image not Displaying Right

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.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Image not Displaying Right

Post by yetneverdone »

Hi, im trying to draw this image:
title screen.gif
title screen.gif (176.53 KiB) Viewed 5367 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 5367 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.
Last edited by yetneverdone on Thu Oct 06, 2016 2:29 am, edited 4 times in total.
User avatar
sherpal
Prole
Posts: 17
Joined: Wed Sep 14, 2016 9:29 am
Location: Belgium

Re: Image not Displaying Right

Post by sherpal »

If you don't provide the code snippet you have now, it will be difficult to help :)
User avatar
zorg
Party member
Posts: 3446
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Image not Displaying Right

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Image not Displaying Right

Post 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
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Image not Displaying Right

Post 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
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Image not Displaying Right

Post 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
User avatar
zorg
Party member
Posts: 3446
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Image not Displaying Right

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Image not Displaying Right

Post 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?
User avatar
pgimeno
Party member
Posts: 3582
Joined: Sun Oct 18, 2015 2:58 pm

Re: Image not Displaying Right

Post 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.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Image not Displaying Right

Post 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
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests