diff options
| -rw-r--r-- | .vimrc | 30 | ||||
| -rw-r--r-- | examples/graphics.lua | 2 | ||||
| -rw-r--r-- | examples/json.lua | 2 | ||||
| -rw-r--r-- | main.c | 7 |
4 files changed, 35 insertions, 6 deletions
@@ -0,0 +1,30 @@ +set makeprg=make +set errorformat=%f:%l:%c:\ %m + +let g:gdb_executable = 'bidi' +let g:gdb_arguments = '-r examples/json.lua' + +nnoremap <leader>m :call LocalMake()<CR> +nnoremap <leader>bm :execute '!make && gdb -ex "break main" -ex "run" --args ' . g:gdb_executable . ' ' . g:gdb_arguments<CR> +nnoremap <leader>bl :execute '!make && gdb -ex "break ' . line('.') . '" -ex "run" --args ' . g:gdb_executable . ' ' . g:gdb_arguments<CR> + +function! LocalMake() + silent make + + " Filter non valid errors out of quicklist. + let qfl = getqflist() + let filtered = filter(copy(qfl), {_, entry -> entry.valid == 1}) + call setqflist(filtered, 'r') + + redraw! + + if len(filtered) > 0 + copen + else + cclose + endif +endfunction + +" Hardcoded example +" nnoremap <leader>bm :!gdb -ex "break main" -ex "run" --args bidi -r examples/json.lua<CR> +" nnoremap <leader>bl :execute '!gdb -ex "break ' . line('.') . '" -ex "run" --args bidi -r examples/json.lua'<CR> diff --git a/examples/graphics.lua b/examples/graphics.lua index 2ac5219..cd1ee12 100644 --- a/examples/graphics.lua +++ b/examples/graphics.lua @@ -1,4 +1,4 @@ -open_window(800, 800, "My Game") +open_window(800, 800, "Sample Window") set_fps(60) while window_running() do diff --git a/examples/json.lua b/examples/json.lua index f656942..17a1930 100644 --- a/examples/json.lua +++ b/examples/json.lua @@ -1,4 +1,4 @@ -local file = io.open("test/test.json", "r") +local file = io.open("examples/test.json", "r") local content = file:read("*a") file:close() @@ -120,9 +120,9 @@ static int l_draw_info(lua_State *L) { double runtime = GetTime(); int height = GetScreenHeight(); - DrawTextEx(ctx.font, TextFormat("dt: %f", delta), (Vector2){ 20, height - 80 }, 20, 0, RAYWHITE); + DrawTextEx(ctx.font, TextFormat("fps: %d", fps), (Vector2){ 20, height - 80 }, 20, 0, RAYWHITE); DrawTextEx(ctx.font, TextFormat("run: %f", runtime), (Vector2){ 20, height - 60 }, 20, 0, RAYWHITE); - DrawTextEx(ctx.font, TextFormat("fps: %d", fps), (Vector2){ 20, height - 40 }, 20, 0, RAYWHITE); + DrawTextEx(ctx.font, TextFormat("dt: %f", delta), (Vector2){ 20, height - 40 }, 20, 0, RAYWHITE); return 0; } @@ -183,7 +183,6 @@ int main(int argc, char *argv[]) { if (run_file) { SetTraceLogLevel(debug_level); - lua_State *L = luaL_newstate(); luaL_openlibs(L); @@ -209,7 +208,7 @@ int main(int argc, char *argv[]) { return 1; } - UnloadFont(ctx.font); // Unload font from GPU memory (VRAM) + UnloadFont(ctx.font); lua_close(L); } |
