General Guidance for RogueLike Display

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
osoII
Prole
Posts: 9
Joined: Tue Jul 16, 2013 4:46 am

General Guidance for RogueLike Display

Post by osoII » Tue Aug 27, 2013 6:39 am

I'm kind of in limbo trying to figure out how to implement the graphical (or lack thereof) side of a roguelike. I want to be able to use tilesets by swapping out my png, so no plain text. My general requirements are being able to change the color shown on the background and the overlaying symbol on each tile on the fly. Do I have an easy way of doing that already in love? I know I can just set the color and draw a box for the tile background, but I want to be able to have tiles with texture (greyscale) that I can change the color of on the fly. Can someone give me a nudge in the right direction?

User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: General Guidance for RogueLike Display

Post by micha » Tue Aug 27, 2013 6:42 am

If you use love.graphics.setColor then also drawing of images is affected. So, yes, you can draw all you images in grayscale and then tint them with LÖVE.

osoII
Prole
Posts: 9
Joined: Tue Jul 16, 2013 4:46 am

Re: General Guidance for RogueLike Display

Post by osoII » Tue Aug 27, 2013 6:56 am

Really? I wouldn't have even thought to try that... Well that actually answers my question 100% I'm still kind of mind blown that setColor affects drawing of images though... I'm assuming black draws the image normal, white whites it out, grey fades it, etc. I'll go experiment. Thanks.

User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: General Guidance for RogueLike Display

Post by Plu » Tue Aug 27, 2013 7:07 am

Full white is the normal image. Whiteout is achieved in other ways (of which I know too little to tell you). Black renders the image entirely black. Grey is indeed fading, and color overlaps the selected color with the image's regular colors.

User avatar
Hexenhammer
Party member
Posts: 175
Joined: Sun Feb 17, 2013 8:19 am

Re: General Guidance for RogueLike Display

Post by Hexenhammer » Tue Aug 27, 2013 12:59 pm

I have always used one big texture which contains the characters in all colors. You can easily calculate which part of the texture to blit with the variables being the character code and the color id. Looks like this in my current code:

Code: Select all

  self:DrawTile(
    self.drawColor * self.tileset.dimensions.width + character + 1
  )
This works for a texture like this:
Rom8.png
Rom8.png (24.16 KiB) Viewed 810 times
This is the CGA 8x8 ROM font and color palette for that authentic 1980s feel but you can use any type of monospace font and palette.
As far as I know this is the fastest way to do it.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests