Topic: HELP NEEDED: Converting MousePos on Screen to position in map
Hello guys,
I'm currently working on a new client. I'd like to create a feature for POIs(Points of interest).
It's working! But I'd also like to set these points with the Crosshair of the client.
For example, I aim somewhere, then I have to press a key, and then there will be rendered an icon.
The problem: I'm not able to convert the mouse position on the screen to a position on a map.
What I've tried:
CNetObj_Character PrevChar = m_pClient->m_Snap.m_aCharacters[0].m_Prev;
CNetObj_Character CurChar = m_pClient->m_Snap.m_aCharacters[0].m_Cur;
vec2 Position = mix(vec2(PrevChar.m_X, PrevChar.m_Y), vec2(CurChar.m_X, CurChar.m_Y), Client()->IntraGameTick());
vec2 MouseOnMap = Position + vec2(m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy].x, m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy].y);
What happens: It outputs that Y is somewhere about 1 Million. X, too. Sometimes X is just Zero.
Can anybody help me, converting the values?
PS: I'm working on the base of DDnet, so don't wonder why there are some differents.
Thanks!