Getting and setting cursor position

This is a discussion on Getting and setting cursor position within the Linux Programming forums, part of the Platform Specific Boards category; Hi. Do you know how to get and set cursor position? I know this can be done using GetCursorPos and ...

  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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,777
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,663
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,663
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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 06:26 PM.

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676

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

Popular pages Recent additions subscribe to a feed

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