Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mecablaze

Pages: [1]
1
Graphics / Tint an Image
« on: March 13, 2011, 11:00:11 pm »
I am using SFML2 in Visual Studio 2010 (Windows). See this post for more background information.

I was looking through the sf::Image documentation and I didn't see anything about tinting an image. I previously used SDL, in which tinting is very easy. I have a white sprite with alpha that I would like to tint one of three colors then copy it onto another image.

What is the best way to do this in SFML2?

2
Graphics / RenderImage vs. Juggling a Handful of Sprites
« on: March 12, 2011, 03:10:09 am »
Okay, so I am working on a card game in SFML2 (I'm on Windows using Visual Studio 2010). I have a sprite sheet containing different graphics used to generate each card in the deck used for my game (symbols and card backs). I have an XML file defining where each individual sprite in the sprite sheet resides. All that is working fine.

I would like to generate all possible cards using the different symbols and card backs in my sprite sheet (i.e. I have an object Card which represents a single unique card). For the sake of example, think of having a sprite sheet with a club, heart, spade, and diamond on it with a white rectangle for a card back.

I would like to generate each possibility in a deck of cards. I can think of three ways to do this, I just don't know which one is the easiest and (more importantly) most efficient:
[list=1]
  • Have the Card object maintain multiple sprites, one representing the card back, the rest representing each symbol on the card, etc. (this means adjusting multiple sprites' coordinates as the card itself moves around)
  • Render the card back then symbols to a RenderImage and store that unique image for each Card object. This solution seems to lose the efficiency gained by having a sprite sheet (having only one image in the video memory)
  • Somehow subclass sf::Drawable for the symbols to allow for relative coordinates to the parent (the card itself) to allow easier drawing
  • [/list:o]
    I have tried this project with SDL (I created a seperate surface for each card) and XNA (I basically calculated the symbols' position at each draw).

Edit: I just wanted to leave a note and say that I'm totally geeking about SFML right now. It's a great project and orders of magnitude more usable than SDL.

Pages: [1]