Fix graphics init error
This commit is contained in:
parent
4b7874c837
commit
71d0f65903
1 changed files with 8 additions and 5 deletions
|
|
@ -2,10 +2,12 @@ import strutils
|
||||||
import
|
import
|
||||||
libnx/wrapper/types,
|
libnx/wrapper/types,
|
||||||
libnx/wrapper/gfx,
|
libnx/wrapper/gfx,
|
||||||
|
libnx/results,
|
||||||
libnx/utils
|
libnx/utils
|
||||||
|
|
||||||
type
|
type
|
||||||
GraphicsError* = object of Exception
|
GraphicsError* = object of Exception
|
||||||
|
GraphicsInitError* = object of GraphicsError
|
||||||
InitResolutionError* = object of GraphicsError
|
InitResolutionError* = object of GraphicsError
|
||||||
CropBoundsError* = object of GraphicsError
|
CropBoundsError* = object of GraphicsError
|
||||||
|
|
||||||
|
|
@ -53,7 +55,12 @@ var enabled = false
|
||||||
##
|
##
|
||||||
proc initDefault*() =
|
proc initDefault*() =
|
||||||
if not enabled:
|
if not enabled:
|
||||||
gfxInitDefault()
|
let code = gfxInitDefault().newResult
|
||||||
|
if code.failed:
|
||||||
|
raiseEx(
|
||||||
|
GraphicsInitError,
|
||||||
|
"Error, graphics could not be initialized", code
|
||||||
|
)
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
||||||
## *
|
## *
|
||||||
|
|
@ -184,10 +191,6 @@ proc getFramebuffer*(): Framebuffer =
|
||||||
## / Sets the \ref GfxMode.
|
## / Sets the \ref GfxMode.
|
||||||
proc setMode*(mode: GfxMode) = gfxSetMode(gfx.GfxMode(mode))
|
proc setMode*(mode: GfxMode) = gfxSetMode(gfx.GfxMode(mode))
|
||||||
|
|
||||||
## / Controls whether a vertical-flip is done when determining the pixel-offset within
|
|
||||||
## the actual framebuffer. By default this is enabled.
|
|
||||||
proc setDrawFlip*(enabled: bool) = gfxSetDrawFlip(enabled)
|
|
||||||
|
|
||||||
## / Configures transform. See the NATIVE_WINDOW_TRANSFORM_* enums in buffer_producer.h.
|
## / Configures transform. See the NATIVE_WINDOW_TRANSFORM_* enums in buffer_producer.h.
|
||||||
## The default is NATIVE_WINDOW_TRANSFORM_FLIP_V.
|
## The default is NATIVE_WINDOW_TRANSFORM_FLIP_V.
|
||||||
proc configureTransform*(transform: BufferTransform) =
|
proc configureTransform*(transform: BufferTransform) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue