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

/* {"description" : "FlowEvent describes an input event."} */
data FlowEvent {
	/* {"@description" : "An event type meaning that the window has been closed and the system should exit."} */
	const int T_QUIT = 1
	/* {"@description" : "An event type meaning that one of the W_ constants is applied to the subType field."} */
	const int T_WINDOW = 2
	/* {"@description" : "An event type meaning that one of the M_ constants is applied to the subType field."} */
	const int T_MOUSE = 3
	/* {"@description" : "An event type meaning that one of the K_ constants is applied to the subType field."} */
	const int T_KEYBOARD = 4
	/* {"@description" : "A possible value of subType, indicating a window resize event. dataInt1 is set to the new width, and dataInt2 to the new height."} */
	const int W_RESIZE = 1
	/* {"@description" : "A possible value of subType, indicating a window move event. dataInt1 is set to the new x-position, and dataInt2 to the new y-position."} */
	const int W_MOVE = 2
	/* {"@description" : "A possible value of subType, indicating a mouse button down event. dataInt1 is set to the button ID, dataInt2 to the x-position of the cursor, and dataInt3 to the y-position of the cursor."} */
	const int M_DOWN = 1
	/* {"@description" : "A possible value of subType, indicating a mouse button up event. dataInt1 is set to the button ID, dataInt2 to the x-position of the cursor, and dataInt3 to the y-position of the cursor."} */
	const int M_UP = 2
	/* {"@description" : "A possible value of subType, indicating a mouse cursor move event. dataInt1 is set to the x-position of the cursor, and dataInt2 to the y-position of the cursor."} */
	const int M_MOVE = 3
	/* {"@description" : "A possible value of subType, indicating a mouse wheel move event. dataInt1 is set to the volume of negative movement on the x-axis, dataInt2 is set to the volume of positive movement on the x-axis, dataInt3 is set to the volume of negative movement on the y-axis, and dataInt4 is set to the volume of positive movement on the y-axis."} */
	const int M_WHEEL = 4
	/* {"@description" : "A possible value of subType, indicating a key down event. dataInt1 is set to the key code of the associated key."} */
	const int K_DOWN = 1
	/* {"@description" : "A possible value of subType, indicating a key up event. dataInt1 is set to the key code of the associated key."} */
	const int K_UP = 2
	/* {"@description" : "The event type, from one of the T_ constants."} */
	int4 type
	/* {"@description" : "subType is set to a value drawn from the constants available in the specific event type."} */
	int4 subType
	/* {"@description" : "This field's value is set depending on the type/subType combination of the event."} */
	int4 dataInt1
	/* {"@description" : "This field's value is set depending on the type/subType combination of the event."} */
	int4 dataInt2
	/* {"@description" : "This field's value is set depending on the type/subType combination of the event."} */
	int4 dataInt3
	/* {"@description" : "This field's value is set depending on the type/subType combination of the event."} */
	int4 dataInt4
}

//NOTE: deprecated
data WindowEvent {
	int4 type
	const int S_RESIZE = 1
	const int S_MOVE = 2
	int4 subType
}

//NOTE: deprecated
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
}

//NOTE: deprecated
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 {

	/* {"@description" : "A value for setCursor() to select the system-default mouse cursor."} */
	const byte CURSOR_DEFAULT = 0
	/* {"@description" : "A value for setCursor() to hide the mouse cursor."} */
	const byte CURSOR_HIDDEN = 1
	/* {"@description" : "A value for setCursor() to select a custom mouse cursor, alongside a pixel map."} */
	const byte CURSOR_CUSTOM = 2
	/* {"@description" : "A value for setCursor() to select an I-beam (often used in text areas)."} */
	const byte CURSOR_IBEAM = 3
	/* {"@description" : "A value for setCursor() to select a hand."} */
	const byte CURSOR_HAND = 4
	/* {"@description" : "A value for setCursor() to select a 'wait for something' cursor."} */
	const byte CURSOR_WAIT = 5
	/* {"@description" : "A value for setCursor() to select a north-south arrow."} */
	const byte CURSOR_SIZENS = 6
	/* {"@description" : "A value for setCursor() to select a west-east arrow."} */
	const byte CURSOR_SIZEWE = 7
	/* {"@description" : "A value for setCursor() to select a north-west-south-east arrow."} */
	const byte CURSOR_SIZENWSE = 8
	/* {"@description" : "A value for setCursor() to select a north-east-south-west arrow."} */
	const byte CURSOR_SIZENESW = 9
	/* {"@description" : "A value for setCursor() to select an every-direction arrow."} */
	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, from one of the CURSOR_ constants."} */
	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 (this version) by barry
Notes for this version: Updates to documentation strings.
Version 2 by barry
Version 1 by barry