I moved to a new URL! Check it out!

posts filed under: general

Screenshot Saturday: Framework Tricks!

Image


So far at TIGJam I'm just working on my framework in order to get into the new version of Gaiadi soon. I added some new tools to my tilemap class, and also added a gradient and grid image class to quickly get those rolling in prototypes.

On to Day 3 to TIGJam!

It's Time for TIGJam 5!

Image


We're getting set up at Hacker Dojo in Mountain View for TIGJam 5! I think there are 80 people coming that are going to cram into this room.

Image


Wish us luck.

SFML Text Pixel Fix

SFML Text Pixel Fix
Yesterday I posted about an annoying little bug in the SFML Text class which displays a stray pixel on the upper left hand corner of the first character of the string.

Right now the theory is that this section of code is responsible. After some discussion with some smart people, a temporary work around was found.

When the font texture is created, apparently it will create the texture based on the string that you're using. If your string starts with "Q" then the first letter of the texture will be "Q", and since SFML also creates a 2x2 set of pixels on the upper left of the texture, those pixels will be visible at certain positions because of pixel interpolation.

The work around is to first create a dummy text class that starts with a character that you'll never use. In my code I'm using a random ascii character. I'll probably never ever use that ascii character in my text, so if the white pixel is inside the character then it doesn't matter since I will never use it!

After the dummy text character is created then you're safe to create your intended text object -- as long as you're using the same font and character size, that is! So make sure for each combination of font and character size you're creating a dummy text instance. You never have to draw the dummy text, just draw your actual intended text.

This is kind of a sketchy work around, but for now as far as I can tell it totally works.

I posted a thread on the SFML forum documenting this as well.

Dev Log: SFML Text Woes

Dev Log: SFML Text Woes
My most recent development is getting text working in my SFML based framework. Unfortunately I've run into some sort of problem with the text rendering though.

Image


Whenever I render text, there seems to be a tiny artifact that appears on the upper left corner for the first character of the string, but it only appears in certain positions. The artifact seems to be less than a pixel since moving it around the screen causes it to flicker on and off. In this example I'm rendering text 9 times, 8 times for the outline, and once for the center, and you can see the artifact also rendered 9 times in the top left corner of the Q character.

Image


This is happening independent of fonts, and characters. The only instance I have seen this not occur is when the text is never moving on the screen, or when the first character actually occupies the upper left corner of its bounding box (for example the Y character in Arial.)

Does anyone out there know what's going on here and how I can fix it? If it makes any difference, currently my framework renders everything to a render texture which is then drawn to the window... not sure if this has anything to do with it, but I've been running tests with just drawing SFML text straight to the window with similar results so far.

Programming!

Dev Log: Parallax and Repeating

Dev Log: Parallax and Repeating
Just churning away at my SFML framework that I'm building with C#. The past two days I've added parallax scrolling (similar to Flashpunk's scrollX and scrollY variables) to images, as well as the ability for images to repeat. The cool thing about the repeating is that it's being done at the base image class, so even animated sprites can be repeated across the screen!

Image


Also if you're working with SFML C# yourself, you should check out this TextureAtlas class written by Mark J. A. Smith. I have yet to implement something like this in my framework yet because I haven't really noticed performance issues, but using texture atlases can greatly reduce the amount of texture switching between drawing things, which helps a lot with performance.

Back to work!

Screenshot Saturday: Shaders!

Image


BEHOLD I have finally implemented a shader! (It's actually just the example blur shader that comes with SFML.)

Ever since I started working on Snapshot I've always wanted to take advantage of pixel shaders for 2d games, and now with C# and SFML I've been able to finally do it. I'm pretty excited for where this can take me, but now I have to actually learn how to write GLSL shaders which looks pretty tough...