Primitive Drawing library

Primitive Drawing library

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Primitive Drawing library

Post by AF »

I'd like ti a lot if work was put towards creating a primitive drawing library with commands such as:

DrawCircle()
DrawLine()
DrawText()
Blit()

That didnt require any knowledge of OpenGL at all and could just be called there and then in any widget or gadget. Those 4 functions should encompass a lot of the basic 2d graphical operations that people would like to do but dont know how.

The nearest there seems to be is the multiplayer networked line drawing, which is innapropriate.

I'd be willing to help with these sorts of things myself but I dont know how, and nobody else seems to either...=(
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Drawcircle and the other drawing things need ot be done in a draw callin such as DrawWorldPreUnit

e.g.

Code: Select all

    local udid = Spring.GetUnitDefID(uid)
    local ud = udid and UnitDefs[udid] or nil
    if (ud and (ud.radarRadius > 400)) then
      gl.Color(0.5, 0.5, 1, 0.5)
      local x, y, z = Spring.GetUnitBasePosition(uid)
      if (x) then
        gl.DrawGroundCircle(x, y, z, ud.radarRadius, 128)
      end
    end
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

it's so easy a caveman could do it
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

So you're gonna do it? 8)
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

DM45 barely classes as a vertebrate lifeform, he's got a few billion years to go yet ;)

The trick is to bang the rocks together, guys!

we wub joo d45
User avatar
Pendrokar
Posts: 658
Joined: 30 May 2007, 10:45

Post by Pendrokar »

But once I saw how a player just placed a smiely face drawing on the map, and when I asked he said it was a lua script?(Is there a lua widget like this?)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Thats easy. Theres a drawline callout for lua that draws the map doodles.

But thats not useful for a lua widget UI. I cant draw a UI button with that coll out, or draw a custom health bar with it.

Right now I can:

draw circles
draw text

and thats it. I cant draw a line between point A and B without resorting to messing with player drawing.
Post Reply

Return to “Lua Scripts”