diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000000000000000000000000000000000000..a2da4a75f151569d715cf2986eca3989dc8006d8 --- /dev/null +++ b/.vimrc @@ -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 m :call LocalMake() +nnoremap bm :execute '!make && gdb -ex "break main" -ex "run" --args ' . g:gdb_executable . ' ' . g:gdb_arguments +nnoremap bl :execute '!make && gdb -ex "break ' . line('.') . '" -ex "run" --args ' . g:gdb_executable . ' ' . g:gdb_arguments + +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 bm :!gdb -ex "break main" -ex "run" --args bidi -r examples/json.lua +" nnoremap bl :execute '!gdb -ex "break ' . line('.') . '" -ex "run" --args bidi -r examples/json.lua' diff --git a/examples/graphics.lua b/examples/graphics.lua index 2ac5219e7dfdaf59d2914bfd2e6d45203496a5d5..cd1ee129b78584936b0e74b9dcfd04fe78db234b 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 f656942b34414aa5f45b0b9b5988670104154775..17a19309fde42cf8bab01fbb3ed960e99cba8320 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() diff --git a/main.c b/main.c index b237a4686c23e139ef2cb40eae8e1101f6020adb..00e11d244b1e97188f3b05ee9eb3520bc95cd45f 100644 --- a/main.c +++ b/main.c @@ -120,9 +120,9 @@ int fps = GetFPS(); 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 @@ if (run_file) { SetTraceLogLevel(debug_level); - lua_State *L = luaL_newstate(); luaL_openlibs(L); @@ -209,7 +208,7 @@ fprintf(stderr, "Error: %s\n", lua_tostring(L, -1)); return 1; } - UnloadFont(ctx.font); // Unload font from GPU memory (VRAM) + UnloadFont(ctx.font); lua_close(L); }