I moved to a new URL! Check it out!

posts dated from: june 2013

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!

Screenshot Saturday

Image


Just now getting back into coding stuff! I'm almost to the point where I can actually start building a game instead of just random testing scenarios, woohoo!

New Game Mockup!

New Game Mockup!
Now that I'm doing all this stuff with C# and SFML, some people have been wondering what exactly it is I'm doing with it! I have two games that I want to try and make with my new C# knowledge. They're both previous game jam games of mine, and here's what I want to do first:

Image


Image


You may recognize this from the game I made for Ludum Dare 17. It's actually available for download in my games section -- just scroll down to Gaiadi and download it to give it a whirl. Gaiadi is just a prototype, but now I want to turn the concept into a fully fleshed out game.

I've been trying to get this project going for a long time now, and I think attempting it in a high resolution will be pretty fun ... as long as nothing goes horribly wrong! This is by no means a guarantee that I will be releasing this game any time soon, but just what I'll be focusing on for the next big chunk of time.

As for my metroidvania project in flash from Global Game Jam... that's not 100% dead, but right now I am putting it on hold to focus on this.

Doodle Post

Image


Still recovering from a weekend trip to Six Flags, so just doodling as my brain prepares to start coding again.

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!