• Advertisement
Sign in to follow this  
  • entries
    455
  • comments
    639
  • views
    423841

Ah, bank hoildays...

Sign in to follow this  

182 views

I love 'em, even with out a job they dont feel like 'real days' so I dont feel bad when I've got a load of stuff I should be doing and I start on something else [grin]

So, on monday morning, about 2am having been up since midday I hit apon a brilliant idea! I'll make an 'old skool' Atari demo using OpenGL. So, we are talking low res (320x200x4 back in the day) and cheerfull chip music [grin]

So, first up, chip music reply code, check! I've had some of that for a while now and it turns out the guy has open sourced his whole program, which is nice (although its GPL, so unless I bother to contact 'im and get 'im to agree to let me use it non-GPL I wont be using it for other stuff).

Next on the list, a big colourfull scroll text in the middle of the screen... and this is where the distaction began [grin]

Firstly, I toyed with the idea of finding some fixed width and colourfull 32x32 text tiles, but decided against the idea (although I might revisit later), instead I decided to use it as a good excuse to learn how Freetype 2 works so I can work on dynamic texture generation for output.

So, for about 2h I read and fiddled with stuff and got a program to compile and run without crashing, however it was early and I couldnt be bothered to test the output.

Monday afternoon comes around and I crawl out of bed, flip on the computer and pick up the code where I left of.

The plan for the day was write some code which could take a string of any lenght (without new lines for now) and produce a series of glyphs for it and place them in a texture sized image and save it to disk (saving routine comes via Corona).

I got most of the basic code done however it got to the point of going out and it wasnt outputting an image (Corona is a tad fussy about its output formats), however I hadnt left the house 5mins when I realised what the problem was, however as I was running late I made a voice note on my phone and met up with my friends (see, some people would have run back home then but I've a healthyish balance between going out and staying in [wink])

Many hours later, I roll into the house, fight with my phone to send an MMS and flip up the code again. I fixed output problem pretty quickly and then noticed my characters were all being rendered ontop of each other [sad]

Turns out my functor for doing the copy of the bitmaps to the final image wasnt sane and I'd forgotten to apply the xoffset to them [grin] So, once I fixed that I had a lovely output... however, I had some slight base line issues as you can see here

While I was writing the first half of this it dawned on me that the way to deal with that was to work out the max drop for all the characters and then when copying each glyph into place take away it height from that value and low and behold it only went and worked; clicky

Its still got a couple of kerning issues I need to fix, the 'j' blends in with the 'u' in jump and the 'y' is too far over in 'lazy' but apart from that I'm pretty happy with it all and not a bad 8 hours work over all (2h last night, 4h this afternoon/evening and about 2h once I got home tonight).

I'll be putting this project on freeze for a bit as I want to make significant headway into the GLSL chapter and get the VTOL code written this week, although I'll probably revisit it later in the week when I need to shift my focus abit.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement