Jump to content

Center Font


gamecreator
 Share

Recommended Posts

We have it for Windows, why not Fonts? smile.png
context->DrawText(text, x, y, Leadwerks::Font::CenterHorizontal | Leadwerks::Font::CenterVertical);

Or maybe it would work with Contexts somehow.Absolutely the lowest priority but just a nice ease-of-life feature.

er... i thought we had this already? does it not work?http://www.leadwerks.com/werkspace/blog/1/entry-1712-improved-2d-drawing-command-set/

 

Edit-- It appears to be working at least in the beta

window = Window:Create("example",0,0,600,400)

context = Context:Create(window)

world = World:Create()

light = DirectionalLight:Create()

light:SetRotation(45,45,0)

camera = Camera:Create()

camera:SetPosition(0,0,-3)

 

box = Model:Box()

box:SetColor(1,0.5,1,1)

 

while not window:KeyHit(Key.Escape) do

if window:Closed() then return false end

box:Turn(0.5*Time:GetSpeed(),0.5*Time:GetSpeed(),0)

 

Time:Update()

world:Update()

world:Render()

 

context:SetBlendMode(Blend.Alpha)

context:SetColor(1,0,0,.5)

context:DrawRect(2,2,300,100)

context:SetColor(1,0.5,0,.5)

context:DrawRect(302,2,300,100)

context:SetColor(1,1,1,1)

context:DrawText(camera:GetPosition():ToString(),2,2,300,100,Text.Center)

context:DrawText(camera:GetPosition():ToString(),302,2,300,100,Text.VCenter+Text.Center)

context:SetBlendMode(Blend.Solid)

context:Sync(true)

end

post-14-0-70590400-1480824944.jpg

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

er... i thought we had this already? does it not work?http://www.leadwerks.com/werkspace/blog/1/entry-1712-improved-2d-drawing-command-set/

...

It appears to be working at least in the beta

Ah, thank you. Just tried it in standard C and it's not there yet that I could see (nor is it in the documentation yet, probably for that reason). But great to be reminded that it'll be part of the GUI functionality!

Link to comment
Share on other sites

 

Ah, thank you. Just tried it in standard C and it's not there yet that I could see (nor is it in the documentation yet, probably for that reason). But great to be reminded that it'll be part of the GUI functionality!

That seems odd? For it to be available in lua typically means its in c++ version and ported to lua.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...