Thread: Getting and setting cursor position

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    4

    Getting and setting cursor position

    Hi. Do you know how to get and set cursor position?
    I know this can be done using GetCursorPos and SetCursorPos from Win32 Api but I want it to work on several OS so I cant use Win32 specific functions. Thanks.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Platform specific. You need to use native APIs to do that, so you need to use #if/#else.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Use the ncurses library if you want a degree of portability in your console applications, and want more than what printf/cout can manage.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    @Elysia : how to do this using linux API?

    @Salem : Im making a 3D FPS using OpenGL so ncurses may not be that usefull

  5. #5

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    I love it when people are really specific about what they're trying to achieve
    Even more so when they spam the same vagueness over several forums.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    why are you giving this link about mapping fonts?

    Well Im making a 3D spacesim first person shooter in OpenGL. I want to be able to rotate with the mouse passive motion but when the mouse goes out of the game window, thinks start going wrong. I found a program where this issue was handled and the guy was using GetCursorPos and SetCursorPos from Win32 API so I want to do the same without using Win32 API because my game must be working on linux.

    Sorry for explaining badly what I want to do, english is not my native language... and sorry for spamming too, no excuse.

    So I have to use linux's API but can you tell me where to look? witch functions to use? never used platform specific API before. Thanks.
    Last edited by Spartan552; 01-13-2008 at 07:26 PM.

  8. #8

  9. #9
    Registered User
    Join Date
    Jan 2008
    Posts
    4
    thanks

Popular pages Recent additions subscribe to a feed