--[[ // // Okzoniom::RPG // Copyright (C) 2010 - 2013 // // - Louis SCHNELLBACH // --]] -- Create a Text2D which will be used to display FPS --[[ _FPS is special: if it's loaded, then it'll be used in the Scene to display the current FPS --]] function setup() size = Graphics:get():getWindowSize(); widget = Widget:new("fps_widget"); label = Text2D:new("fps_label", widget, "FPS: ", 22); label:setOffset(Vertex(5,2)); -- Place the FPS text next the label fps = Text2D:new("_FPS", widget, "00 ", 22); fps:setOffset(Vertex(label:getSize().x+5, 2)); -- Set the size of the widget so that it matches all children :p widget:setSize(Vertex(fps:getSize().x+fps:getOffset().x+10, fps:getSize().y+8)); -- And then, stick it in the right corner pos = Vertex:new(); pos.x = size.x - widget:getSize().x; widget:setPosition(pos); widget:focusable(false); --]] -- Faint: use this to refresh widget position, including children widget:setPosition(widget:getPosition()); end