Putting a Pixel

This is a discussion on Putting a Pixel within the Game Programming forums, part of the General Programming Boards category; In basic, to put a pixel, we say PSET(X, Y), COLOR where X and Y are coordinates and COLOR is ...

  1. #1
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    Putting a Pixel

    In basic, to put a pixel, we say

    PSET(X, Y), COLOR

    where X and Y are coordinates and COLOR is the color.

    is there a similar function in C/C++ ?

    Basically, I want to draw the picture of a jet plane and use it.
    If this is not the way peole do it, what is other way ?

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    You need to use a graphics library to do this. Take a look at opengl or directx.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    273
    if you are using windows you probably want to draw into a DIB and BitBlt to the screen. PutPixel for every pixel is a painfully slow way of doing things.

    The windows call is SetPixel() if you insist on doing it though.

  4. #4
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    DOS or windows? They have tottally different ways of plotting pixels and displaying images

  5. #5
    Registered User red_baron's Avatar
    Join Date
    May 2002
    Posts
    274
    go with the allegro library its easy compared to the rest
    ¿Red Baron?

    "Imagination is more important than knowledge"
    -Albert Einstein (1879-1955)

    Check out my games!

    [code] /* dont forget code tags! */ [/code]

  6. #6
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    DOS/Windows

    Which is better ? DOS/ Windows games ?

    I mean... for a newbie... which is simpler ??
    if dos is simpler, how can I plot a pixel in dos?

    also, what is OpenGL ? can it be used with bc++ 5.5 ?

  7. #7
    Registered User
    Join Date
    Jul 2002
    Posts
    273
    well dos games are far from simple. There is a need to know about ever stinking driver on the market to get anything decent accomplished. But I do remeber Allegro from a long time ago and that could help.

    As for windows and opengl or directx I can't say they are simple but they are far more capable of accomplishing modern games. You should take note that DOS based games really aren't sold anymore.

  8. #8
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    SDL is a really easy windows library, it isn't the fastest library or anything, but it's incredibly easy to learn
    Away.

  9. #9
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    hmm

    thanks for the info...

    i dont wanna sell my games. i am just writing programs/games to satisfy myself that i can do something with which i can make others waste some time
    it makes my life a little more meaningful

    As for the game, I just want to draw a jetplane and make
    it move around the screen... just for the sake of learning.
    i know how to do this in QB (i used to love this thing... but i
    can't imagine how i used to write code in QB after i saw
    the beauty of structured programming in c/c++)

    just want to know how i can do that in c ..

  10. #10
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    well, in the tutorial that comes with SDL there is a putpixel funtion...really simple. I used to program in QB and Visual Basic, too, and yeah, after C, there is no going back (:
    Away.

  11. #11
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    thanks a lot

    thanks a lot.
    i'll check it out right away!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing pixel colour
    By redruby147 in forum C Programming
    Replies: 11
    Last Post: 06-09-2009, 05:28 AM
  2. How can I make this code more elegant?
    By ejohns85 in forum C++ Programming
    Replies: 3
    Last Post: 04-02-2009, 08:55 AM
  3. OpenGL: Pixel addition
    By Hunter2 in forum Game Programming
    Replies: 4
    Last Post: 12-15-2008, 01:36 PM
  4. Reading pixel color data from screen
    By JJFMJR in forum Windows Programming
    Replies: 8
    Last Post: 08-22-2008, 12:27 PM
  5. Getting Pixel Colour Screen
    By god_of_war in forum C++ Programming
    Replies: 3
    Last Post: 03-14-2006, 12:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21