hscommon

package
v0.0.0-...-667d129 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package hscommon provides common stuff for all of the other high-level packages in the codebase

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortPaths

func SortPaths(rootPath *PathEntry)

SortPaths sorts paths

Types

type EditorWindow

type EditorWindow interface {
	Renderable
	MainMenuUpdater

	// HasFocus returns true if editor is focused
	HasFocus() (hasFocus bool)
	// GetWindowTitle controls what the window title for this editor appears as
	GetWindowTitle() string
	// Show sets Visible to true
	Show()
	// SetVisible can be used to set Visible to false if the editor should be closed
	SetVisible(bool)
	// GetID returns a unique identifier for this editor window
	GetID() string
	// BringToFront brings this editor to the front of the application, giving it focus
	BringToFront()
	// State returns the current state of this editor, in a JSON-serializable struct
	State() hsstate.EditorState
	// Save writes any changes made in the editor to the file that is open in the editor.
	Save()

	Size(float32, float32) *giu.WindowWidget
}

EditorWindow represents editor window

type MainMenuUpdater interface {
	// UpdateMainMenuLayout receives a pointer to the current layout of the menu bar at the top of the application,
	// allowing a struct implementing this interface to alter the menu bar.
	// This is generally used for adding a menu to the bar specific to the struct implementing this method, with options
	// that would be useful for that struct.
	UpdateMainMenuLayout(layout *giu.Layout)
}

MainMenuUpdater represents main menu updater

type PathEntry

type PathEntry struct {
	// Children represents child files/folders inside a folder.
	Children []*PathEntry `json:"children"`

	// Name is the visible name of the path entry.
	Name string `json:"name"`

	// FullPath is the actual path of the entry (filesystem, or mpq relative).
	FullPath string `json:"fullPath"`

	// IsDirectory is true when this path represents a directory.
	IsDirectory bool `json:"isDirectory"`

	// IsRoot is true When this path represents the root path (the project node).
	IsRoot bool `json:"isRoot"`

	// IsRenaming is true when this path is currently being renamed in a tree view.
	IsRenaming bool `json:"isRenaming"`

	// OldName is the value of the path's Name before renaming started.
	// If renaming has not started, this value should be blank.
	OldName string `json:"oldMame"`

	// PathEntrySource is the type of path entry this is (MPQ or Filesystem).
	Source PathEntrySource `json:"source"`

	// MPQFile represents the full path to the MPQ that contains this file (if this is an MPQ path).
	MPQFile string `json:"mpqFile"`
}

PathEntry defines a file/folder

func (*PathEntry) GetFileBytes

func (p *PathEntry) GetFileBytes() ([]byte, error)

GetFileBytes reads the file and returns the contents

func (*PathEntry) GetUniqueID

func (p *PathEntry) GetUniqueID() string

GetUniqueID returns path's ID

func (*PathEntry) WriteFile

func (p *PathEntry) WriteFile(data []byte) error

WriteFile overwrites the file with the given data

type PathEntrySource

type PathEntrySource int

PathEntrySource represents the type of path entry.

const (
	// PathEntrySourceMPQ represents a PathEntry that is relative to a specific MPQ.
	PathEntrySourceMPQ PathEntrySource = iota

	// PathEntrySourceProject represents a PathEntry that is relative to the project.
	PathEntrySourceProject

	// PathEntryVirtual represents a PathEntry that is based on the composite view of
	// the project directory and all MPQs (Project first, then MPQs based on load order).
	PathEntryVirtual
)

type Renderable

type Renderable interface {
	Build()
	Cleanup()
	// KeyboardShortcuts returns a list of keyboard shortcuts
	KeyboardShortcuts() []giu.WindowShortcut
	IsVisible() bool
	// RegisterKeyboardShortcuts wraps giu.RegisterKeyboardShortcuts
	RegisterKeyboardShortcuts(...giu.WindowShortcut)
}

Renderable represents renderable objects

type TextureLoadRequestItem

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

TextureLoadRequestItem represents texture request item

type TextureLoader

type TextureLoader interface {
	// controls
	StopLoadingTextures()
	ResumeLoadingTextures()
	ProcessTextureLoadRequests()

	// creators
	CreateTextureFromARGB(*image.RGBA, func(*g.Texture))
	CreateTextureFromFile([]byte, func(*g.Texture))
}

TextureLoader represents a texture loader

func NewTextureLoader

func NewTextureLoader() TextureLoader

NewTextureLoader creates a new texture loader

type ToolWindow

type ToolWindow interface {
	Renderable

	HasFocus() (hasFocus bool)
	Show()
	SetVisible(bool)
	BringToFront()
	State() hsstate.ToolWindowState
	Pos(x, y float32) *giu.WindowWidget
	Size(float32, float32) *giu.WindowWidget
	CurrentSize() (float32, float32)
}

ToolWindow represents tool windows

Directories

Path Synopsis
Package hsenum provides enumerations used throughout the HellSpawner codebase.
Package hsenum provides enumerations used throughout the HellSpawner codebase.
Package hsfiletypes provides utilities for determining the type of a file.
Package hsfiletypes provides utilities for determining the type of a file.
hsfont
Package hsfont contains data for font file types
Package hsfont contains data for font file types
Package hsnode contains an implementation of a node graph, as parent and child nodes.
Package hsnode contains an implementation of a node graph, as parent and child nodes.
Package hsproject contains Hellspawner's Project implementation
Package hsproject contains Hellspawner's Project implementation
Package hsstate contains structs that describe the state of the application.
Package hsstate contains structs that describe the state of the application.
Package hsutil holds utility and helper functions
Package hsutil holds utility and helper functions

Jump to

Keyboard shortcuts

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