HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file ui.FlowRender by barry
expand ↦copy to clipboardexpand ↧
uses Rect2D
uses Line2D
uses Color
uses Point2D
uses media.PixelMap
uses media.WH
uses FlowFont
uses Rect
uses Point
uses Cursor

data FlowEvent {
	const int T_QUIT = 1
	const int T_WINDOW = 2
	const int T_MOUSE = 3
	const int T_KEYBOARD = 4
	int4 type
	int4 subType
	int4 dataInt1
	int4 dataInt2
	int4 dataInt3
	int4 dataInt4
}

data WindowEvent {
	int4 type
	const int S_RESIZE = 1
	const int S_MOVE = 2
	int4 subType
}

data MouseEvent {
	int4 type
	const int S_DOWN = 1
	const int S_UP = 2
	const int S_MOVE = 3
	const int S_WHEEL = 4
	int4 subType
}

data KeyEvent {
	int4 type
	const int S_DOWN = 1
	const int S_UP = 2
	int4 subType
}

/*
 {"description" : "FlowRender is a direct rendering API, generally used by applications such as video games. All of the functions in this API must only be called from the main thread of your program."}
*/

interface FlowRender {

	const byte CURSOR_DEFAULT = 0
	const byte CURSOR_HIDDEN = 1
	const byte CURSOR_CUSTOM = 2
	const byte CURSOR_IBEAM = 3
	const byte CURSOR_HAND = 4
	const byte CURSOR_WAIT = 5
	const byte CURSOR_SIZENS = 6
	const byte CURSOR_SIZEWE = 7
	const byte CURSOR_SIZENWSE = 8
	const byte CURSOR_SIZENESW = 9
	const byte CURSOR_SIZEALL = 10
	
	/* {"@description" : "Initialise a new direct rendering window, optionally specifying a target framerate."} */
	FlowRender(opt int framerate)

	/* {"@description" : "Get the input events which have arrived since this function was last called."} */
	FlowEvent[] getEvents()
	
	/* {"@description" : "Hide/show the window."} */
	void setVisible(bool v)
	
	/* {"@description" : "Set the window as user-resizeable or not."} */
	void setResizable(bool v)
	
	/* {"@description" : "Set the window as full-screen or not."} */
	void setFullScreen(bool v)
	
	/* {"@description" : "Set the title of the window."} */
	void setTitle(char title[])
	
	/* {"@description" : "Set the image used for the icon of the window."} */
	void setIcon(store PixelMap p)
	
	/* {"@description" : "Set the x/y position of the window on the screen."} */
	void setPosition(int x, int y)
	
	/* {"@description" : "Set the width and height of the window."} */
	void setSize(int w, int h)
	
	/* {"@description" : "Set the current mouse cursor of the window."} */
	void setCursor(byte cursorType, opt Cursor c)
	
	/* {"@description" : "Get the screen resolution of the display on which the window resides."} */
	WH getResolution()
	
	/* {"@description" : "Get the window's rendered content as a pixel map."} */
	PixelMap getPixels(opt byte pixelFormat)
	
	/* {"@description" : "Close the window (other functions on this API will not work after this)."} */
	void close()

	/* {"@description" : "Begin a new render sequence to draw a scene. Call renderEnd() to finish that scene and present it."} */
	void renderBegin()

	/* {"@description" : "Finish a render sequence to present a scene to the viewer."} */
	void renderEnd()

	/* {"@description" : "Wait for framerate synch, if a particular framerate was configured on instantiation of the renderer."} */
	void wait()

	/* {"@description" : "Get the native pixel format of the renderer which underpins this window."} */
	byte getPixelFormat()
	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n ui.FlowRender -m "reason for update" -u yourUsername
Version 3 by barry
Version 2 (this version) by barry
Notes for this version: Improves performance of reading pixels from a window and surfaces in Flow mode, and supports reading pixels using different pixel formats
Version 1 by barry