increment.cx just another corner of the web

1Oct/090

D&D Monster Stats

I am working on a little plugin to help me display monster stat blocks from D&D 4th Edition. I really need some easy method of entering the information. The structure isn't that complicated, but its tedious.

Take a peek.

Filed under: General No Comments
18Sep/090

FPS Display Game Component for XNA

So I have been doing more tinkering with XNA and I thought I would share this little component I have created to display FPS and timing stats in the bottom left hand corner of the window.

All that is require to use this component is to add it to your game's components.

IncrementLibrary.FpsComponent fpsComponent;
fpsComponent = new IncrementLibrary.FpsComponent(this);
Components.Add(fpsComponent);

Here is the actual code for the component:

2Sep/090

Playing with XNA Now

After starting out over a year ago playing with pygame, I also tried SDL and a small library called libtcod that builds on SDL. I have finally settled on using XNA for my messing around with game programming.

Screenshot

The project has gone all over the place but I think I am getting to where I want to be. I am keeping the source at Google Code if you'd like to take a peek. Threshold RL is just the nickname for it right now. TestGame is where the current XNA solution is stored.

26Aug/090

Long Time No Post

Its been a long time since I put anything up here. The job and the kid have been keeping me very busy.

Figured I would update the blog to the latest version to keep me safe from any sort of hacking issues and get updated to a more current theme. The old one was my custom work and just didn't have support for the more recent releases of WordPress.

Filed under: General No Comments
5Dec/080

Using PIL to Center Text on an Image

I have to put some text on a bunch of images and I wanted the text centered on the image. Digging around I found some example of using python and PIL to draw text onto those images. I'd like to share what I ended up with.

from PIL import Image, ImageDraw, ImageFont
import ImageOps

textColor = "#555555"
fontName = "tahoma.ttf"
fontSize = 13

image = Image.open("test.gif")
imageSize = image.size
image = image.convert("RGBA")

draw = ImageDraw.Draw(image)
font = ImageFont.truetype(fontName, fontSize)

text = "Centered Text"
textSize = font.getsize(text)
centerLocation = tuple(map(lambda x , y: (x - y) / 2, imageSize, textSize))
draw.text(centerLocation, text, font = font, fill = textColor)

image = image.convert("RGB").convert("P", palette = Image.ADAPTIVE)
image.save('button.gif')

I am most happy with the way centerLocation is calculated. That came from a conversation with a friend. Thanks Chris!

Filed under: Programming No Comments
5May/080

Updated Pygame Skeleton

I have added to my pygame skeleton and thought that I would update the blog as well to reflect the additions.

This one imports quite a few more packages. It has a function for loading images and a class that replaces the mouse pointer with a custom image.

I have decided to place the code in a test project at Google Code so I can keep it in a convenient place.

The code is after the break.

23Apr/080

Very Basic Pygame Skeleton

I have decided to play around with pygame a little more and ended up with this very minimal skeleton to start with. I thought I might share it with others who may just be starting out as well.

import pygame
from pygame.locals import *

pygame.init()
screen = pygame.display.set_mode((640, 480))

running = 1

while running:
  for event in pygame.event.get():
    if event.type == QUIT:
      running = 0
    else:
      print event

  screen.fill((120, 120, 120))
  pygame.display.flip()

pygame.quit()

All you get from this is a window with a gray background that will end when you close the window.

Filed under: Programming No Comments
12Mar/080

MySQL Connector/ODBC 3.51 Unattended Install

Just recently I had to create an install that called the install for the MySQL ODBC drivers. Just so others might be able to find this easier the correct command line argument is /passive. The command line for Windows machines looks like this:

mysql-connector-odbc-3.51.23-win32.msi /passive

Filed under: General No Comments

Adsense

Pages

Categories

Friends

Calendar

March 2010
S M T W T F S
« Oct    
 123456
78910111213
14151617181920
21222324252627
28293031  

Archives

Meta