Package arc.backend.headless
Class HeadlessApplication
java.lang.Object
arc.backend.headless.HeadlessApplication
- All Implemented Interfaces:
Application,Disposable
a headless implementation of an application primarily intended to be used in servers
-
Nested Class Summary
Nested classes/interfaces inherited from interface arc.Application
Application.ApplicationType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Seq<ApplicationListener>protected Threadprotected longprotected final TaskQueueprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionHeadlessApplication(ApplicationListener listener) HeadlessApplication(ApplicationListener listener, float renderIntervalSec, Cons<Throwable> exceptionHandler) HeadlessApplication(ApplicationListener listener, Cons<Throwable> exceptionHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoidexit()Schedule an exit from the application.floatlongReturns the id of the current frame.intReturns a list of all the application listeners used.getType()voidprotected voidvoidPosts a runnable on the main loop thread.voidsetClipboardText(String text) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface arc.Application
addListener, defaultUpdate, dispose, getDnsServers, getJavaHeap, getNativeHeap, getVersion, isAndroid, isDesktop, isHeadless, isIOS, isMobile, isOnMainThread, isWeb, openFolder, openURI, removeListenerMethods inherited from interface arc.util.Disposable
isDisposed
-
Field Details
-
listeners
-
runnables
-
exceptionHandler
-
renderInterval
protected long renderInterval -
mainLoopThread
-
running
protected boolean running
-
-
Constructor Details
-
HeadlessApplication
-
HeadlessApplication
-
HeadlessApplication
public HeadlessApplication(ApplicationListener listener, float renderIntervalSec, Cons<Throwable> exceptionHandler)
-
-
Method Details
-
initialize
protected void initialize() -
updateTime
public void updateTime() -
incrementFrameId
public void incrementFrameId() -
getFrameId
public long getFrameId()Description copied from interface:ApplicationReturns the id of the current frame. The general contract of this method is that the id is incremented only when the application is in the running state right before calling theApplicationListener.update()method. Also, the id of the first frame is 0; the id of subsequent frames is guaranteed to take increasing values for 263-1 rendering cycles.- Specified by:
getFrameIdin interfaceApplication- Returns:
- the id of the current frame
-
getDeltaTime
public float getDeltaTime()- Specified by:
getDeltaTimein interfaceApplication- Returns:
- the time span between the current frame and the last frame in seconds. Might be smoothed over n frames.
-
getFramesPerSecond
public int getFramesPerSecond()- Specified by:
getFramesPerSecondin interfaceApplication- Returns:
- the average number of frames per second
-
getMainThread
- Specified by:
getMainThreadin interfaceApplication- Returns:
- the main graphics thread, upon which all ApplicationListener methods are called. May return null if not initialized.
-
getType
- Specified by:
getTypein interfaceApplication- Returns:
- what
Application.ApplicationTypethis application has, e.g. Android or Desktop
-
getClipboardText
- Specified by:
getClipboardTextin interfaceApplication
-
setClipboardText
- Specified by:
setClipboardTextin interfaceApplication
-
getListeners
Description copied from interface:ApplicationReturns a list of all the application listeners used.- Specified by:
getListenersin interfaceApplication
-
post
Description copied from interface:ApplicationPosts a runnable on the main loop thread.- Specified by:
postin interfaceApplication
-
exit
public void exit()Description copied from interface:ApplicationSchedule an exit from the application. On android, this will cause a call to pause() and dispose() some time in the future, it will not immediately finish your application. On iOS this should be avoided in production as it breaks Apples guidelines.- Specified by:
exitin interfaceApplication
-