{"action":"created","issue":{"url":"https://api.github.com/repos/Dgame/Dgame/issues/54","labels_url":"https://api.github.com/repos/Dgame/Dgame/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/Dgame/Dgame/issues/54/comments","events_url":"https://api.github.com/repos/Dgame/Dgame/issues/54/events","html_url":"https://github.com/Dgame/Dgame/issues/54","id":101149673,"number":54,"title":"Determine text size before drawing","user":{"login":"opatut","id":235784,"avatar_url":"https://avatars.githubusercontent.com/u/235784?v=3","gravatar_id":"","url":"https://api.github.com/users/opatut","html_url":"https://github.com/opatut","followers_url":"https://api.github.com/users/opatut/followers","following_url":"https://api.github.com/users/opatut/following{/other_user}","gists_url":"https://api.github.com/users/opatut/gists{/gist_id}","starred_url":"https://api.github.com/users/opatut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opatut/subscriptions","organizations_url":"https://api.github.com/users/opatut/orgs","repos_url":"https://api.github.com/users/opatut/repos","events_url":"https://api.github.com/users/opatut/events{/privacy}","received_events_url":"https://api.github.com/users/opatut/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-15T07:26:43Z","updated_at":"2015-08-15T07:33:50Z","closed_at":null,"body":"In order to draw a dynamic text centered I would like to shift it by half its width to the left before drawing it.\r\n\r\nHowever, currently the width of a text is only calculated upon drawing, hence, I will always receive the previous frame's text width as the \"current\" width of the text, even though I might have changed the contents and thus the text width.\r\n\r\nA possible fix renders the text to a texture before returning the texture width, iff `_redraw` is true when the width is fetched. This should usually not lead to multiple render operations since the common order of updating text is\r\n\r\n* `.setData`\r\n* `.width` (render to texture!)\r\n* `.setPosition`\r\n* `.draw` (no re-render since `_redraw == false`)\r\n\r\nSame goes for height, of course."},"comment":{"url":"https://api.github.com/repos/Dgame/Dgame/issues/comments/131313032","html_url":"https://github.com/Dgame/Dgame/issues/54#issuecomment-131313032","issue_url":"https://api.github.com/repos/Dgame/Dgame/issues/54","id":131313032,"user":{"login":"Dgame","id":2406877,"avatar_url":"https://avatars.githubusercontent.com/u/2406877?v=3","gravatar_id":"","url":"https://api.github.com/users/Dgame","html_url":"https://github.com/Dgame","followers_url":"https://api.github.com/users/Dgame/followers","following_url":"https://api.github.com/users/Dgame/following{/other_user}","gists_url":"https://api.github.com/users/Dgame/gists{/gist_id}","starred_url":"https://api.github.com/users/Dgame/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dgame/subscriptions","organizations_url":"https://api.github.com/users/Dgame/orgs","repos_url":"https://api.github.com/users/Dgame/repos","events_url":"https://api.github.com/users/Dgame/events{/privacy}","received_events_url":"https://api.github.com/users/Dgame/received_events","type":"User","site_admin":false},"created_at":"2015-08-15T07:33:50Z","updated_at":"2015-08-15T07:33:50Z","body":"That would destroy the const'ness of width and height. But I could offer the possibility to call a redraw/update method manually."}}