Documentation ¶
Index ¶
- Constants
- type Animation
- type Cmd_Scroll
- type Cmd_StopScroll
- type Cmd_Terminate
- type Cmd_UpdateCommandLine
- type Cmd_UpdateConsole
- type Cmd_UpdateCursor
- type Console
- func (console *Console) ClearCommandline()
- func (console *Console) Commandline() string
- func (console *Console) Print(str string)
- func (console *Console) PrintLines(strings []string)
- func (console *Console) PutCommand(command string)
- func (console *Console) PutReadline(command int)
- func (console *Console) PutString(str string)
- func (console *Console) PutUnicode(value uint16)
- func (console *Console) RendererOrNil() Renderer
- func (console *Console) SetPrompt(prompt string)
- func (console *Console) SetRenderer(renderer_orNil Renderer)
- func (console *Console) String() string
- type Evaluator
- type Renderer
- type SDLRenderer
Constants ¶
const ( CARRIAGE_RETURN = 0x000d BACKSPACE = 0x0008 DELETE = 0x007f CURSOR_BLINK_TIME = 5e8 HISTORY_NEXT = iota HISTORY_PREV CURSOR_LEFT CURSOR_RIGHT )
const ( SCROLL_UP = iota SCROLL_DOWN SCROLL_UP_ANIMATION SCROLL_DOWN_ANIMATION )
const DEFAULT_ANIMATION_FPS = 30
const (
MAX_INTERNAL_SIZE_FACTOR = 3
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Animation ¶
type Animation struct {
// contains filtered or unexported fields
}
func NewAnimation ¶
Creates a new animation. The values of 't' and 'length' are in seconds. Call 'Animation.Start' to start the animation.
func NewSliderAnimation ¶
Convenience function that creates a new animation going from 0.0 to 'distance'. The length is specified in seconds.
func (*Animation) FinishedCh ¶
This channel will receive a single value [when the animation ends] or [after the animation has been terminated] This channel is never closed.
func (*Animation) Start ¶
func (animation *Animation) Start()
Starts the animation. This method can be called at most once per an Animation object.
type Cmd_Scroll ¶
type Cmd_Scroll struct { // SCROLL_UP or SCROLL_DOWN Direction int }
Tell the renderer to scroll the console text up/down
type Cmd_StopScroll ¶
type Cmd_StopScroll struct{}
Tell the renderer to stop scrolling the console text. It is safe to send this event even if no scrolling is running.
type Cmd_Terminate ¶
type Cmd_Terminate struct {
Done chan bool
}
type Cmd_UpdateCommandLine ¶
type Cmd_UpdateCommandLine struct {
// contains filtered or unexported fields
}
type Cmd_UpdateConsole ¶
type Cmd_UpdateConsole struct {
// contains filtered or unexported fields
}
type Cmd_UpdateCursor ¶
type Cmd_UpdateCursor struct {
// contains filtered or unexported fields
}
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
func NewConsole ¶
Initialize a new console object passing to it an evaluator
func (*Console) ClearCommandline ¶
func (console *Console) ClearCommandline()
Clear the commandline.
func (*Console) Commandline ¶
Get the current command line as string.
func (*Console) Print ¶
Print a string on the console and go to the next line. This function can handle strings containing '\n'.
func (*Console) PrintLines ¶
Print a slice of strings on the console. The strings should not contain '\n'.
func (*Console) PutCommand ¶
Put a command and execute it
func (*Console) PutReadline ¶
Put a readline-like command on the commandline (e.g. history browsing, cursor movements, etc.). Readline's commands emulation is incomplete.
func (*Console) PutString ¶
Put the given string on the command line at the current cursor position.
func (*Console) PutUnicode ¶
Put an unicode value on the command-line at the current cursor position.
func (*Console) RendererOrNil ¶
Return the current renderer.
func (*Console) SetRenderer ¶
Replace the current renderer with a new one
type Renderer ¶
type Renderer interface {
// Receive Cmd_* objects from the console
EventCh() chan<- interface{}
}
type SDLRenderer ¶
type SDLRenderer struct { // Activate/deactivate blended text rendering. By default use // solid text rendering Blended bool // Set the foreground color of the font (white by default) Color sdl.Color // Set the font family Font *ttf.Font // contains filtered or unexported fields }
func NewSDLRenderer ¶
func NewSDLRenderer(surface *sdl.Surface, font *ttf.Font) *SDLRenderer
func (*SDLRenderer) EventCh ¶
func (renderer *SDLRenderer) EventCh() chan<- interface{}
Receive the events triggered by the console.
func (*SDLRenderer) GetSurface ¶
func (renderer *SDLRenderer) GetSurface() *sdl.Surface
Return the visible SDL surface
func (*SDLRenderer) UpdatedRectsCh ¶
func (renderer *SDLRenderer) UpdatedRectsCh() <-chan []sdl.Rect
From this channel, the client receives the rects representing the updated surface regions.