Results 1 to 28 of 28

Thread: Drawing a dot on the screen

  1. #1

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Drawing a dot on the screen

    I was wondering if there was any code to draw a dot at the exact middle of my screen, of a set radius and color, that will remain there no matter whether my program is on top or not - i want it to be always present, any idea?

    any idea if it's possible?

  2. #2
    Addicted Member
    Join Date
    Jun 2002
    Location
    Far.. far away! (Netherlands)
    Posts
    169
    Well, you would just have to make a loop which draws the dot all the time, something like this i think:

    VB Code:
    1. lDc = GetDc(0)
    2. Xpos = (screenwidth / 2) * 15
    3. Ypos = (screen.height / 2) * 15
    4.  
    5. do
    6. SetPixel lDc,Xpos,Ypos
    7. doevents
    8. loop

    This might work, i didn't test it though

    Shell

  3. #3

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    thanks but i was looking for something a little less resource intensive

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    If you use a timer with an interval of, say, 200ms, it should look good enough and still not be too resource-intensive
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  5. #5
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Rather than doing each pixel at a time with the SetPixel you'll be better using BitBlt to paint it to the center. Mind you'll still need to keep blt'in quite often because when the window refreshes the screen it'll remove it.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  6. #6
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yeah you're right, it's a dot of a set RADIUS so SetPixel would be best only if the radius is 1...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  7. #7
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Do yourself a favour - if you're using it for an aim, be cheap and get one of those red dot stickers, use a ruler to get the middle of your screen and stick it right there. It's not worth trying to make it on the computer .
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    LOL, how come it has to be red tho i want a green one
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I don't think they come in green >_<
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  10. #10
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    There's something I like to call paint, it's very useful when you wanna change the color of almost any object
    Hey you could make a window with no border and with the size of only 1 pixel, paint it red... I mean, green, and then make it stay on top, what do you think?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  11. #11
    Addicted Member
    Join Date
    Jun 2002
    Location
    Far.. far away! (Netherlands)
    Posts
    169
    Heh Jotaf, I was just thinking about that. I tested it, and it works

  12. #12
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hehe yeah sometimes the easiest way is the best one...

    Hey, if it's for an aim or something, you can easily make a crosshair with 2 forms like that
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  13. #13
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    2 forms? Not up to "complex" form regioning Jotaf?
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  14. #14

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Well i tried these methods and they didn't seem to be ontop inside the game

    is there any way in which i could do the same in C, to put it on the screen in game?

  15. #15
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    what is your object anyway. a crosshair ???









    |
    --- ---
    |

    ppl saw this
    Die, ***** Die !

  16. #16

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    yes a crosshair

  17. #17
    Member anjulpa's Avatar
    Join Date
    Aug 2001
    Location
    india
    Posts
    43
    draw it dynamically, this way u'll only upset the fps and nothing else. trust me ,its much better

    ppl saw this
    Die, ***** Die !

  18. #18
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    If you make it stay on top, Windows will redraw it for you I think. There are lots of demos around so you shouldn't have any trouble finding one.

    (BTW, way off topic but hey am I that bad at english? Because my teacher just gave me a bad mark, she says she doesn't like the way I write...)
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  19. #19

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    the on top method doesn't work with the game

    is there any way i can do it in C / C++?

  20. #20
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    What the hell do you need a new crosshair for?? When you're supposed to have one in a game, you usually don't have to make it yourself...

    Btw, if the game is in directx I don't think there's a way to do it. And something like this if you can't do it in VB, you can't do it in C++ either, the windows API is the same for both. Unless you wanna use ASM and do something like accessing the video memory directly or something. But that's not C++ and you DON'T wanna do that just to draw a crosshair cuz you can't aim.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  21. #21
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Sorry if I sounded too harsh, it's just that I hate the idea of having something like Unreal Tournament 2003 without a crosshair (huh it could be possible ) and some noob playing on the internet and ruining other people's games with a crosshair he's not supposed to have. What's the point of that? Cheaters...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  22. #22

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    lol actually

    the game i play does have a crosshair permanently except it's not at the center of the screen

    I think the game does use DirectX too (OpenGL?)

    Any ideas?

  23. #23
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Weird. I had a similar problem in counter-strike, when the size of the game area was reduced the crosshair wouldn't align properly. What game is it?

    I'm all out of ideas, maybe there's a way to hack into the game's window and draw something there with your dx functions (kinda like when you find another window's dc and draw on top of it with bitblt or setpixel or whatever). Did you contact the game's tech support or something? Cuz if the crosshair is screwed up, that's not very good, is it?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  24. #24
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Great shooters don't use crosshair....










    So I keep using it...

  25. #25

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    I'm still looking for an answer though.

    And btw; it is Counterstrike

  26. #26
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    As Jotaf98 said..have you tryed too contact tech support or something? Or don't you own the copy????

  27. #27
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    You don't have to pay for CS (at least last time I checked), you shouldn't have any problem contacting the tech support. SO huh... why don't you have a crosshair in CS? You can change the color you know, if that's the problem... and there are so many cheats around the net that it shouldn't be too hard to find a solid crosshair patch
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  28. #28
    Addicted Member Celest's Avatar
    Join Date
    Jun 2001
    Posts
    134
    Well it *is* possible to draw onto a fullscreen game, infact a certain trainer for mafia draws a graphical menu in real time.

    I have also wondered how this could be accomplished, i did some enquiring a few months ago and i was suggested to "set up a DirectX outpost to draw on this window." - his exact words. Unfortunately i havent got any further, if you find out anything else please let me know

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width