doodle

package
v0.0.0-...-1f00af5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: GPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Millisecond64 is a time.Millisecond casted to float64.
	Millisecond64 = float64(time.Millisecond)
)

Variables

View Source
var (
	DebugOverlay   = false
	DebugCollision = false

	DebugTextPadding = 8
	DebugTextSize    = 24
	DebugTextColor   = render.SkyBlue
	DebugTextStroke  = render.Grey
	DebugTextShadow  = render.Black
)

Debug mode options, these can be enabled in the dev console like: boolProp DebugOverlay true

Functions

func GetMemUsage

func GetMemUsage()

GetMemUsage collects statistics on memory utilization.

Types

type Command

type Command struct {
	Raw         string   // The complete raw command the user typed.
	Command     string   // The first word of their command.
	Args        []string // The shell-args array of parameters.
	ArgsLiteral string   // The args portion of the command literally.
}

Command is a parsed shell command.

func (Command) BoolProp

func (c Command) BoolProp(d *Doodle) error

BoolProp command sets available boolean variables.

func (Command) Close

func (c Command) Close(d *Doodle) error

Close returns to the Main Scene.

func (Command) Default

func (c Command) Default(d *Doodle) error

Default command.

func (Command) Edit

func (c Command) Edit(d *Doodle) error

Edit a map from disk.

func (Command) ExtractBindata

func (c Command) ExtractBindata(d *Doodle, path string) error

ExtractBindata dumps the app's embedded bindata to the filesystem.

func (Command) Help

func (c Command) Help(d *Doodle) error

Help prints the help info.

func (Command) New

func (c Command) New(d *Doodle) error

New opens a new map in the editor mode.

func (Command) Play

func (c Command) Play(d *Doodle) error

Play a map.

func (Command) Quit

func (c Command) Quit() error

Quit the command line shell.

func (Command) Run

func (c Command) Run(d *Doodle) error

Run the command.

func (Command) RunScript

func (c Command) RunScript(d *Doodle, code string) (goja.Value, error)

RunScript evaluates some JavaScript code safely.

func (Command) Save

func (c Command) Save(d *Doodle) error

Save the current map to disk.

func (Command) TitleScreen

func (c Command) TitleScreen(d *Doodle) error

TitleScreen loads the title with a custom user level.

type Doodle

type Doodle struct {
	Debug  bool
	Engine render.Engine

	Scene Scene
	// contains filtered or unexported fields
}

Doodle is the game object.

func New

func New(debug bool, engine render.Engine) *Doodle

New initializes the game object.

func (*Doodle) ConfirmExit

func (d *Doodle) ConfirmExit()

ConfirmExit may shut down Doodle gracefully after showing the user a confirmation modal.

func (*Doodle) DrawCollisionBox

func (d *Doodle) DrawCollisionBox(canvas *uix.Canvas, actor *uix.Actor)

DrawCollisionBox draws the collision box around a Doodad.

The canvas will be the level Canvas, and the collision box is drawn in world space using the canvas.DrawStrokes function.

func (*Doodle) DrawDebugOverlay

func (d *Doodle) DrawDebugOverlay()

DrawDebugOverlay draws the debug FPS text on the SDL canvas.

func (*Doodle) EditDrawing

func (d *Doodle) EditDrawing(filename string) error

EditDrawing loads a drawing (Level or Doodad) in Edit Mode.

func (*Doodle) EditFile

func (d *Doodle) EditFile(filename string) error

EditFile opens a drawing file (Level or Doodad) in the EditorScene.

The filename can be one of the following:

  • A simple filename with no path separators in it and/or no file extension.
  • An absolute path beginning with "/"
  • A relative path beginning with "./"

If the filename has an extension (`.level` or `.doodad`), that will disambiguate how to find the file and which mode to start the EditorMode in. Otherwise, the "levels" folder is checked first and the "doodads" folder second.

func (*Doodle) FindLikelySupervisor

func (d *Doodle) FindLikelySupervisor() (*ui.Supervisor, error)

FindLikelySupervisor will locate a most likely ui.Supervisor depending on the current Scene, if it understands the Scene and knows where it keeps its Supervisor.

func (*Doodle) Flash

func (d *Doodle) Flash(template string, v ...interface{})

Flash a message to the user.

func (*Doodle) FlashError

func (d *Doodle) FlashError(template string, v ...interface{})

FlashError flashes an error-colored message to the user.

func (*Doodle) Goto

func (d *Doodle) Goto(scene Scene) error

Goto a scene. First it unloads the current scene.

func (*Doodle) GotoLoadMenu

func (d *Doodle) GotoLoadMenu()

GotoLoadMenu loads the MenuScene and shows the "Load" window.

DEPRECATED: loads the old menu, in dev console run `$ d.GotoLoadMenu()` to see.

func (*Doodle) GotoNewDoodadMenu

func (d *Doodle) GotoNewDoodadMenu()

GotoNewDoodadMenu loads the MenuScene and shows the "New" window, but selected on the Doodad tab by default.

func (*Doodle) GotoNewMenu

func (d *Doodle) GotoNewMenu()

GotoNewMenu loads the MenuScene and shows the "New" window.

func (*Doodle) GotoPlayMenu

func (d *Doodle) GotoPlayMenu()

GotoPlayMenu loads the MenuScene and shows the "Load" window for playing a level, not editing it.

DEPRECATED: loads the old menu, in dev console run `$ d.GotoPlayMenu()` to see.

func (*Doodle) GotoSettingsMenu

func (d *Doodle) GotoSettingsMenu()

GotoSettingsMenu loads the settings screen.

func (*Doodle) MakeCheatsWindow

func (d *Doodle) MakeCheatsWindow(supervisor *ui.Supervisor) *ui.Window

MakeCheatsWindow initializes the windows/cheats_menu.go window from anywhere you need it, binding all the variables in. If you pass a nil Supervisor, this function will attempt to find one based on your Scene and

func (*Doodle) MakeHelpMenu

func (d *Doodle) MakeHelpMenu(menu *ui.MenuBar, supervisor *ui.Supervisor) *ui.MenuButton

MakeHelpMenu creates the "Help" menu with its common items across any scene.

func (*Doodle) MakeSettingsWindow

func (d *Doodle) MakeSettingsWindow(supervisor *ui.Supervisor) *ui.Window

MakeSettingsWindow initializes the windows/settings.go window from anywhere you need it, binding all the variables in.

func (*Doodle) NewDoodad

func (d *Doodle) NewDoodad(width, height int)

NewDoodad loads a new Doodad in Edit Mode. If size is zero, it prompts the user to select a size or accept the default size.

func (*Doodle) NewMap

func (d *Doodle) NewMap()

NewMap loads a new map in Edit Mode.

func (*Doodle) PlayFromLevelpack

func (d *Doodle) PlayFromLevelpack(pack *levelpack.LevelPack, which levelpack.Level) error

PlayFromLevelpack initializes the Play Scene from a level as part of a levelpack.

func (*Doodle) PlayLevel

func (d *Doodle) PlayLevel(filename string) error

PlayLevel loads a map from JSON into the PlayScene.

func (*Doodle) Prompt

func (d *Doodle) Prompt(question string, callback func(string))

Prompt the user for a question in the dev console.

func (*Doodle) PromptPre

func (d *Doodle) PromptPre(question string, prefilled string, callback func(string))

PromptPre prompts with a pre-filled value.

func (*Doodle) Run

func (d *Doodle) Run() error

Run initializes SDL and starts the main loop.

func (*Doodle) SetPlayerCharacter

func (d *Doodle) SetPlayerCharacter(filename string)

SetPlayerCharacter -- this is designed to be called in-game with the developer console. Sets your player character to whatever doodad you want, not just the few that have cheat codes. If you set an invalid filename, you become the dummy default doodad sprite (a red "X").

func (*Doodle) SetWindowSize

func (d *Doodle) SetWindowSize(width, height int)

SetWindowSize sets the size of the Doodle window.

func (*Doodle) SetupEngine

func (d *Doodle) SetupEngine() error

SetupEngine sets up the rendering engine.

func (*Doodle) Title

func (d *Doodle) Title() string

Title returns the game's preferred window title.

func (*Doodle) TrackFPS

func (d *Doodle) TrackFPS(skipped uint32)

TrackFPS shows the current FPS once per second.

In debug mode, changes the window title to include the FPS counter.

type DraggableActor

type DraggableActor struct {
	// contains filtered or unexported fields
}

DraggableActor is a Doodad being dragged from the Doodad palette.

func (*DraggableActor) Teardown

func (da *DraggableActor) Teardown()

Teardown the DraggableActor and free its textures.

type EditorScene

type EditorScene struct {
	// Configuration for the scene initializer.
	DrawingType            enum.DrawingType
	OpenFile               bool
	Filename               string
	DoodadSize             render.Rect
	RememberScrollPosition render.Point // Play mode remembers it for us

	UI *EditorUI

	// The current level or doodad object being edited, based on the
	// DrawingType.
	Level       *level.Level
	Doodad      *doodads.Doodad
	ActiveLayer int // which layer (of a doodad) is being edited now?
	// contains filtered or unexported fields
}

EditorScene manages the "Edit Level" game mode.

func (*EditorScene) AutoSave

func (s *EditorScene) AutoSave() error

AutoSave takes an autosave snapshot of the level or drawing.

func (*EditorScene) ConfirmUnload

func (s *EditorScene) ConfirmUnload(fn func())

ConfirmUnload may pop up a confirmation modal to save the level before the user performs an action that may close the level, such as click File->New.

func (*EditorScene) Destroy

func (s *EditorScene) Destroy() error

Destroy the scene.

func (*EditorScene) Draw

func (s *EditorScene) Draw(d *Doodle) error

Draw the current frame.

func (*EditorScene) GetDrawing

func (w *EditorScene) GetDrawing() *uix.Canvas

GetDrawing returns the uix.Canvas

func (*EditorScene) LoadDoodad

func (s *EditorScene) LoadDoodad(filename string) error

LoadDoodad loads a doodad from disk.

func (*EditorScene) LoadLevel

func (s *EditorScene) LoadLevel(filename string) error

LoadLevel loads a level from disk.

func (*EditorScene) Loop

func (s *EditorScene) Loop(d *Doodle, ev *event.State) error

Loop the editor scene.

func (*EditorScene) MenuNewDoodad

func (s *EditorScene) MenuNewDoodad()

func (*EditorScene) MenuNewLevel

func (s *EditorScene) MenuNewLevel()

File->New level, or Ctrl-N

func (*EditorScene) MenuOpen

func (s *EditorScene) MenuOpen()

File->Open, or Ctrl-O

func (*EditorScene) MenuSave

func (s *EditorScene) MenuSave(as bool) func()

File->Save, or Ctrl-S File->Save As, or Shift-Ctrl-S NOTICE: this one returns a func() so you need to call that one!

func (*EditorScene) Name

func (s *EditorScene) Name() string

Name of the scene.

func (*EditorScene) Playtest

func (s *EditorScene) Playtest()

Playtest switches the level into Play Mode.

func (*EditorScene) PlaytestFrom

func (s *EditorScene) PlaytestFrom(p render.Point)

PlaytestFrom enters play mode starting at a custom spawn point.

func (*EditorScene) Reset

func (s *EditorScene) Reset()

Reset the editor scene from scratch. Good nuclear option when you change the level's palette on-the-fly or some other sticky situation and want to reload the editor.

func (*EditorScene) SaveDoodad

func (s *EditorScene) SaveDoodad(filename string) error

SaveDoodad saves the doodad to disk.

func (*EditorScene) SaveLevel

func (s *EditorScene) SaveLevel(filename string) error

SaveLevel saves the level to disk.

func (*EditorScene) Setup

func (s *EditorScene) Setup(d *Doodle) error

Setup the editor scene.

func (*EditorScene) UpdateLevelScreenshot

func (s *EditorScene) UpdateLevelScreenshot(lvl *level.Level) error

UpdateLevelScreenshot updates a level screenshot in its zipfile.

type EditorUI

type EditorUI struct {
	Scene *EditorScene

	// Variables
	StatusBoxes        []*string
	StatusMouseText    string
	StatusPaletteText  string
	StatusFilenameText string
	StatusScrollText   string

	Supervisor *ui.Supervisor
	Canvas     *uix.Canvas
	Workspace  *ui.Frame
	MenuBar    *ui.MenuBar
	StatusBar  *ui.Frame
	ToolBar    *ui.Frame
	PlayButton *ui.Button

	// Palette window.
	Palette    *ui.Window
	PaletteTab *ui.Frame
	DoodadTab  *ui.Frame

	// Draggable Doodad canvas.
	DraggableActor *DraggableActor
	// contains filtered or unexported fields
}

EditorUI manages the user interface for the Editor Scene.

func NewEditorUI

func NewEditorUI(d *Doodle, s *EditorScene) *EditorUI

NewEditorUI initializes the Editor UI.

func (*EditorUI) ConfigureWindow

func (u *EditorUI) ConfigureWindow(d *Doodle, window *ui.Window)

ConfigureWindow sets default window config functions, like centering them on screen.

func (*EditorUI) ExpandCanvas

func (u *EditorUI) ExpandCanvas(e render.Engine)

ExpandCanvas manually expands the Canvas to fill the frame, to work around UI packing bugs. Ideally I would use `Expand: true` when packing the Canvas in its frame, but that would artificially expand the Canvas also when it _wanted_ to be smaller, as in Doodad Editing Mode.

func (*EditorUI) FinishSetup

func (u *EditorUI) FinishSetup(d *Doodle)

FinishSetup runs the Setup tasks that must be postponed til the end, such as rendering the Palette window so that it can accurately show the palette loaded from a level.

func (*EditorUI) Loop

func (u *EditorUI) Loop(ev *event.State) error

Loop to process events and update the UI.

func (*EditorUI) OpenDoodadDropper

func (u *EditorUI) OpenDoodadDropper()

OpenDoodadDropper opens the Doodad Dropper window.

func (*EditorUI) OpenFileSystemWindow

func (u *EditorUI) OpenFileSystemWindow()

OpenPublishWindow opens the FileSystem window.

func (*EditorUI) OpenLayersWindow

func (u *EditorUI) OpenLayersWindow()

Opens the "Layers" window (for editing doodads)

func (*EditorUI) OpenPaletteWindow

func (u *EditorUI) OpenPaletteWindow()

OpenPaletteWindow opens the Palette Editor window.

func (*EditorUI) OpenPublishWindow

func (u *EditorUI) OpenPublishWindow()

OpenPublishWindow opens the Publisher window.

func (*EditorUI) OpenTextTool

func (u *EditorUI) OpenTextTool()

OpenTextTool opens the Text Tool window.

func (*EditorUI) Present

func (u *EditorUI) Present(e render.Engine)

Present the UI to the screen.

func (*EditorUI) Resized

func (u *EditorUI) Resized(d *Doodle)

Resized handles the window being resized so we can recompute the widgets.

func (*EditorUI) SetupCanvas

func (u *EditorUI) SetupCanvas(d *Doodle) *uix.Canvas

SetupCanvas configures the main drawing canvas in the editor.

func (*EditorUI) SetupMenuBar

func (u *EditorUI) SetupMenuBar(d *Doodle) *ui.MenuBar

SetupMenuBar sets up the menu bar.

func (*EditorUI) SetupPalette

func (u *EditorUI) SetupPalette(d *Doodle) *ui.Window

SetupPalette sets up the palette panel.

func (*EditorUI) SetupPopups

func (u *EditorUI) SetupPopups(d *Doodle)

SetupPopups preloads popup windows like the DoodadDropper.

func (*EditorUI) SetupStatusBar

func (u *EditorUI) SetupStatusBar(d *Doodle) *ui.Frame

SetupStatusBar sets up the status bar widget along the bottom of the window.

func (*EditorUI) SetupToolbar

func (u *EditorUI) SetupToolbar(d *Doodle) *ui.Frame

SetupToolbar configures the UI for the Tools panel.

func (*EditorUI) SetupWorkspace

func (u *EditorUI) SetupWorkspace(d *Doodle) *ui.Frame

SetupWorkspace configures the main Workspace frame that takes up the full window apart from toolbars. The Workspace has a single child element, the Canvas, so it can easily full-screen it or center it for Doodad editing.

func (*EditorUI) Teardown

func (u *EditorUI) Teardown()

Teardown the UI manager and free all the SDL2 textures under its control.

type Flash

type Flash struct {
	Text    string
	Expires uint64 // tick that it expires
	Color   render.Color
}

Flash holds a message to flash on screen.

type GUITestScene

type GUITestScene struct {
	Supervisor *ui.Supervisor

	// Private widgets.
	Frame  *ui.Frame
	Window *ui.Frame
	// contains filtered or unexported fields
}

GUITestScene implements the main menu of Doodle.

func (*GUITestScene) Destroy

func (s *GUITestScene) Destroy() error

Destroy the scene.

func (*GUITestScene) Draw

func (s *GUITestScene) Draw(d *Doodle) error

Draw the pixels on this frame.

func (*GUITestScene) Loop

func (s *GUITestScene) Loop(d *Doodle, ev *event.State) error

Loop the editor scene.

func (*GUITestScene) Name

func (s *GUITestScene) Name() string

Name of the scene.

func (*GUITestScene) Setup

func (s *GUITestScene) Setup(d *Doodle) error

Setup the scene.

type MainScene

type MainScene struct {
	Supervisor    *ui.Supervisor
	LevelFilename string // custom level filename to load in background

	// Lazy scroll variables. See LoopLazyScroll().
	PauseLazyScroll bool // exported for dev console
	// contains filtered or unexported fields
}

MainScene implements the main menu of Doodle.

func (*MainScene) ButtonFrame

func (s *MainScene) ButtonFrame() *ui.Frame

ButtonFrame returns the main button frame.

func (*MainScene) Destroy

func (s *MainScene) Destroy() error

Destroy the scene.

func (*MainScene) Draw

func (s *MainScene) Draw(d *Doodle) error

Draw the pixels on this frame.

func (*MainScene) LabelHint

func (s *MainScene) LabelHint() *ui.Label

LabelHint returns the hint widget.

func (*MainScene) LabelVersion

func (s *MainScene) LabelVersion() *ui.Label

LabelVersion returns the version widget.

func (*MainScene) Loop

func (s *MainScene) Loop(d *Doodle, ev *event.State) error

Loop the editor scene.

func (*MainScene) LoopLazyScroll

func (s *MainScene) LoopLazyScroll()

LoopLazyScroll gently scrolls the title screen demo level, called each Loop.

func (*MainScene) MakePhotogenic

func (s *MainScene) MakePhotogenic(v bool)

MakePhotogenic tweaks some variables to make a screenshotable title screen.

This function is designed to be called from the developer shell:

$ d.Scene.MakePhotogenic(true)

It automates the pausing of lazy scroll and hiding of UI elements except for just the title and version number.

func (*MainScene) Name

func (s *MainScene) Name() string

Name of the scene.

func (*MainScene) Resized

func (s *MainScene) Resized(width, height int)

Resized the app window.

func (*MainScene) Setup

func (s *MainScene) Setup(d *Doodle) error

Setup the scene.

func (*MainScene) SetupDemoLevel

func (s *MainScene) SetupDemoLevel(d *Doodle) error

SetupDemoLevel configures the wallpaper behind the New screen, which demos a title screen demo level.

type MenuScene struct {
	// Configuration.
	StartupMenu string
	NewDoodad   bool

	Supervisor *ui.Supervisor
	// contains filtered or unexported fields
}

MenuScene holds the main dialog menu UIs for:

* New Level * Open Level * Settings

DEPRECATED: migrate these prompts into popup windows to appear on the MainScene or elsewhere as wanted.

func (s *MenuScene) DebugGetWindow() *ui.Window

DebugGetWindow surfaces the underlying private window.

func (s *MenuScene) Destroy() error

Destroy the scene.

func (s *MenuScene) Draw(d *Doodle) error

Draw the pixels on this frame.

func (s *MenuScene) Loop(d *Doodle, ev *event.State) error

Loop the editor scene.

func (s *MenuScene) Name() string

Name of the scene.

func (s *MenuScene) Setup(d *Doodle) error

Setup the scene.

type PlayScene

type PlayScene struct {
	// Configuration attributes.
	Filename               string
	Level                  *level.Level
	CanEdit                bool         // i.e. you came from the Editor Mode
	HasNext                bool         // has a next level to load next
	RememberScrollPosition render.Point // for the Editor quality of life
	SpawnPoint             render.Point // if not zero, overrides Start Flag

	// If this level was part of a levelpack. The Play Scene will read it
	// from the levelpack ZIP file in priority over any other location.
	LevelPack *levelpack.LevelPack

	// UI widgets.
	Supervisor *ui.Supervisor

	// Player character
	Player *uix.Actor
	// contains filtered or unexported fields
}

PlayScene manages the "Edit Level" game mode.

func (*PlayScene) BeatLevel

func (s *PlayScene) BeatLevel()

BeatLevel handles the level success condition.

func (*PlayScene) Canvas

func (s *PlayScene) Canvas() *uix.Canvas

Canvas returns the main level canvas - useful to call from the debug console as `d.Scene.Canvas()`

func (*PlayScene) Destroy

func (s *PlayScene) Destroy() error

Destroy the scene.

func (*PlayScene) DieByFire

func (s *PlayScene) DieByFire(name string)

DieByFire ends the level by "fire", or w/e the swatch is named.

func (*PlayScene) Draw

func (s *PlayScene) Draw(d *Doodle) error

Draw the pixels on this frame.

func (*PlayScene) DrawTouchable

func (s *PlayScene) DrawTouchable()

DrawTouchable draws any UI elements if needed for the touch UI.

func (*PlayScene) Drawing

func (s *PlayScene) Drawing() *uix.Canvas

Drawing returns the private world drawing, for debugging with the console.

func (*PlayScene) EditLevel

func (s *PlayScene) EditLevel()

EditLevel toggles out of Play Mode to edit the level.

func (*PlayScene) FailLevel

func (s *PlayScene) FailLevel(message string)

FailLevel handles a level failure triggered by a doodad or fire pixel.

If the Survival GameRule is set, this ends the level with a note on how long the player had survived for and they get a silver rating.

func (*PlayScene) GetCheated

func (s *PlayScene) GetCheated() bool

GetCheated gives read-only access to tell if you have been cheating. However, by querying this in the dev console during gameplay, you would be marked as cheating. ;)

func (*PlayScene) GetPerfect

func (s *PlayScene) GetPerfect() bool

GetPerfect gives read-only access to the perfectRun flag.

func (*PlayScene) LoadLevel

func (s *PlayScene) LoadLevel(filename string) error

LoadLevel loads a level from disk.

If the PlayScene was called with a LevelPack, it will check there first before the usual locations.

The usual locations are: embedded bindata, ./assets folder on disk, and user content finally.

func (*PlayScene) Loop

func (s *PlayScene) Loop(d *Doodle, ev *event.State) error

Loop the editor scene.

func (*PlayScene) LoopTouchable

func (s *PlayScene) LoopTouchable(ev *event.State)

LoopTouchable is called as part of PlayScene.Loop while the simulation is running.

It looks for touch events on proportional regions of the window and emulates key input bindings to move the character, jump, etc.

TODO: this function manipulates the event.State to set Up, Down, Left, Right and Space keys and may need love for reconfigurable keybinds later.

func (*PlayScene) Name

func (s *PlayScene) Name() string

Name of the scene.

func (*PlayScene) PlaceResizeCanvas

func (s *PlayScene) PlaceResizeCanvas()

PlaceResizeCanvas updates the Canvas size and placement on the screen, e.g. if an ultra HD monitor plays a Bounded level where the entirety of a level bounds is on-screen, the drawing should be cut there and the canvas centered.

func (*PlayScene) ResetTimer

func (s *PlayScene) ResetTimer()

ResetTimer sets the level elapsed timer back to zero.

func (*PlayScene) RestartLevel

func (s *PlayScene) RestartLevel()

RestartLevel starts the level over again.

func (*PlayScene) RetryCheckpoint

func (s *PlayScene) RetryCheckpoint()

RetryCheckpoint moves the player back to their last checkpoint.

func (*PlayScene) ScriptSupervisor

func (s *PlayScene) ScriptSupervisor() *scripting.Supervisor

ScriptSupervisor returns the scripting supervisor for play mode.

func (*PlayScene) SetCheated

func (s *PlayScene) SetCheated()

SetCheated marks the level as having been cheated. The developer shell will call this if the user enters a cheat code during gameplay.

func (*PlayScene) SetCheckpoint

func (s *PlayScene) SetCheckpoint(where render.Point)

SetCheckpoint sets the player's checkpoint.

func (*PlayScene) SetImperfect

func (s *PlayScene) SetImperfect()

SetImperfect sets the perfectRun flag to false and changes the icon for the timer.

func (*PlayScene) SetPlayerCharacter

func (s *PlayScene) SetPlayerCharacter(filename string)

SetPlayerCharacter changes the doodad used for the player, by destroying the current player character and making it from scratch.

func (*PlayScene) Setup

func (s *PlayScene) Setup(d *Doodle) error

Setup the play scene.

func (*PlayScene) ShowEndLevelModal

func (s *PlayScene) ShowEndLevelModal(success bool, title, message string)

ShowEndLevelModal centralizes the EndLevel modal config. This is the common handler function between easy methods such as BeatLevel, FailLevel, and DieByFire.

type Scene

type Scene interface {
	Name() string
	Setup(*Doodle) error
	Destroy() error

	// Loop should update the scene's state but not draw anything.
	Loop(*Doodle, *event.State) error

	// Draw should use the scene's state to figure out what pixels need
	// to draw to the screen.
	Draw(*Doodle) error
}

Scene is an abstraction for a game mode in Doodle. The app points to one scene at a time and that scene has control over the main loop, and its own state information.

type Shell

type Shell struct {
	Open   bool
	Prompt string
	Repl   bool

	Text    string
	History []string
	Output  []string
	Flashes []Flash
	// contains filtered or unexported fields
}

Shell implements the developer console in-game.

func NewShell

func NewShell(d *Doodle) Shell

NewShell initializes the shell helper (the "Shellper").

func (*Shell) Close

func (s *Shell) Close()

Close the shell, resetting its internal state.

func (*Shell) Draw

func (s *Shell) Draw(d *Doodle, ev *event.State) error

Draw the shell.

func (*Shell) Execute

func (s *Shell) Execute(input string)

Execute a command in the shell.

func (*Shell) Parse

func (s *Shell) Parse(input string) Command

Parse the command line.

func (*Shell) Write

func (s *Shell) Write(line string)

Write a line of output text to the console.

func (*Shell) WriteColorful

func (s *Shell) WriteColorful(line string, color render.Color)

WriteError writes a line of error (red) text to the console.

Directories

Path Synopsis
builds
Package builds handles build-specific branding strings.
Package builds handles build-specific branding strings.
Package campaign contains types and functions for the single player campaigns.
Package campaign contains types and functions for the single player campaigns.
Package chatbot provides the RiveScript bot that lives in the developer shell.
Package chatbot provides the RiveScript bot that lives in the developer shell.
Package cursor handles custom mouse cursor sprite images.
Package cursor handles custom mouse cursor sprite images.
dummy
Package dummy implements a dummy doodads.Drawing.
Package dummy implements a dummy doodads.Drawing.
Package enum defines all the little enum types used throughout Doodle.
Package enum defines all the little enum types used throughout Doodle.
Package gamepad provides game controller logic for the game.
Package gamepad provides game controller logic for the game.
Package keybind centralizes the global hotkey bindings.
Package keybind centralizes the global hotkey bindings.
publishing
Package publishing contains functionality for "publishing" a Level, which involves the writing and reading of custom doodads embedded inside the levels.
Package publishing contains functionality for "publishing" a Level, which involves the writing and reading of custom doodads embedded inside the levels.
rle
Package rle contains support for Run-Length Encoding of level chunks.
Package rle contains support for Run-Length Encoding of level chunks.
Package levelpack handles ZIP archives for level packs.
Package levelpack handles ZIP archives for level packs.
Package modal provides UI pop-up modals for Doodle.
Package modal provides UI pop-up modals for Doodle.
loadscreen
Package loadscreen implements a modal "Loading" screen for the game, which can be shown or hidden by gameplay scenes as needed.
Package loadscreen implements a modal "Loading" screen for the game, which can be shown or hidden by gameplay scenes as needed.
Package native provides native system functions for Linux, MacOS and Windows to perform operating system-specific tasks such as open web links or native dialog boxes.
Package native provides native system functions for Linux, MacOS and Windows to perform operating system-specific tasks such as open web links or native dialog boxes.
Package pattern applies a kind of brush texture to a palette swatch.
Package pattern applies a kind of brush texture to a palette swatch.
Package plus connects the open source Doodle engine to the Doodle++ feature.
Package plus connects the open source Doodle engine to the Doodle++ feature.
bootstrap
Package bootstrap is a common import between the Doodle and Doodad programs.
Package bootstrap is a common import between the Doodle and Doodad programs.
dpp
Package scripting manages the JavaScript VMs for Doodad scripts.
Package scripting manages the JavaScript VMs for Doodad scripts.
exceptions
Package exceptions handles JavaScript errors nicely for the game.
Package exceptions handles JavaScript errors nicely for the game.
Package sound manages music and sound effects.
Package sound manages music and sound effects.
Package sprites manages miscellaneous in-game sprites.
Package sprites manages miscellaneous in-game sprites.
uix
magic-form
Package magicform helps create simple form layouts with go/ui.
Package magicform helps create simple form layouts with go/ui.
Package updater checks for updates to Doodle.
Package updater checks for updates to Doodle.
Package usercfg has functions around the user's Game Settings.
Package usercfg has functions around the user's Game Settings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL