Access to DrawCircle, DrawLine, etc.

Everything about mods can be found here.

Moderator: Morax

Access to DrawCircle, DrawLine, etc.

Postby crispweed » 01 Jun 2017, 19:00

Does anyone know why DrawCircle(), DrawLine() etc. are sim mode only?
(Search for these here: https://www.dropbox.com/s/7jpdpptw3ygonwb/fa.lua.globals.xlsx?dl=0)

These seem like exactly the kind of thing I would expect to be able to use in a UI mod.

It turns out that it is possible to draw circles, by using decal textures, as shown by the "Additional Camera Stuff v3.2" mod, but it seems crazy to have to use these kinds of work-arounds.

Should we be looking at adding access to some of these functions, for UI mods, instead, e.g. by adding a sim callback (if this is something that would be possible)?
crispweed
Crusader
 
Posts: 33
Joined: 02 Jan 2017, 17:32
Has liked: 2 times
Been liked: 3 times
FAF User Name: crispweed

Re: Access to DrawCircle, DrawLine, etc.

Postby speed2 » 01 Jun 2017, 20:49

My bet would be that it's drawing them for all players as it's in sim. While UI things you expect to show only to one player.
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Access to DrawCircle, DrawLine, etc.

Postby nine2 » 02 Jun 2017, 03:03

let me know if you ever figure this out, i've wanted that since forever
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Access to DrawCircle, DrawLine, etc.

Postby nine2 » 02 Jun 2017, 03:04

the best I can think of is terrible: you could make your own drawLine etc by making an opaque Bitmap for each pixel
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Access to DrawCircle, DrawLine, etc.

Postby Franck83 » 03 Jun 2017, 22:58

In my current mod, I'm using a sim callback to draw a target for one of my unit ultimate strike. The target is driven by an emitter and as speed said, it is seen by everyplayer. The good thing is that you can do very cool effects and some fun because everybody sees the target when you move your mouse :)

A pure UI solution may be using vector GetMouseScreenPos() with a Ui object (bitmap for example), sync the Ui object coord with mouse ones and convert it to map coordonate...
Last edited by Franck83 on 03 Jun 2017, 23:05, edited 1 time in total.
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Access to DrawCircle, DrawLine, etc.

Postby Franck83 » 03 Jun 2017, 23:04

Anihilnine wrote:the best I can think of is terrible: you could make your own drawLine etc by making an opaque Bitmap for each pixel


Maybe using a circle bitmap and stretching it.
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Access to DrawCircle, DrawLine, etc.

Postby RocketRooster » 03 Jun 2017, 23:13

If it's sim only, how then do things like radar and range circles work per player? What am I missing here?
RocketRooster
Avatar-of-War
 
Posts: 294
Joined: 08 Apr 2016, 11:29
Has liked: 29 times
Been liked: 52 times
FAF User Name: RocketRooster

Re: Access to DrawCircle, DrawLine, etc.

Postby Franck83 » 04 Jun 2017, 00:12

Good question. Maybe hard coded ?
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Access to DrawCircle, DrawLine, etc.

Postby nine2 » 04 Jun 2017, 00:46

Things like radar ranges etc are not drawn by lua code. It's done in c++ code. There is no way for lua to invoke that circle drawing code.

Lots of things are like that when you are modding supcom. You want to do something that the engine can do ... but it's just not exposed to you.
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest