mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Added a function to get the available VRAM space, Improved the ctr.news library
This commit is contained in:
parent
f098e4a68e
commit
af9e160668
2 changed files with 23 additions and 12 deletions
29
source/gfx.c
29
source/gfx.c
|
|
@ -3,6 +3,8 @@
|
||||||
#include <sf2d.h>
|
#include <sf2d.h>
|
||||||
#include <sftd.h>
|
#include <sftd.h>
|
||||||
|
|
||||||
|
#include <3ds/vram.h>
|
||||||
|
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
|
|
||||||
|
|
@ -55,6 +57,12 @@ static int gfx_set3D(lua_State *L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gfx_vramSpaceFree(lua_State *L) {
|
||||||
|
lua_pushinteger(L, vramSpaceFree());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int gfx_line(lua_State *L) {
|
static int gfx_line(lua_State *L) {
|
||||||
int x1 = luaL_checkinteger(L, 1);
|
int x1 = luaL_checkinteger(L, 1);
|
||||||
int y1 = luaL_checkinteger(L, 2);
|
int y1 = luaL_checkinteger(L, 2);
|
||||||
|
|
@ -130,16 +138,17 @@ static int gfx_text(lua_State *L) {
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
static const struct luaL_Reg gfx_lib[] = {
|
static const struct luaL_Reg gfx_lib[] = {
|
||||||
{ "startFrame", gfx_startFrame},
|
{ "startFrame", gfx_startFrame },
|
||||||
{ "endFrame", gfx_endFrame },
|
{ "endFrame", gfx_endFrame },
|
||||||
{ "render", gfx_render },
|
{ "render", gfx_render },
|
||||||
{ "getFPS", gfx_getFPS },
|
{ "getFPS", gfx_getFPS },
|
||||||
{ "set3D", gfx_set3D },
|
{ "set3D", gfx_set3D },
|
||||||
{ "line", gfx_line },
|
{ "vramSpaceFree", gfx_vramSpaceFree },
|
||||||
{ "point", gfx_point },
|
{ "line", gfx_line },
|
||||||
{ "rectangle", gfx_rectangle },
|
{ "point", gfx_point },
|
||||||
{ "circle", gfx_circle },
|
{ "rectangle", gfx_rectangle },
|
||||||
{ "text", gfx_text },
|
{ "circle", gfx_circle },
|
||||||
|
{ "text", gfx_text },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,12 @@ static int news_notification(lua_State *L) {
|
||||||
bool jpeg = false;
|
bool jpeg = false;
|
||||||
if (lua_isboolean(L, 4))
|
if (lua_isboolean(L, 4))
|
||||||
jpeg = lua_toboolean(L, 4);
|
jpeg = lua_toboolean(L, 4);
|
||||||
|
lua_len(L, 3);
|
||||||
|
u32 imageDataLength = luaL_checkinteger(L, -1);
|
||||||
|
|
||||||
const u16* cTitle = 0;
|
const u16* cTitle = 0;
|
||||||
const u16* cMessage = 0;
|
const u16* cMessage = 0;
|
||||||
u32 titleLength, messageLength, imageDataLength = 0;
|
u32 titleLength, messageLength;
|
||||||
|
|
||||||
titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, sizeof(title));
|
titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, sizeof(title));
|
||||||
messageLength = (u32) utf8_to_utf16((uint16_t*)cMessage, (uint8_t*)message, sizeof(message));
|
messageLength = (u32) utf8_to_utf16((uint16_t*)cMessage, (uint8_t*)message, sizeof(message));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue