Skip to main content
GameDev.net gamedev.net
🔒 Locked

[SDL] Pixel Plotting

Started by Uphoreum Aug 6, 2006 at 11:12 AM 5 replies 950+ views
Original Post
Uphoreum
Uphoreum
Is there a function in SDL or SDL_gfx (or any other library) to plot a pixel? If not, how can I just plot a pixel at a certain coordinate? I want to use yellow colored pixels to make spark effects.
Carolina
Carolina
Well I don´t remember any specific function on SDL that draws one pixel at a time (like the one on GDI), but maybe the code on this site can enlighten you:

http://www.friedspace.com/cprogramming/sdlpixels.php

Carol.
Uphoreum
Uphoreum
Thanks! That looks like what I'm looking for.

This brings up another question. When using SDL, I see a lot of 'Uint32' and 'Uint16' etc. What is that? I mean, obviously it's some type of integer, but beyond that?
Nairb
Nairb
The 'U' means unsigned. The number (16, 32) tells you how many bits are allocated for that variable. So Uint32 is a 32 bit integer.
This is done because the size of int varies between systems, so making their own custom data types increases portability.
Rob Loach
Rob Loach
SDL_gfx has the following two functions:

int pixelColor(        SDL_Surface * dst,        Sint16 x, Sint16 y,        Uint32 color);int pixelRGBA(        SDL_Surface * dst,        Sint16 x, Sint16 y,        Uint8 r, Uint8 g,        Uint8 b, Uint8 a);

... Fairly self explanitory.
Rob Loach [Website] [Projects] [
Uphoreum
Uphoreum
Yes, that'll be easier, since I'm implimenting SDL_gfx anyways. Thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.