Jump to content
Sign in to follow this  
madrussian

On-Screen Icons (for custom displays, etc)

Recommended Posts

Hi all, I'm attempting to draw a simple icon on the screen and have it follow an object around. So far I've got a colored indicator dot glued to a helicopter and it follows the helo around, which is great! But the dot kind of jumps around when the helo gets going too fast or when you move the mouse around much (though the dot always catches up to helo screen position).

Long term goal here is a revamped vehicle cam, so the indicators must be spot on with no deviation to what is shown on-screen. To see what I'm after with these icons, check how the default weapon cursors, grenade throwing icons, and "group icons" behave in-game. They are 100% precise with what you see on screen at any given time. In other words, I need my custom icon(s) to be drawn once per screen-frame.

Specifically, I have noticed that ctrlAddEventHandler has an event for maps called "onDraw" that fires when the map is drawn (i.e. every time the map is drawn). Tried it with maps and it works perfectly/precisely at exactly one draw per map frame!

So Here's the question:

Anyone know of anything similar for non-map controls? Any event or similar for non-map controls to callback to a draw function once per screen-frame?

Again, I see BIS doing this (once per screen-frame) with default weapon cursors and similar icons, so there must be a way!

Share this post


Link to post
Share on other sites

Turns out I'm already using worldToScreen to get the dot in the right place. I just need some kind of display/control callback functionality to update exactly when each new screen-frame happens (like they have with the "onDraw" for maps). Or perhaps I can use another method all-together.

Bit on my revamped vehicle cam:

I've been working on it a long time. Basically, 3rd person cam is tied to the vehicle, not the horizon. Much better for just flying around, etc. Because it's a custom cam, you lose the standard vehicle display (inc cursor, etc). So I'm trying to get at least the weapon cursors back. It's very tricky, b/c you have to base everything on current weapon direction, extrapolate (way) outward, then use worldToScreen to place cursor at appropriate location on the screen. Figured that 1st I would just try and get a dot to glue to an AI vehicle in game. Got that part working (again via worldToScreen), but the dot jumps around when the vehic is moving too fast or if you simply move the mouse much at all (as the dot catches up to where it's suppose to be). I really need some way to sync with each frame, as BIS appears to be doing. :)

Edited by MadRussian

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×