I’m wondering why a putpixel function is suddenly so desirable to you
guys… 
It has its uses.
(Disclaimer: I don’t write games. I use SDL for application software involving
math and/or software development tools. I’ve also done some wrapper
applications for graphic and video software on Linux.)
Anyhow, just use SDL_MapRGBA() to get a Uint32 instead of the int that
Jeff’s code uses.
Actually, it is a Uint32. I set up the colors I need for my app during
initialization.
Uint32 red;
red = SDL_MapRGB(vfmt, (Uint8) 0xa6, (Uint8) 0x00, (Uint8) 0x00);
and likewise for other colors. The colors are stored in an indexed array for
speed.
I probably should change the declaration of setPixel’s color
void setPixel(int x, int y, int color)
to be Uint32 instead of int just to be pedantic, but on both my 32 bit and 64
bit machines, an int is 32 bits so it’s no big deal. (64 bits is a ‘long’ to
the compiler.)
And as for the licensing issues…
C’mon guys, this is trivial code! It’s not a big deal. Do what you want with
it except don’t try to claim you have exclusive rights to it and can prevent
others from using it in their projects, which is what I mean by ‘proprietary’.
Okay, maybe I’m a bit overly sensitive on that issue right now. I’m having to
deal with an a-hole lawyer in a civil case who bitches about nickels and dimes
when hundreds of thousands of dollars are at stake. He’s convinced me that
‘Stupidity 101’ was a required course at his law school. Let’s behave like
grown-up software developers and not a-hole lawyers, okay?
(And just in case anyone might be feeling a little sympathy for my plight,
don’t bother. My lawyer intends to ask the court to issue sanctions against
the a-hole because in addition to his stupidity, he’s lied on forms he signed
under penalty of perjury and we can prove it.)
JeffOn Sunday 01 March 2015 13:00:21 Jonathan Dearborn wrote: