Renderer
Renderer
The renderer is responsible for drawing all components to the screen, handling frame buffers, and more. Please make sure to implement all the functions in this class, and you may want to familiarize yourself with how org.polyfrost.polyui.PolyUI works.
It is also responsible for loading and caching all images and fonts, but this is down to you as a rendering implementation to implement. for these functions, such as image and text, an initialized Font or PolyImage instance will be given. You can access the data using Resource.stream, and cache it for future use (ideally).
Functions
Begin a frame. this is called before all drawing calls.
Bind the given framebuffer.
Create a new framebuffer. It is down to you (as a rendering implementation) to cache this, and dispose of it as necessary.
draw the given framebuffer to the screen.
Set the alpha for all future draw calls, in the range (0-1), until reset.
draw a hollow rectangle to the screen, per the given parameters.
Draw an image to the screen, per the given parameters.
end a scissor.
begin a scissor rectangle, that will clip rendering to the given rectangle.
begin a scissor rectangle, that will clip rendering to the given rectangle. The rectangle is intersected with the previous scissor.
reset the global alpha to normal.
Return true if your rendering implementation supports usage of framebuffers.
calculate the bounds of this text, per the given parameters.
Unbind the currently bound framebuffer.