Page 1 of 1

Primitive Drawing library

Posted: 28 Jul 2007, 17:01
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...=(

Posted: 28 Jul 2007, 17:40
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

Posted: 28 Jul 2007, 22:49
by Dragon45
it's so easy a caveman could do it

Posted: 28 Jul 2007, 23:07
by rattle
So you're gonna do it? 8)

Posted: 29 Jul 2007, 10:05
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

Posted: 29 Jul 2007, 12:03
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?)

Posted: 29 Jul 2007, 20:38
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.