NFEditor

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed Templates/*/*
	Templates            embed.FS
	ActiveProject        Project
	ActiveLayouts        []NFLayout.Layout
	ActiveWidgets        []NFWidget.Widget
	ActiveSceneGroups    map[string]NFScene.Scene
	ActiveFunctions      []NFFunction.Function // Ungrouped functions
	ActiveFunctionGroups map[string][]NFFunction.Function
)
View Source
var MainMenuSceneTemplate = NFScene.Scene{
	Name: "MainMenu",
	Layout: NFLayout.Layout{
		Type: "VBox",
		Children: []NFWidget.Widget{
			{
				Type: "Label",
				Properties: map[string]interface{}{
					"Text": "Main Menu",
				},
			},
			{
				Type: "Button",
				Properties: map[string]interface{}{
					"Text":   "New Game",
					"Action": "NewGame",
				},
			},
			{
				Type: "Button",
				Properties: map[string]interface{}{
					"Text":   "Load Game",
					"Action": "LoadGame",
				},
			},
			{
				Type: "Button",
				Properties: map[string]interface{}{
					"Text":   "Settings",
					"Action": "Settings",
				},
			},
			{
				Type: "Button",
				Properties: map[string]interface{}{
					"Text":   "Quit",
					"Action": "Quit",
				},
			},
		},
	},
	Properties: nil,
}
View Source
var NewGameSceneTemplate = NFScene.Scene{
	Name: "NewGame",
	Layout: NFLayout.Layout{
		Type: "VBox",
	},
}

Functions

func CheckAndInstallDependencies added in v0.0.4

func CheckAndInstallDependencies(window fyne.Window)

func CreateMainMenu

func CreateMainMenu(window fyne.Window)

func CreateSceneEditor added in v0.0.4

func CreateSceneEditor(window fyne.Window) fyne.CanvasObject

func NewProjectDialog

func NewProjectDialog(window fyne.Window)

func OpenFromInfo added in v0.0.4

func OpenFromInfo(info ProjectInfo, window fyne.Window) error

func OpenProjectDialog

func OpenProjectDialog(window fyne.Window)

func OpenRecentDialog

func OpenRecentDialog(window fyne.Window)

func SanitizeProjectName added in v0.0.4

func SanitizeProjectName(name string) (bool, error)

SanitizeProjectName sanitizes the project name to ensure it's a valid Go identifier

Types

type Project added in v0.0.4

type Project struct {
	GameName string `json:"Game Name"`
	Version  string `json:"Version"`
	Author   string `json:"Author"`
	Credits  string `json:"Credits"`
}

func Deserialize added in v0.0.4

func Deserialize(file []byte) (Project, error)

func (Project) Create added in v0.0.4

func (p Project) Create(window fyne.Window) error

func (Project) Load added in v0.0.4

func (p Project) Load(window fyne.Window, info ...ProjectInfo) error

Load takes a deserialized project and loads it into the editor loading the scenes and functions as well

func (Project) Serialize added in v0.0.4

func (p Project) Serialize() []byte

func (Project) UpdateProjectInfo added in v0.0.4

func (p Project) UpdateProjectInfo(info ProjectInfo) error

type ProjectInfo added in v0.0.4

type ProjectInfo struct {
	Name     string    `json:"Name"`
	Path     string    `json:"Path"`
	OpenDate time.Time `json:"Last Opened"`
}

func ReadProjectInfo added in v0.0.4

func ReadProjectInfo() ([]ProjectInfo, error)

ReadProjectInfo reads the project info from the project file

Directories

Path Synopsis
Templates

Jump to

Keyboard shortcuts

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