Skip to content

dima13230/DefConsole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DefConsole

DefConsole is an in-game debugging console for Defold Engine made with ImGUI.

Example

Setup

Dependency

To integrate the DefConsole extension into your project, add this project as a dependency in your Defold game. Open your game.project file and add the following line to the dependencies field under the project section to use latest release:

https://github.com/dima13230/DefConsole/archive/refs/tags/v0.1.zip

To use the DefConsole with latest (but probably unstable or broken) features, you can instead add the following line to the dependencies field under the project section:

https://github.com/dima13230/DefConsole/archive/refs/heads/imgui.zip

DefConsole depends on ImGUI extension for Defold Engine and to use it you have to also add ImGUI extension into your project dependencies:

https://github.com/britzl/extension-imgui/archive/refs/tags/1.3.0.zip

Usage

To use the DefConsole add the

defconsole/console.collection

To your scene. Then add the console_toggle in your input bindings with the button you want to be able to toggle console with.

You can add your own functions and variables to be available in the console. Here's an example of how to do that:

local console = require("defconsole.console_module")

-- Console commands extension
function message(object, id)
	msg.post("level_holder:/collection0/" .. object, id)
end
ext.message=message

Then you can type this in the console: ext.message("door", "open")

ext is a table defined inside the console_module and is guaranteed to be in the console's scope.

Alternatively to console_toggle input binding, you can toggle console through your code by changing the value of boolean console.active as well as check if the console is enabled using this variable.

Console outputs engine logs by default. This can be disabled by setting console.output_logs to false.

TODO

  • Fix error handling for attempts to call non-existent methods in console
  • Rewrite input_text handling using callbacks to be able to manipulate it more elegantly (and fix the bug with keyboard cursor going to the beginning of input_text after history traversal)
  • Auto scrolling of console output
  • Save story of commands and use up/down arrows to restore them into the input field

Contributions & Sponsors

Any contributions or sponsorships are welcome. Although all contributors will be shown in special section by GitHub itself, I'll maintain here a list of top contributors as well as full list of sponsors (if sponsors desire so).

USDT TRC20:

TESXiLVwPrgDqWvPSYfU4pXKc7gTaXcvVE

ЮMoney


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published