Updated gfx code for latest libnx.
This commit is contained in:
parent
3508cdc45b
commit
77baa0c32f
@ -59,11 +59,12 @@ static inline color_t MakeColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
|||||||
|
|
||||||
#ifdef SWITCH
|
#ifdef SWITCH
|
||||||
extern uint8_t* g_framebuf;
|
extern uint8_t* g_framebuf;
|
||||||
|
extern u32 g_framebuf_width;
|
||||||
static inline void DrawPixel(uint32_t x, uint32_t y, color_t clr)
|
static inline void DrawPixel(uint32_t x, uint32_t y, color_t clr)
|
||||||
{
|
{
|
||||||
if (x >= 1280 || y >= 720)
|
if (x >= 1280 || y >= 720)
|
||||||
return;
|
return;
|
||||||
u32 off = 4*gfxGetFramebufferDisplayOffset(x, y);
|
u32 off = (y * g_framebuf_width + x)*4;
|
||||||
g_framebuf[off] = BlendColor(g_framebuf[off], clr.r, clr.a); off++;
|
g_framebuf[off] = BlendColor(g_framebuf[off], clr.r, clr.a); off++;
|
||||||
g_framebuf[off] = BlendColor(g_framebuf[off], clr.g, clr.a); off++;
|
g_framebuf[off] = BlendColor(g_framebuf[off], clr.g, clr.a); off++;
|
||||||
g_framebuf[off] = BlendColor(g_framebuf[off], clr.b, clr.a); off++;
|
g_framebuf[off] = BlendColor(g_framebuf[off], clr.b, clr.a); off++;
|
||||||
@ -73,7 +74,7 @@ static inline void DrawPixelRaw(uint32_t x, uint32_t y, color_t clr)
|
|||||||
{
|
{
|
||||||
if (x >= 1280 || y >= 720)
|
if (x >= 1280 || y >= 720)
|
||||||
return;
|
return;
|
||||||
u32 off = 4*gfxGetFramebufferDisplayOffset(x, y);
|
u32 off = (y * g_framebuf_width + x)*4;
|
||||||
g_framebuf[off] = clr.r; off++;
|
g_framebuf[off] = clr.r; off++;
|
||||||
g_framebuf[off] = clr.g; off++;
|
g_framebuf[off] = clr.g; off++;
|
||||||
g_framebuf[off] = clr.b; off++;
|
g_framebuf[off] = clr.b; off++;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "../common/common.h"
|
#include "../common/common.h"
|
||||||
|
|
||||||
uint8_t* g_framebuf;
|
uint8_t* g_framebuf;
|
||||||
|
u32 g_framebuf_width;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -21,7 +22,7 @@ int main(int argc, char **argv)
|
|||||||
//Scan all the inputs. This should be done once for each frame
|
//Scan all the inputs. This should be done once for each frame
|
||||||
hidScanInput();
|
hidScanInput();
|
||||||
|
|
||||||
g_framebuf = gfxGetFramebuffer(NULL, NULL);
|
g_framebuf = gfxGetFramebuffer(&g_framebuf_width, NULL);
|
||||||
memset(g_framebuf, 237, gfxGetFramebufferSize());
|
memset(g_framebuf, 237, gfxGetFramebufferSize());
|
||||||
if (!uiUpdate()) break;
|
if (!uiUpdate()) break;
|
||||||
menuLoop();
|
menuLoop();
|
||||||
|
Loading…
Reference in New Issue
Block a user