Computer Science Canada Cursor location for crosshair |
Author: | elDoRado [ Sun Nov 13, 2011 7:37 pm ] |
Post subject: | Cursor location for crosshair |
I'm trying to develop a simple fps, where the crosshair is your cursor, but i dont know how to get cursor location to set the crosshair on.. |
Author: | ProgrammingFun [ Sun Nov 13, 2011 7:55 pm ] |
Post subject: | RE:Cursor location for crosshair |
You should bind the cursor to the corner or middle of the screen and then detect the amount of movements in any given direction. |
Author: | Beastinonyou [ Sun Nov 13, 2011 8:13 pm ] |
Post subject: | Re: RE:Cursor location for crosshair |
ProgrammingFun @ Sun Nov 13, 2011 7:55 pm wrote: You should bind the cursor to the corner or middle of the screen and then detect the amount of movements in any given direction.
Lol? take a look at: Mouse.Where |
Author: | ProgrammingFun [ Sun Nov 13, 2011 8:31 pm ] |
Post subject: | Re: RE:Cursor location for crosshair |
Beastinonyou @ Sun Nov 13, 2011 8:13 pm wrote:
I know mouse.where exists, I have used it before...but all FPS games have the mouse rooted to a certain area on the screen (including turing games on this site) because this is a more accurate (IMO) way to do it for a game that relies heavily on mouse precision. |
Author: | Tony [ Sun Nov 13, 2011 8:38 pm ] |
Post subject: | RE:Cursor location for crosshair |
For that to work, you'd need to get the OS to not move the mouse cursor, and have it send mouse displacement events, rather than current location. As far as I remember, Turing is unable to do either. The behaviour can sort of be emulated as long as the mouse doesn't leave the active window. Meaning no 360 degree turns (one could up the sensitivity, but that would only linearly increase the max turn amount) |
Author: | ProgrammingFun [ Sun Nov 13, 2011 8:52 pm ] |
Post subject: | RE:Cursor location for crosshair |
I'm certain that I have seen it on a Turing app here somewhere... |
Author: | Tony [ Sun Nov 13, 2011 8:55 pm ] |
Post subject: | RE:Cursor location for crosshair |
[citation needed] |
Author: | Aange10 [ Sun Nov 13, 2011 9:12 pm ] |
Post subject: | Re: RE:Cursor location for crosshair |
Tony @ 13/11/2011, 7:55 pm wrote: [citation needed]
*Facebook Like* |
Author: | Zren [ Mon Nov 14, 2011 12:10 am ] |
Post subject: | RE:Cursor location for crosshair |
Someone did do a 3D FPS game with 3D text, but he did not capture the mouse. He did do a pretty good job within his limits however. I was more annoyed at the fact he did procs for each letter than trying to load a polygon file. |
Author: | elDoRado [ Mon Nov 14, 2011 7:07 am ] |
Post subject: | RE:Cursor location for crosshair |
I appreciate it, Like, what I had inmind was cursor location, than 4 bars, 3x16 black, and 2 verticals and 2 horizontals, and i would determine placing by mouse location for ie: x, y <mouse locations crosshair A- the top 1 xvalue = x yvalue = y + 5 to move it 5 above.. see where i'm coming from? :/ I'm only a grade 11 student.. |
Author: | evildaddy911 [ Mon Nov 14, 2011 8:04 am ] | ||
Post subject: | Re: Cursor location for crosshair | ||
if you want to make the crosshairs start at the center of the screen, then make a variable that stores the mouse's location when the game starts, then use mousewhere to detect where the mouse is in relation to the initial values:
|
Author: | Aange10 [ Mon Nov 14, 2011 12:39 pm ] |
Post subject: | Re: RE:Cursor location for crosshair |
Zren @ 13/11/2011, 11:10 pm wrote: I was more annoyed at the fact he did procs for each letter than trying to load a polygon file. What is that? |
Author: | Zren [ Mon Nov 14, 2011 12:48 pm ] | ||
Post subject: | Re: RE:Cursor location for crosshair | ||
Aange10 @ Mon Nov 14, 2011 12:39 pm wrote: Zren @ 13/11/2011, 11:10 pm wrote: I was more annoyed at the fact he did procs for each letter than trying to load a polygon file. What is that?
Like that... but for every character. http://compsci.ca/v3/viewtopic.php?t=29073 |
Author: | Aange10 [ Mon Nov 14, 2011 2:11 pm ] |
Post subject: | RE:Cursor location for crosshair |
I know what a procedure is, what's a polygon file? |
Author: | evildaddy911 [ Mon Nov 14, 2011 2:30 pm ] | ||
Post subject: | Re: Cursor location for crosshair | ||
i think a better idea than the initialx,nowx would be
|
Author: | Zren [ Mon Nov 14, 2011 3:55 pm ] | ||||
Post subject: | RE:Cursor location for crosshair | ||||
world -> models model -> mesh mesh -> polygons polygon -> vertices model -> loadMesh("model.txt") A vertice in world space would be: x = model.pos.x + vertice.x * model.width So all values of vertices would be in the range -1.0 .. +1.0 so we can scale them nicely. Also, if you know the entire mesh is made of triangles, you could skip those lines. Generally these types of files are in binary and not text, but unless your write an editor for your filetype, it's generally easier to just use text as the filesize + ease of use trumpts the load speed. Also, if your also bound to a single polygon type, you can skip the first line (numPolygons) as it's a constant amount of vertices to read, so you can just parse to EOF. If you want to know standard mesh filetype, look them up at http://en.wikipedia.org/wiki/Polygon_mesh |