Documentation
¶
Overview ¶
Package frontend provides interface for platform-specific code.
Index ¶
Constants ¶
View Source
const ( CallbackContextChange = -100 - iota CallbackMouseDown CallbackKeyDown CallbackMouseUp CallbackAppHide CallbackAppShow CallbackMouseMove CallbackMouseScroll CallbackTouchDown CallbackTouchUp CallbackTouchMove CallbackReady CallbackKeyUp CallbackTextInput CallbackOrientationChange CallbackStop )
View Source
const ( MessageExit = iota MessageExec MessageTitle MessageEngineStopped MessageSetStandardCursor )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Name string `yaml:"name"` Author string `yaml:"author"` CompanyDomain string `yaml:"companyDomain"` PublicUrl string `yaml:"publicUrl"` Frontend string `yaml:"frontend"` Debug bool `yaml:"debug"` MainScene string `yaml:"mainScene"` LaunchArgs map[string]interface{} `yaml:"launchArgs"` HostOS string `yaml:"hostOS"` }
type Context ¶
type Context struct { DeviceInfo common.DeviceInfo ScreenInfo common.ScreenInfo Domain string Host string Port string }
type Frontend ¶
type Frontend interface { //Init is called when the frontend is created. Init() //Run is like the main function for the frontend. Run() SetEngineDispatcher(disp dispatch.MessageDispatcher) //GetRenderer should return a fully configured ARenderer. Must be deterministic. GetRenderer() *rendering.ARenderer //GetContext should return the Context. It is called by the engine whenever the frontend sends CallbackContextChange. GetContext() Context //GetPlatform should return the current Platform. GetPlatform() common.Platform //CommencePanic should indicate in a native way, that an error has occurred in either the app or the engine. CommencePanic(reason, msg string) GetMessageDispatcher() dispatch.MessageDispatcher GetWorkDispatcher() dispatch.WorkDispatcher //GetResourceManager should return an implementation of ResourceManager interface. GetResourceManager() ResourceManager //GetApp should return the app data from app.yaml file. GetApp() *App //GetLaunchArgs should return arguments. GetLaunchArgs() a.SiMap }
Frontend interface defines functions that should be implemented in an Amphion frontend natively. It defines the way engine and frontend will communicate.
type ResourceManager ¶
type ResourceManager interface { RegisterResource(path string) IdOf(path string) a.ResId PathOf(id a.ResId) string FullPathOf(id a.ResId) string ReadFile(id a.ResId) ([]byte, error) }
ResourceManager defines interface, that should be implemented in the frontend to provide functionality of working with files in res folder.
type ResourceManagerImpl ¶ added in v0.2.0
type ResourceManagerImpl struct {
// contains filtered or unexported fields
}
func NewResourceManagerImpl ¶ added in v0.2.0
func NewResourceManagerImpl() *ResourceManagerImpl
func (*ResourceManagerImpl) FullPathOf ¶ added in v0.2.0
func (r *ResourceManagerImpl) FullPathOf(id a.ResId) string
func (*ResourceManagerImpl) IdOf ¶ added in v0.2.0
func (r *ResourceManagerImpl) IdOf(path string) a.ResId
func (*ResourceManagerImpl) PathOf ¶ added in v0.2.0
func (r *ResourceManagerImpl) PathOf(id a.ResId) string
func (*ResourceManagerImpl) RegisterResource ¶ added in v0.2.0
func (r *ResourceManagerImpl) RegisterResource(path string)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.