• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Plerion

Windows Text Cursor Hotspot offset

5 posts in this topic

Hi all

 

While implementing selection using the mouse for my textbox i have realized, that the windows text cursor seems to have some offset from its center bar to the hotspot, its actually exactly 2px to the left. I can show you the problem with images:

 

Image 1: The cursor is at the position WM_MOUSEMOVE gives 0 and moving the mouse one pixel to the left makes it show the sizing cursor (so its out of the client area)

53368ca7b25c3_Cursor_Crop.png

 

As you can see the center bar of the cursor is clearly not at this point.

 

Image 2: The cursor is again at position 0, but this time its the default cursor

53368ce2e4dd8_Cursor2_Crop.png

 

This cursor correctly points to the beginning of the client area.

 

Is there a way to determine this offset? Is it the same for xp, vista, win7, win8? This seems to be a bit annoying in my opinion...

 

Greetings

Plerion

0

Share this post


Link to post
Share on other sites

Is there a way to determine this offset?

Yep. GetIconInfo.

 

The ICONINFO structure pointed to on return from that function provides the (relative) coordinates of the hotspot for a cursor.

 

FYI, this info easily found by googling for (of all things): "windows cursor hotspot" wink.png

 

Also just FYI: The onscreen cursor follows the mouse, whatever that cursor may be (IDC_ARROW, IDC_IBEAM, etc.). It can differ from the Windows caret position, which, for text input is commonly displayed as a blinking underscore or vertical line to let the user know where keyboard character input will be placed. You can see the difference by clicking in the Reply box on this page - a blinking vertical line caret appears in the edit box, but the cursor still follows the mouse.

Edited by Buckeye
2

Share this post


Link to post
Share on other sites

Hey Buckeye

 

I forgot to mention that: the hotspot is given with an x-value of 8, the center bar is in the monochrome bitmap at a pixel offset of 10, so its actually already wrong there. Considering that a particular user might have overriden the default text cursor in his system i cannot just look for the center bar in the bitmap as maybe someone has a different default text cursor.

 

Greetings

Plerion

0

Share this post


Link to post
Share on other sites

Hey Buckeye

 

I forgot to mention that: the hotspot is given with an x-value of 8, the center bar is in the monochrome bitmap at a pixel offset of 10, so its actually already wrong there. Considering that a particular user might have overriden the default text cursor in his system i cannot just look for the center bar in the bitmap as maybe someone has a different default text cursor.

 

Greetings

Plerion

 

I'm not at all sure what you mean by "its actually wrong there." If you mean it's not where you would like it to be, create your own cursor with a hotspot where you'd like it.

 

Can you describe what your concern is, what problem you're trying to solve?

0

Share this post


Link to post
Share on other sites

Hello Buckeye

 

For me as a normal user i would suspect that the hotspot of the cursor is exactly where the vertical bar of the text cursor is. Everything else does not make any sense to me as thats the location you are clicking. Yet however if you take the 8 pixel offset you get from the icon info for the x-hotspot and go to that position in the cursors bitmap you land 2 pixels left of the vertical bar. That means on windows 7 if you want to get the effective location the user intended to click youd have to add 2 pixel to the value you get in WM_MOUSEMOVE or similar messages. If you dont do so youll drive the user nuts as he would have to click 2 pixels more left than he wants to click.

 

The use case i had problem implementing was:
The user clicks into the textbox and the caret of the textbox should move to the closest letter at the click position. Due to this 2 pixel offset to the left visually you had to click into the next letter to get the caret to the one you actually wanted.

 

So, yes, i say its not where i want it and i stay by my opinion: Its just plain wrong how it is right now.

 

Greetings

Plerion

1

Share this post


Link to post
Share on other sites


That means on windows 7 if you want to get the effective location the user intended to click youd have to add 2 pixel to the value you get in WM_MOUSEMOVE or similar messages.

Perhaps that's what applications must do. I haven't tried to write my own edit control as it's too easy to let Windows controls do that work.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0