Skip to content

Commit

Permalink
Project refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
quentincaffeino committed Mar 28, 2018
1 parent be6d8d7 commit f77b2d7
Show file tree
Hide file tree
Showing 54 changed files with 974 additions and 1,299 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -5,7 +5,7 @@ Godot Console

In-game console for Godot, easily extensible with new commands.

![Quake-style console for Godot](https://github.com/QuentinCaffeino/godot-console/blob/master/example/screenshot.png)
![Quake-style console for Godot](https://github.com/QuentinCaffeino/godot-console/blob/master/screenshot.png)

## Features

Expand All @@ -20,8 +20,8 @@ In-game console for Godot, easily extensible with new commands.

## Installation

1. Clone or download this repository.
2. Add `src/Console.tscn` to Autoload.
1. Clone or download this repository to your project folder.
2. Add `src/Console.tscn` to godot autoload as `Console`.
3. Add new actions to Input Map: `console_toggle`, `ui_up`, `ui_down`

## Example
Expand Down Expand Up @@ -58,7 +58,7 @@ func print_hello():

More information about [**ARG_TYPE**](https://github.com/QuentinCaffeino/godot-console/blob/master/docs/Types.md) you can find in [this readme](https://github.com/QuentinCaffeino/godot-console/blob/master/docs/Types.md).

You can find more examples in [`example/script.gd`](https://github.com/QuentinCaffeino/godot-console/blob/master/example/script.gd)
You can find more examples in [`src/BaseCommands.gd`](https://github.com/QuentinCaffeino/godot-console/blob/master/src/BaseCommands.gd)

----------

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/Console.md
Expand Up @@ -24,4 +24,5 @@
| *int* unregister(*string* alias) | Unregister command |
| void write(string message) | |
| void writeLine(string message) | Append new-line character at the end of the message |
| void clear() | Clear console |
| void toggleConsole() | Show console |
Binary file removed example/icon.png
Binary file not shown.
Binary file removed example/icon256.png
Binary file not shown.
33 changes: 0 additions & 33 deletions example/project.godot

This file was deleted.

124 changes: 0 additions & 124 deletions example/scene.tscn

This file was deleted.

63 changes: 0 additions & 63 deletions example/script.gd

This file was deleted.

1 change: 0 additions & 1 deletion example/vendor/quentincaffeino/console

This file was deleted.

File renamed without changes
80 changes: 80 additions & 0 deletions src/Argument/Argument.gd
@@ -0,0 +1,80 @@

extends Reference

const TypesBuilder = preload('../Types/TypesBuilder.gd')
const BaseType = preload('../Types/BaseType.gd')


enum ARGASSIG \
{
CANCELED = 2
}


# @var string
var _name

# @var BaseType
var _type

# @var Variant
var value = null setget setValue, getValue


# @param string|null name
# @param BaseType type
func _init(name, type):
_name = name
_type = type


# @param Variant inValue
func setValue(inValue): # int
return _type.check(inValue)


func getValue(): # Variant
return _type.get()


func toString(): # string
var result = ''

if _name:
result += _name + ':'

result += _type.getName()

return result


# @param string|null name
# @param int|BaseType type
static func build(name, type = 0): # Argument|int
# Define arument type
if !(typeof(type) == TYPE_OBJECT and type is BaseType):
type = TypesBuilder.build(type if typeof(type) == TYPE_INT else 0)

if typeof(type) == TYPE_INT:
return FAILED

return new(name, type)


# @param Array args
static func buildAll(args): # Array<Argument>|int
var builtArgs = []

var tArg
for arg in args:
match typeof(arg):
TYPE_ARRAY: tArg = build(arg[0], arg[1] if arg.size() > 1 else 0)
TYPE_STRING: tArg = build(arg)
TYPE_OBJECT, TYPE_INT: tArg = build(null, arg)

if typeof(tArg) == TYPE_INT:
return FAILED

builtArgs.append(tArg)

return builtArgs

0 comments on commit f77b2d7

Please sign in to comment.