My take on snake homework

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
YoMomIsANiceLady
Posts: 33
Joined: February 2nd, 2017, 8:20 am

Re: My take on snake homework

Post by YoMomIsANiceLady » February 14th, 2017, 2:22 pm

It's one per character. For the game I have created a function drawPixel that kind of works like putPixel but the pixel is larger (to give the pixelated feeling of the old phones) and also has spacing between the large pixels. Then I looked up the old Nokia phone font (phont)
Image

I have created a struct called LetterMap where I store the letter's width, height (e.g. 'Q' is 5x8) and a string of 0's and 1's, each 1 representing a pixel and each 0 representing a no-pixel.

I then have a function that takes a string as an input, iterates through it, converts each character to the LetterMap ( I have stored the alphabet in a switch statement and each case represents a character and its map ) and finally draws the complete string to the screen. It also provides an option to invert the print so it switches colors (What you can see if a menu item is selected, it's highlighted in black)

Here's the full code of the function if you're interested

http://pastebin.com/WNatKfTZ

I could provide a proper explanation later. I'm just too tired for it right now

EDIT: Oh yeah and also, basically I have two drawing functions drawPixel and clearPixel. For the inverted version I simply fill a line with black pixels and then clear the pixels where the letters are (line 178)
"Life is like death, but completely different"
- Ivan Gašparovič

Post Reply