![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Software Programming Software programming talk, ask questions about computer software programming or help others |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi, I'm going to program a simple 2D platform independent game using SDL. My development environment is Win32 (XP) with MS VC++ .NET. All sprites uses 32bit depth and will be stored in a format which supports alpha channels. Instead of color keying I want to use real transparency, using the alpha channel of the sprite. Does anybody know how to use PNG/PSD files with SDL ? TIA, Frank -- ats uxThemePatcher XP .NET © 2003 by animalTactics http://kickme.to/ats | |||
| Advertisements |
| | #2 | ||
| Don't know about the SDL but the standard (pretty standard) format for sprites with alpha channels is BMP "Frank Hoffmann" <atomicStrike@gmx.de> wrote in message news:bhg4c1$c1ds$1@ID-77060.news.uni-berlin.de... Hi, I'm going to program a simple 2D platform independent game using SDL. My development environment is Win32 (XP) with MS VC++ .NET. All sprites uses 32bit depth and will be stored in a format which supports alpha channels. Instead of color keying I want to use real transparency, using the alpha channel of the sprite. Does anybody know how to use PNG/PSD files with SDL ? TIA, Frank -- ats uxThemePatcher XP .NET © 2003 by animalTactics http://kickme.to/ats | |||
| | #3 | ||
| You'll be very impressed with SDL .PNG alpha support, if you can get you're paint software to do what you want. First of all, I use PSP (7 or 8) and these instructions will apply to this package only (and to SDL). In PSP, choose File->Export->PNG Optimizer, then click the tranparency tab. Set it to "Alpha channel transparency". Click OK, then name the file. Now, if you're art has a proper transparent background (in PSP transparency looks like a checkerboard, I think in photoshop it looks like a crosshatch pattern?), all you need to do is load the png via the normal sdl_img functions. SDL is smart enough to set the color key for a new surface if the ..PNG you're loading from has the color key field (in it's header) set, and the above instructions guarantee that PSP saved the file with this info. Here's the best part! SDL will also, automatically use whatever alpha channel is available in the source image when blitting! This was a real pleasant surprise when I found it out on my last game... I was building some lazy clouds that floated above the player... I was fooling with transparency and I accidently export'ed the png with about 50% alpha transparency. This built in support for alpha blending let me implement the coolest effects in my game... Tony "Frank Hoffmann" <atomicStrike@gmx.de> wrote in message news:bhg4c1$c1ds$1@ID-77060.news.uni-berlin.de... Hi, I'm going to program a simple 2D platform independent game using SDL. My development environment is Win32 (XP) with MS VC++ .NET. All sprites uses 32bit depth and will be stored in a format which supports alpha channels. Instead of color keying I want to use real transparency, using the alpha channel of the sprite. Does anybody know how to use PNG/PSD files with SDL ? TIA, Frank -- ats uxThemePatcher XP .NET © 2003 by animalTactics http://kickme.to/ats | |||
| | #4 | ||
| Hi, thanks for all answers. I want to recommend this library for SDL: http://www.libsdl.org/projects/SDL_image/ As Tony mentioned, using .png with alpha channels allows you to implement fantastic effects in your game. Maybe I will use this for a particle generator, or lightning effects... Frank | |||
| Featured Websites | ||||
|
![]() |
| Tags: alpha, files, png, sdl, transparency, using |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New question for an old problem, Transparency | TooSano | Graphics in general | 2 | 06-11-2007 11:44 PM |
| transparency | Butch Cassidy | Graphics in general | 4 | 06-11-2007 11:05 PM |
| Question about erasing to transparency . . . | Stan Shankman | Graphics in general | 2 | 06-11-2007 10:29 PM |
| Transparency Gone When Placing into InDesign | Leonardo | Graphics in general | 3 | 06-11-2007 9:45 PM |
| Question about transparency between photoshop and illustrator... | oGhr | Graphics in general | 0 | 06-11-2007 9:43 PM |
| Featured Websites | ||||
|