Package com.avrix.ui
Class NanoContext
java.lang.Object
com.avrix.ui.NanoContext
The NanoContext class encapsulates a NanoVG context and provides utility methods for managing
and rendering with the context in an OpenGL environment.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beginFrame
(int windowWidth, int windowHeight) Begins a new frame for rendering using NanoVG.void
beginFrame
(int windowWidth, int windowHeight, float pxRatio) Begins a new frame for rendering using NanoVG with a specified pixel ratio.void
dispose()
Disposes this NanoVG context.void
endFrame()
Ends the current frame of rendering (nvgEndFrame(context)
)long
get()
boolean
-
Constructor Details
-
NanoContext
public NanoContext()Initializes a NanoVG context and returns this object.
-
-
Method Details
-
beginFrame
public void beginFrame(int windowWidth, int windowHeight) Begins a new frame for rendering using NanoVG. This method calculates the pixel ratio based on the given window dimensions.- Parameters:
windowWidth
- the width of the window in pixelswindowHeight
- the height of the window in pixels
-
beginFrame
public void beginFrame(int windowWidth, int windowHeight, float pxRatio) Begins a new frame for rendering using NanoVG with a specified pixel ratio. This method should be called at the start of each frame before any drawing operations.- Parameters:
windowWidth
- the width of the window in pixelswindowHeight
- the height of the window in pixelspxRatio
- the pixel ratio, which is typically the ratio of the framebuffer size to the window size
-
endFrame
public void endFrame()Ends the current frame of rendering (nvgEndFrame(context)
) -
isModernOpenGL
public boolean isModernOpenGL()- Returns:
- true if the machine this program is running on supports modern OpenGL (Version 3 and above)
-
get
public long get()- Returns:
- the NanoVG context long ID.
-
dispose
public void dispose()Disposes this NanoVG context.
-