{"id":17987254,"url":"https://github.com/justinmeiners/c-game-debug-console","last_synced_at":"2025-03-25T22:31:44.128Z","repository":{"id":9061569,"uuid":"10830176","full_name":"justinmeiners/c-game-debug-console","owner":"justinmeiners","description":"Quake style debug console for games. Written in ANSI C.","archived":false,"fork":false,"pushed_at":"2013-07-09T04:07:12.000Z","size":164,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-05T16:26:26.151Z","etag":null,"topics":["c","game"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justinmeiners.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-20T21:45:31.000Z","updated_at":"2023-02-12T09:47:28.000Z","dependencies_parsed_at":"2022-09-16T19:11:15.381Z","dependency_job_id":null,"html_url":"https://github.com/justinmeiners/c-game-debug-console","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmeiners%2Fc-game-debug-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmeiners%2Fc-game-debug-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmeiners%2Fc-game-debug-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinmeiners%2Fc-game-debug-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinmeiners","download_url":"https://codeload.github.com/justinmeiners/c-game-debug-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222099519,"owners_count":16931428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","game"],"created_at":"2024-10-29T19:07:58.762Z","updated_at":"2024-10-29T19:07:59.257Z","avatar_url":"https://github.com/justinmeiners.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"C Game Debug Console\n====================\n\nA Quake style debug console for games.\n* **Portable** - ANSI C + Standard Library\n* **Easy Integration** - A single header and source file for the console, and one for the default library.\n* **Clean** - Well designed interface with opaque data structures.\n* **Simple** - Simple design and featureset. Easily add new commands and variables. If more complexity is needed (arrays, returns, complex expressions etc.) a complete scripting language may be more appropriate. Check out [lua](http://lua.org) instead.\n* **Persitent** - Save and load and console states.\n\n### Integration: ###\n\n```C \n\n#include \"Console.h\"\n#include \"ConsoleStdLib.h\"\n\n/* create console with output file */\nConsoleRef console = Console_Create(stdout);\n\n/* register standard library (optional) */\nConsoleStdLib_Register(console);\n\n/* execute functions */\nConsole_Execute(...)\nConsole_Execute(...)\n....\n\n/* shutdown */\nConsole_Destroy(console);\n\n```\n\n### Usage: ###\n\nCommands take the simple form of:\n\n```\ncommand_name arg1 arg2 argN...\n\nExample:\nset my_var 40\n\nor \n\nset my_var other_var\n\n```\n\nStandard Library:\n\n* **TRUE** - bool 1\n* **FALSE** - bool 0\n* **echo** - prints the value of a variable\n* **inspect** - prints the type of a variable\n* **set** - assigns the value of the second argument to the first \n\n\n### Custom Variables: ###\n\n```C\n\n/* registration */\nConsoleVarRef myVar = Console_RegisterVar(console,\n                                          \"my_var\", /* variable name */\n                                          kConsoleVarTypeInt, /* int type */\n                                          0); /* flags - readonly, etc (none used) */\n\n\t\t\t\t\t\t\t\t\t\t   \n...\n...\n...\n\n/* access outside of console in C code */\n\n/* find handle or use cached */\nConsoleVarRef myVar = Console_FindVar(\"my_var\");\n\n/* get value */\nint val = ConsoleVar_IntValue(myVar);\n\n/* assignment */\nConsoleVar_SetIntValue(myVar, 100);\n\n```\n\n\n### Custom Commands: ###\n```C \n\n/* sample command function */\nint calculateAverage(ConsoleRef console, ConsoleArgRef args)\n{\n\tConsoleArgRef arg = args;\n\t\n\tdouble total = 0.0;\n\tint count = 0;\n\t\n\t/* args is linked list */\n\twhile (arg)\n\t{\n\t\ttotal += ConsoleVar_DoubleValue(arg-\u003evar);\n\t\tcount++;\n\t\targ = arg-\u003enext;\n\t}\n\t\t\n\tfprintf(Console_Log(console), \"%lf\\n\", total / (double)count);\n\t\n\t/* return success */\n\treturn 1;\n}\n\n/* registration */\nConsole_RegisterCommand(console,\n                        \"avg\", /* command name */\n                        calculateAverage, /* function pointer */\n                        -1); /* how many arguments (-1 indicates a variable number) ? */\n\t\t\t\t\t\t\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinmeiners%2Fc-game-debug-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinmeiners%2Fc-game-debug-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinmeiners%2Fc-game-debug-console/lists"}