[FEAT] cnt() i rst()
This commit is contained in:
12
ascii.cpp
12
ascii.cpp
@@ -42,6 +42,7 @@ SDL_Texture *mini_bak = NULL;
|
||||
SDL_AudioDeviceID mini_audio_device;
|
||||
Uint32 *pixels;
|
||||
int pitch;
|
||||
Uint32 counter=0;
|
||||
|
||||
uint32_t palette[16] = { 0x00000000, 0x000000AA, 0x0000AA00, 0x0000AAAA, 0x00AA0000, 0x00AA00AA, 0x00AA5500, 0x00AAAAAA,
|
||||
0x00555555, 0x005555FF, 0x0055FF55, 0x0055FFFF, 0x00FF5555, 0x00FF55FF, 0x00FFFF55, 0x00FFFFFF };
|
||||
@@ -63,6 +64,7 @@ const char* get_filename() {
|
||||
|
||||
void reinit() {
|
||||
if (mini_bak != NULL) SDL_DestroyTexture(mini_bak);
|
||||
counter=0;
|
||||
switch (current_mode) {
|
||||
case 0:
|
||||
screen_width = 80;
|
||||
@@ -305,6 +307,7 @@ int main(int argc,char*argv[]) {
|
||||
SDL_RenderCopy(mini_ren, mini_bak, NULL, &rect);
|
||||
//SDL_RenderCopy(mini_ren, mini_bak, NULL, NULL);
|
||||
SDL_RenderPresent(mini_ren);
|
||||
counter++;
|
||||
}
|
||||
lua_quit();
|
||||
SDL_Quit();
|
||||
@@ -672,4 +675,11 @@ const char* fromclipboard() {
|
||||
SDL_free((void*)text);
|
||||
|
||||
return str_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t cnt() {
|
||||
return counter;
|
||||
}
|
||||
void rst() {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
5
ascii.h
5
ascii.h
@@ -204,4 +204,7 @@ void fileout(const char* str, uint16_t addr, uint16_t size);
|
||||
void filein(const char* str, uint16_t addr, uint16_t size);
|
||||
|
||||
void toclipboard(const char* str);
|
||||
const char* fromclipboard();
|
||||
const char* fromclipboard();
|
||||
|
||||
uint32_t cnt();
|
||||
void rst();
|
||||
|
||||
13
lua.cpp
13
lua.cpp
@@ -392,6 +392,16 @@ extern "C" {
|
||||
lua_pushstring(L, fromclipboard());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_cnt(lua_State *L) {
|
||||
lua_pushinteger(L, cnt());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_rst(lua_State *L) {
|
||||
rst();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define STATE_STOPPED 0
|
||||
@@ -485,6 +495,9 @@ void lua_init(const char* filename, const bool start_playing) {
|
||||
lua_pushcfunction(L,cpp_toclipboard); lua_setglobal(L, "toclipboard");
|
||||
lua_pushcfunction(L,cpp_fromclipboard); lua_setglobal(L, "fromclipboard");
|
||||
|
||||
lua_pushcfunction(L,cpp_cnt); lua_setglobal(L, "cnt");
|
||||
lua_pushcfunction(L,cpp_rst); lua_setglobal(L, "rst");
|
||||
|
||||
lua_pushinteger(L, 0); lua_setglobal(L, "KEY_UNKNOWN");
|
||||
lua_pushinteger(L, 4); lua_setglobal(L, "KEY_A");
|
||||
lua_pushinteger(L, 5); lua_setglobal(L, "KEY_B");
|
||||
|
||||
Reference in New Issue
Block a user