🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Draw a pixel in C++

Started by
3 comments, last by 3d Wolf 23 years, 8 months ago
Hey, I want to know how to draw a pixel in c++, can somebody tell my how i can draw a pixel in c++ (for linux)
Advertisement
Uhh, i hate to do this, but since this thread already exists on this board (please read the messages before posting), i don''t feel so bad doing it.

Check www.libsdl.org and look at the tutorials. Granted, SDL is in C, not C++, but as you don''t really need object orientation for drawing a pixel, i don''t think this should be that much of a problem for you.

Unless, of course, you don''t know C++ or C, in which case you''ll want to start with something a bit simpler... There''s a free book on learning C++ at http://www.bruceeckel.com/ThinkingInCPP2e.html. Once you get through that, then you should be ready to start thinking about games.

-benc
C++ is a programming language alone, it''s purpose is
provide the `meat'' between IO layer languages that work
with C or C++.

You have three options at this point, you can interact
with the Linux kernel''s video IO and attempt to draw
a pixel (most difficult approach and not recommended).

Use either SVGALIB (library) for fulll screen drawing
or XLib for GUI drawing (you''ll be drawing to a Window
on a GUI enviroment).

A more experimental approach is to use a proprietery
library such as (previously recommended) SDL. This is
perhaps the best approach but most limited and
difficult to set up.

XLib would be my recommendation as it gives you
direct access to the GUI (X windows) at the lowest
possable level and not require players to install any
additional libs (SDL is hard to set up and get
working at the moment). SDL games I''ve seen were not
very impressive, but it''s a good start for beginners.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.
EXCUSE ME?!?!?!?!

SDL is shitloads better than Xlib for simple graphics, especially if you''ve ever done any DirectX coding...

Xlib adds way too much complexity, while SDL acts as a wrapper for several technologies, including GGI and DGA.

After careful deliberation, I have come to the conclusion that Nazrix is not cool. I am sorry for any inconvienience my previous mistake may have caused. We now return you to the original programming

I didn''t imply that XLib should be choosen over SDL
for everyone. I''ve worked with X, Windows, and many
portability libs/SDL for a couple of years now.

I may not have the best experiance but I do have a
development team with more than 20+ years of experiance.
We agreed that Xlib provides a better lower level access
for graphics for game development at a major cost of
coding work.

SDL does have some limitations, a lack of X style event
handling, multiple toplevel windows (though newer
versions may support it now) and network transparent
game input and sound device support.

SDL''s advantages in coding simplicity and is a good
start for newbies. There are pros and cons for both
choices based on my experiance and those I''ve worked
game projects with.
Tara Milana - WP Entertainmenthttp://wolfpack.twu.net/Comp graphics artist and programmer.

This topic is closed to new replies.

Advertisement