Click to See Complete Forum and Search --> : Drawing a dot on the screen
da_silvy
Jan 18th, 2003, 09:33 PM
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?
Shell
Jan 19th, 2003, 01:48 AM
Well, you would just have to make a loop which draws the dot all the time, something like this i think:
lDc = GetDc(0)
Xpos = (screenwidth / 2) * 15
Ypos = (screen.height / 2) * 15
do
SetPixel lDc,Xpos,Ypos
doevents
loop
This might work, i didn't test it though :)
Shell
da_silvy
Jan 19th, 2003, 03:53 AM
thanks but i was looking for something a little less resource intensive
Jotaf98
Jan 19th, 2003, 07:34 AM
If you use a timer with an interval of, say, 200ms, it should look good enough and still not be too resource-intensive :)
Electroman
Jan 19th, 2003, 12:18 PM
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.
Jotaf98
Jan 19th, 2003, 12:21 PM
Yeah you're right, it's a dot of a set RADIUS so SetPixel would be best only if the radius is 1...
Sastraxi
Jan 19th, 2003, 12:22 PM
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 ;).
Electroman
Jan 19th, 2003, 12:27 PM
LOL, how come it has to be red tho i want a green one :D
Sastraxi
Jan 19th, 2003, 12:33 PM
I don't think they come in green >_< :D
Jotaf98
Jan 19th, 2003, 12:36 PM
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? :)
Shell
Jan 19th, 2003, 02:44 PM
Heh Jotaf, I was just thinking about that. I tested it, and it works :)
Jotaf98
Jan 19th, 2003, 05:47 PM
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 ;)
Sastraxi
Jan 19th, 2003, 05:59 PM
2 forms? Not up to "complex" form regioning Jotaf? ;) :D
da_silvy
Jan 19th, 2003, 10:14 PM
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?
anjulpa
Jan 20th, 2003, 01:44 AM
what is your object anyway. a crosshair ???
|
--- ---
|
da_silvy
Jan 20th, 2003, 02:00 AM
yes a crosshair
anjulpa
Jan 20th, 2003, 06:46 AM
draw it dynamically, this way u'll only upset the fps and nothing else. trust me ,its much better
Jotaf98
Jan 20th, 2003, 08:45 AM
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 :p 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...)
da_silvy
Jan 20th, 2003, 08:49 AM
the on top method doesn't work with the game
is there any way i can do it in C / C++?
Jotaf98
Jan 20th, 2003, 09:06 AM
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++ :p and you DON'T wanna do that just to draw a crosshair cuz you can't aim.
Jotaf98
Jan 20th, 2003, 09:10 AM
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 :D ) 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... :rolleyes:
da_silvy
Jan 20th, 2003, 09:24 AM
lol actually
the game i play does have a crosshair permanently except it's not at the center of the screen :p
I think the game does use DirectX too (OpenGL?)
Any ideas?
Jotaf98
Jan 20th, 2003, 09:32 AM
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? ;)
NoteMe
Jan 20th, 2003, 10:04 AM
Great shooters don't use crosshair....:D
So I keep using it... :(
da_silvy
Jan 20th, 2003, 10:16 AM
I'm still looking for an answer though.
And btw; it is Counterstrike :D
NoteMe
Jan 20th, 2003, 10:24 AM
As Jotaf98 said..have you tryed too contact tech support or something? Or don't you own the copy????
Jotaf98
Jan 20th, 2003, 01:48 PM
You don't have to pay for CS :cool: (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 ;)
Celest
Jan 20th, 2003, 03:55 PM
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 ;)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.