windows

package
v0.0.0-...-79996cc Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenericScripts = []struct {
	Label    string
	Help     string
	Filename string
	SetTags  map[string]string
}{
	{
		Label: "Generic Solid",
		Help: "The whole canvas of your doodad acts solid.\n" +
			"The player and other mobile doodads can walk on\n" +
			"top of it, and it blocks movement from the sides.",
		Filename: "assets/scripts/generic-solid.js",
	},
	{
		Label: "Generic Fire",
		Help: "The whole canvas of your doodad acts like fire.\n" +
			"Mobile doodads who touch it turn dark, and if\n" +
			"the player touches it - game over! The failure\n" +
			"message says: 'Watch out for (title)!'",
		Filename: "assets/scripts/generic-fire.js",
	},
	{
		Label: "Generic Anvil",
		Help: "This doodad will behave like the Anvil: fall with\n" +
			"gravity and be deadly to any mobile doodad that it\n" +
			"lands on! The failure message says:\n" +
			"'Watch out for (title)!'",
		Filename: "assets/scripts/generic-anvil.js",
	},
	{
		Label: "Generic Collectible Item",
		Help: "This doodad will behave like a pocketable item, like\n" +
			"the Keys. Tip: set a Doodad tag like quantity=0 to set\n" +
			"the item quantity when picked up (default is 1).",
		Filename: "assets/scripts/generic-item.js",
		SetTags: map[string]string{
			"quantity": "1",
		},
	},
}

Some generic built-in doodad scripts users can attach.

Functions

func MakeCheatsMenu

func MakeCheatsMenu(cfg CheatsMenu) *ui.Window

MakeCheatsMenu initializes a settings window for any scene. The window width/height are the actual SDL2 window dimensions.

func MakeLicenseWindow

func MakeLicenseWindow(windowWidth, windowHeight int, cfg License) *ui.Window

MakeLicenseWindow initializes a license window for any scene. The window width/height are the actual SDL2 window dimensions.

func MakePiPWindow

func MakePiPWindow(windowWidth, windowHeight int, cfg PiP) *ui.Window

MakePiPWindow initializes a license window for any scene. The window width/height are the actual SDL2 window dimensions.

func MakeSettingsWindow

func MakeSettingsWindow(windowWidth, windowHeight int, cfg Settings) *ui.Window

MakeSettingsWindow initializes a settings window for any scene. The window width/height are the actual SDL2 window dimensions.

func NewAboutWindow

func NewAboutWindow(cfg About) *ui.Window

NewAboutWindow initializes the window.

func NewAddEditLevel

func NewAddEditLevel(config AddEditLevel) *ui.Window

NewAddEditLevel initializes the window.

func NewCheatsWindow

func NewCheatsWindow(cfg CheatsMenu) *ui.Window

NewCheatsWindow initializes the window.

func NewDoodadConfigWindow

func NewDoodadConfigWindow(cfg *DoodadConfig) *ui.Window

NewSettingsWindow initializes the window.

func NewDoodadDropper

func NewDoodadDropper(config DoodadDropper) *ui.Window

NewDoodadDropper initializes the window.

func NewDoodadPropertiesWindow

func NewDoodadPropertiesWindow(cfg *DoodadProperties) *ui.Window

NewSettingsWindow initializes the window.

func NewFileSystemWindow

func NewFileSystemWindow(cfg FileSystem) *ui.Window

NewFileSystemWindow initializes the window.

func NewLayerWindow

func NewLayerWindow(config Layers) *ui.Window

NewLayerWindow initializes the window.

func NewLevelPackWindow

func NewLevelPackWindow(config LevelPack) *ui.Window

NewLevelPackWindow initializes the window.

func NewLicenseWindow

func NewLicenseWindow(cfg License) *ui.Window

NewLicenseWindow initializes the window.

func NewOpenDrawingWindow

func NewOpenDrawingWindow(config OpenDrawing) *ui.Window

NewOpenDrawingWindow initializes the window.

func NewOpenLevelEditor

func NewOpenLevelEditor(config OpenLevelEditor) *ui.Window

NewOpenLevelEditor initializes the window.

func NewPaletteEditor

func NewPaletteEditor(config PaletteEditor) *ui.Window

NewPaletteEditor initializes the window.

func NewPiPWindow

func NewPiPWindow(cfg PiP) *ui.Window

NewPiPWindow initializes the window.

func NewPublishWindow

func NewPublishWindow(cfg Publish) *ui.Window

NewPublishWindow initializes the window.

func NewSettingsWindow

func NewSettingsWindow(cfg Settings) *ui.Window

NewSettingsWindow initializes the window.

func NewTextToolWindow

func NewTextToolWindow(cfg TextTool) *ui.Window

NewTextToolWindow initializes the window.

Types

type About

type About struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine
}

About window.

type AddEditLevel

type AddEditLevel struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Editing settings for an existing level?
	EditLevel *level.Level

	// Show the "New Doodad" tab by default?
	NewDoodad bool

	// Callback functions.
	OnChangePageTypeAndWallpaper func(pageType level.PageType, wallpaper string)
	OnCreateNewLevel             func(*level.Level)
	OnCreateNewDoodad            func(width, height int)
	OnReload                     func()
	OnCancel                     func()
}

AddEditLevel is the "Create New Level & Edit Level Properties" window

type CheatsMenu

type CheatsMenu struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// SceneName: the caller will provide a fresh SceneName since
	// the cheats window could span multiple scenes.
	SceneName func() string

	// Window wants to run a developer shell command (e.g. cheat codes).
	RunCommand           func(string)
	OnSetPlayerCharacter func(string)
}

CheatsMenu window.

type DoodadConfig

type DoodadConfig struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Configuration options.
	EditActor *uix.Actor
	ActiveTab string // specify the tab to open
	OnRefresh func() // caller should rebuild the window

	// Widgets.
	TabFrame *ui.TabFrame
}

DoodadConfig window is what pops up in Edit Mode when you mouse over an actor and click its properties button.

type DoodadDropper

type DoodadDropper struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Editing settings for an existing level?
	EditLevel *level.Level

	// Callback functions.
	OnStartDragActor func(doodad *doodads.Doodad, actor *level.Actor)
	OnCancel         func()
}

DoodadDropper is the doodad palette pop-up window for Editor Mode.

type DoodadProperties

type DoodadProperties struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Configuration options.
	EditDoodad *doodads.Doodad
	ActiveTab  string // specify the tab to open
	OnRefresh  func() // caller should rebuild the window

	// Widgets.
	TabFrame *ui.TabFrame
}

DoodadProperties window.

type FileSystem

type FileSystem struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine
	Level      *level.Level

	OnDelete func(filename string) bool
	OnCancel func()
	// contains filtered or unexported fields
}

FileSystem window shows the file attachments to the current level.

type Layers

type Layers struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Pointer to the currently edited level.
	EditDoodad  *doodads.Doodad
	ActiveLayer int // pointer to selected layer

	// Callback functions.
	OnChange   func(*doodads.Doodad) // Doodad data was modified, reload the Canvas etc.
	OnAddLayer func()                // "Add Layer" button was clicked
	OnCancel   func()                // Close button was clicked.

	// Editor should change the active layer
	OnChangeLayer func(index int)
	// contains filtered or unexported fields
}

Layers shows the layers when editing a doodad file.

type LevelPack

type LevelPack struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Callback functions.
	OnPlayLevel   func(pack *levelpack.LevelPack, level levelpack.Level)
	OnCloseWindow func()
	// contains filtered or unexported fields
}

LevelPack window lets the user open and play a level from a pack.

type License

type License struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine

	OnLicensed func()
	OnCancel   func()
}

License window.

type OpenDrawing

type OpenDrawing struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine
	LevelsOnly bool

	// Callback functions.
	OnOpenDrawing func(filename string)
	OnCloseWindow func()
	// contains filtered or unexported fields
}

OpenDrawing window lets the user open a drawing or play a user level.

type OpenLevelEditor

type OpenLevelEditor struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Load it for playing instead of editing?
	LoadForPlay bool

	// Callback functions.
	OnPlayLevel func(filename string)
	OnEditLevel func(filename string)
	OnCancel    func()
}

OpenLevelEditor is the "Open a Level to Edit It" window

DEPRECATED: in favor of OpenDrawing which has a nicer listbox instead of the ugly button grid of this window.

You can invoke this old window by the shell commands `$ d.GotoPlayMenu()` or `$ d.GotoLoadMenu()`

type PaletteEditor

type PaletteEditor struct {
	Supervisor *ui.Supervisor
	Engine     render.Engine
	IsDoodad   bool // you're editing a doodad instead of a level?

	// Pointer to the currently edited palette, be it
	// from a level or a doodad.
	EditPalette *level.Palette

	// Callback functions.
	OnChange   func()
	OnAddColor func()
	OnCancel   func()
}

PaletteEditor lets you customize the level palette in Edit Mode.

type PiP

type PiP struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine
	Level      *level.Level
	Event      *event.State
	Tool       *drawtool.Tool
	BrushSize  *int

	// Or sensible defaults:
	Width  int
	Height int

	OnCancel func()
}

PiP window.

type Publish

type Publish struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine
	Level      *level.Level

	OnPublish func(builtinToo bool)
	OnCancel  func()
	// contains filtered or unexported fields
}

Publish window.

type SetTextable

type SetTextable interface {
	SetText(string) error
}

SetTextable is a Button or Checkbox widget having a SetText function, to support the reset button on the Doodad Options tab.

type Settings

type Settings struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Boolean bindings.
	DebugOverlay       *bool
	DebugCollision     *bool
	HorizontalToolbars *bool
	EnableFeatures     *bool
	CrosshairSize      *int
	CrosshairColor     *render.Color
	HideTouchHints     *bool
	DisableAutosave    *bool
	ControllerStyle    *int

	// Configuration options.
	SceneName          string // name of scene which called this window
	ActiveTab          string // specify the tab to open
	OnApply            func()
	OnOpenCheatsWindow func() *ui.Window // user opens the Cheats Menu
	// contains filtered or unexported fields
}

Settings window.

type TextTool

type TextTool struct {
	// Settings passed in by doodle
	Supervisor *ui.Supervisor
	Engine     render.Engine

	// Callback when font settings are changed.
	OnChangeSettings func(font string, size int, message string)
}

TextTool window.

Jump to

Keyboard shortcuts

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