[SOLVED] Why is my font not dimming?

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
applebappu
Prole
Posts: 37
Joined: Thu Jun 24, 2021 5:49 pm

[SOLVED] Why is my font not dimming?

Post by applebappu »

This is probably a stupid question, FYI.

I'm working on a tiled roguelike, making the engine from scratch, and it's going well. However, I can't seem to do something very simple: draw the map memory (the part of the map that the player has explored but cannot currently see) in dimmer-than-full-bright characters.

I'm using a plain old courier.ttf for my font "tiles", and it looks about like this:
Screenshot from 2021-08-02 15-38-03.png
Screenshot from 2021-08-02 15-38-03.png (9.51 KiB) Viewed 2239 times
And if you move around a bit, I've set it up so that wherever you've been gets added to the "map memory", so that I can draw that in darker colors and retain a map of where you've been. Trouble is, even when I set the font color to something darker, it just looks like this:
Screenshot from 2021-08-02 15-41-02.png
Screenshot from 2021-08-02 15-41-02.png (19.3 KiB) Viewed 2239 times
And just so that there's no question, here's the code for drawing said map and map memory (taken from my Map class module)

Code: Select all

DrawMap = function(self)
	love.graphics.setColor(255,255,255,255)
	for i = 1, self.board_size.x do
		for j = 1, self.board_size.y do
			if mob_db.Player:LineOfSight(i, j) and mob_db.Player:DistToPoint(i, j) <= mob_db.Player.sight_dist then
				love.graphics.print(self.map_table[i][j], i * self.tile_size, j * self.tile_size)
				self.memory[i][j] = self.map_table[i][j]
			end
		end
	end
end,

DrawMapMemory = function(self)
	love.graphics.setColor(25,25,25,10)
	for i = 1, self.board_size.x do
		for j = 1, self.board_size.y do
			love.graphics.print(self.memory[i][j], i * self.tile_size, j * self.tile_size)
		end
	end
end
and yes, I'm calling DrawMap after DrawMapMemory in main.lua. So... how come everything is full-bright, even outside of the FOV?

Update: If I change the color inside DrawMapMemory to love.graphics.setColor(1,1,0,1), I can get something like this:
Screenshot from 2021-08-02 15-56-31.png
Screenshot from 2021-08-02 15-56-31.png (13.75 KiB) Viewed 2237 times
What would I set it to to get plain old gray? lol
Last edited by applebappu on Tue Aug 03, 2021 2:41 am, edited 1 time in total.
User avatar
darkfrei
Party member
Posts: 1173
Joined: Sat Feb 08, 2020 11:09 pm

Re: Why is my font not dimming?

Post by darkfrei »

Was: love.graphics.setColor(25,25,25,10)
Must be: love.graphics.setColor(25/255, 25/255, 25/255, 10/255)
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
applebappu
Prole
Posts: 37
Joined: Thu Jun 24, 2021 5:49 pm

Re: Why is my font not dimming?

Post by applebappu »

Oh my god, lmao. I knew it would be dumb. Thank you. Setting it to 100/255 for the RGB and 255/255 for the alpha yields:
Screenshot from 2021-08-02 18-42-05.png
Screenshot from 2021-08-02 18-42-05.png (13.29 KiB) Viewed 2222 times
Thank you!
Post Reply

Who is online

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