C# Класс AntTweakBar.Tw

A low-level wrapper to the AntTweakBar API.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddButton ( IntPtr bar, String name, ButtonCallback callback, IntPtr clientData, String def ) : void

This function adds a button entry to a tweak bar. When the button is clicked by a user, the callback function provided to this function is called.

AddSeparator ( IntPtr bar, String name, String def ) : void

This function adds a horizontal separator line to a tweak bar. It may be useful if one wants to separate several sets of variables inside a same group.

AddVarCB ( IntPtr bar, String name, VariableType type, SetVarCallback setCallback, GetVarCallback getCallback, IntPtr clientData, String def ) : void

This function adds a new variable to a tweak bar by providing CallBack (CB) functions to access it.

AddVarRO ( IntPtr bar, String name, VariableType type, IntPtr var, String def ) : void

This function adds a new variable to a tweak bar by specifying the variable’s pointer. The variable is declared Read-Only (RO), so it could not be modified interactively by the user.

AddVarRW ( IntPtr bar, String name, VariableType type, IntPtr var, String def ) : void

This function adds a new variable to a tweak bar by specifying the variable’s pointer. The variable is declared Read-Write (RW), so it could be modified interactively by the user.

Define ( String def ) : void

This function defines optional parameters for tweak bars and variables. For instance, it allows you to change the color of a tweak bar, to set a min and a max value for a variable, to add an help message that inform users of the meaning of a variable, and so on...

DefineEnum ( String name, String>.IDictionary labels ) : VariableType

This function creates a new variable type corresponding to an enum.

DefineEnumFromString ( String name, String enumString ) : VariableType

This function creates a new variable type corresponding to an enum.

DefineStruct ( String name, StructMemberInfo>.IDictionary structMembers, int structSize, Tw callback, IntPtr clientData ) : VariableType

This function creates a new AntTweakBar.Tw.VariableType corresponding to a structure.

DeleteAllBars ( ) : void

Delete all bars previously created by AntTweakBar.Tw.NewBar.

DeleteBar ( IntPtr bar ) : void

This function deletes a tweak bar previously created by AntTweakBar.Tw.NewBar.

Draw ( ) : void

Draws all the created tweak bars. This function must be called once per frame, after all the other drawing calls and just before the application presents (swaps) the frame buffer.

EventSDL ( IntPtr sdlEvent, byte majorVersion, byte minorVersion ) : bool

The SDL event handler.

EventSFML ( IntPtr sfmlEvent, byte majorVersion, byte minorVersion ) : bool

The SFML event handler.

EventWin ( IntPtr wnd, int msg, IntPtr wParam, IntPtr lParam ) : bool

The Windows event handler.

EventX11 ( IntPtr xEvent ) : bool

The X11 event handler.

GetBarByIndex ( int barIndex ) : IntPtr

Returns the bar of a given index.

GetBarByName ( String barName ) : IntPtr

Returns the bar of a given name.

GetBarCount ( ) : int

Returns the number of created bars.

GetBarName ( IntPtr bar ) : String

Returns the name of a given tweak bar.

GetBooleanParam ( IntPtr bar, String varName, String paramName ) : System.Boolean

This function returns the current value of a bar or variable parameter.

GetBottomBar ( ) : IntPtr

Returns the identifier of the current background bar (the bar displayed behind the others).

GetColorParam ( IntPtr bar, String varName, String paramName ) : Color

This function returns the current value of a bar or variable parameter.

GetCurrentWindow ( ) : int

Returns the current window context identifier previously set by AntTweakBar.Tw.SetCurrentWindow.

GetDoubleParam ( IntPtr bar, String varName, String paramName, int paramCount ) : Double[]

This function returns the current value of a bar or variable parameter.

GetIntParam ( IntPtr bar, String varName, String paramName, int paramCount ) : System.Int32[]

This function returns the current value of a bar or variable parameter.

GetLastError ( ) : String

Returns the last error that has occured during a previous AntTweakBar function call.

GetPointParam ( IntPtr bar, String varName, String paramName ) : Point

This function returns the current value of a bar or variable parameter.

GetSingleParam ( IntPtr bar, String varName, String paramName, int paramCount ) : System.Single[]

This function returns the current value of a bar or variable parameter.

GetSizeParam ( IntPtr bar, String varName, String paramName ) : Size

This function returns the current value of a bar or variable parameter.

GetStringParam ( IntPtr bar, String varName, String paramName ) : String

This function returns the current value of a bar or variable parameter.

GetTopBar ( ) : IntPtr

Returns the identifier of the current foreground bar (the bar displayed on top of the others).

Init ( GraphicsAPI graphicsAPI, IntPtr device ) : void

This function initializes the AntTweakBar library. It must be called once at the beginning of the program, just after graphic mode is initialized.

KeyPressed ( Tw key, KeyModifiers modifiers ) : bool

Call this function to inform AntTweakBar when a keyboard event occurs.

KeyPressed ( char key, KeyModifiers modifiers ) : bool

Call this function to inform AntTweakBar when a keyboard event occurs.

KeyTest ( Tw key, KeyModifiers modifiers ) : bool

This function checks if a key event would be processed but without processing it. This could be helpful to prevent bad handling report.

KeyTest ( char key, KeyModifiers modifiers ) : bool

This function checks if a key event would be processed but without processing it. This could be helpful to prevent bad handling report.

MouseClick ( MouseAction action, MouseButton button ) : bool

Call this function to inform AntTweakBar that a mouse button is pressed.

MouseMotion ( int mouseX, int mouseY ) : bool

Call this function to inform AntTweakBar that the mouse has moved.

MouseWheel ( int pos ) : bool

Call this function to inform AntTweakBar that the mouse wheel has been used.

NewBar ( string barName ) : IntPtr

Creates a new tweak bar.

RefreshBar ( IntPtr bar ) : void

Forces bar content to be updated. By default bar content is periodically refreshed when AntTweakBar.Tw.Draw is called (the update frequency is defined by the bar parameter refresh).

RemoveAllVars ( IntPtr bar ) : void

This function removes all the variables, buttons and separators previously added to a tweak bar.

RemoveVar ( IntPtr bar, String name ) : void

This function removes a variable, button or separator from a tweak bar.

SetBottomBar ( IntPtr bar ) : void

Set the specified bar as the background bar. It will be displayed behind the other bars.

SetCurrentWindow ( int windowID ) : void

This function is intended to be used by applications with multiple graphical windows. It tells AntTweakBar to switch its current context to the context associated to the identifier windowID.

SetParam ( IntPtr bar, String varName, String paramName ) : void

This function modifies the value(s) of a bar or variable parameter.

SetParam ( IntPtr bar, String varName, String paramName, System.Boolean boolean ) : void

This function modifies the value(s) of a bar or variable parameter.

SetParam ( IntPtr bar, String varName, String paramName, Color color ) : void

This function modifies the value(s) of a bar or variable parameter.

SetParam ( IntPtr bar, String varName, String paramName, Point point ) : void

This function modifies the value(s) of a bar or variable parameter.

SetParam ( IntPtr bar, String varName, String paramName, Size size ) : void

This function modifies the value(s) of a bar or variable parameter.

SetParam ( IntPtr bar, String varName, String paramName, String value ) : void

This function modifies the value(s) of a bar or variable parameter.

SetTopBar ( IntPtr bar ) : void

Set the specified bar as the foreground bar. It will be displayed on top of the other bars.

Terminate ( ) : void

Uninitialize the AntTweakBar API. Must be called at the end of the program, before terminating the graphics API.

WindowExists ( int windowID ) : bool

Check if a window context associated to the identifier windowID exists. A window context exists if it has previously been created by AntTweakBar.Tw.SetCurrentWindow.

WindowSize ( int width, int height ) : void

Call this function to inform AntTweakBar of the size of the application graphics window, or to restore AntTweakBar graphics resources (after a fullscreen switch for instance).

Приватные методы

Метод Описание
AlreadyUnpacked ( String path, String checksum ) : bool
Tw ( ) : System

Initializes the AntTweakBar.NET wrapper.

UnpackDLL ( ) : void

Описание методов

AddButton() публичный статический Метод

This function adds a button entry to a tweak bar. When the button is clicked by a user, the callback function provided to this function is called.
public static AddButton ( IntPtr bar, String name, ButtonCallback callback, IntPtr clientData, String def ) : void
bar System.IntPtr The tweak bar to which adding a new variable.
name String The name of the button. It will be displayed in the tweak bar if no label is specified for this button. It will also be used to refer to this button in other functions.
callback ButtonCallback The callback function that will be called by AntTweakBar when the button is clicked.
clientData System.IntPtr For your convenience, this is a supplementary pointer that will be passed to the callback function when it is called.
def String An optional definition string used to modify the behavior of this new entry.
Результат void

AddSeparator() публичный статический Метод

This function adds a horizontal separator line to a tweak bar. It may be useful if one wants to separate several sets of variables inside a same group.
public static AddSeparator ( IntPtr bar, String name, String def ) : void
bar System.IntPtr The tweak bar to which adding the separator.
name String The name of the separator. It is optional, this parameter can be set to NULL.
def String An optional definition string used to modify the behavior of this new entry.
Результат void

AddVarCB() публичный статический Метод

This function adds a new variable to a tweak bar by providing CallBack (CB) functions to access it.
public static AddVarCB ( IntPtr bar, String name, VariableType type, SetVarCallback setCallback, GetVarCallback getCallback, IntPtr clientData, String def ) : void
bar System.IntPtr The tweak bar to which adding a new variable.
name String The name of the variable. It will be displayed in the tweak bar if no label is specified for this variable. It will also be used to refer to this variable in other functions.
type VariableType Type of the variable. It must be one of the constants or a user defined type.
setCallback SetVarCallback The callback function that will be called by AntTweakBar to change the variable’s value.
getCallback GetVarCallback The callback function that will be called by AntTweakBar to get the variable’s value.
clientData System.IntPtr For your convenience, this is a supplementary pointer that will be passed to the callback functions when they are called.
def String An optional definition string used to modify the behavior of this new entry.
Результат void

AddVarRO() публичный статический Метод

This function adds a new variable to a tweak bar by specifying the variable’s pointer. The variable is declared Read-Only (RO), so it could not be modified interactively by the user.
public static AddVarRO ( IntPtr bar, String name, VariableType type, IntPtr var, String def ) : void
bar System.IntPtr The tweak bar to which adding a new variable.
name String The name of the variable. It will be displayed in the tweak bar if no label is specified for this variable. It will also be used to refer to this variable in other functions.
type VariableType Type of the variable. It must be one of the constants or a user defined type.
var System.IntPtr Pointer to the variable linked to this entry.
def String An optional definition string used to modify the behavior of this new entry.
Результат void

AddVarRW() публичный статический Метод

This function adds a new variable to a tweak bar by specifying the variable’s pointer. The variable is declared Read-Write (RW), so it could be modified interactively by the user.
public static AddVarRW ( IntPtr bar, String name, VariableType type, IntPtr var, String def ) : void
bar System.IntPtr The tweak bar to which adding a new variable.
name String The name of the variable. It will be displayed in the tweak bar if no label is specified for this variable. It will also be used to refer to this variable in other functions.
type VariableType Type of the variable. It must be one of the constants or a user defined type.
var System.IntPtr Pointer to the variable linked to this entry.
def String An optional definition string used to modify the behavior of this new entry.
Результат void

Define() публичный статический Метод

This function defines optional parameters for tweak bars and variables. For instance, it allows you to change the color of a tweak bar, to set a min and a max value for a variable, to add an help message that inform users of the meaning of a variable, and so on...
public static Define ( String def ) : void
def String A string containing one or more parameter assignments (separated by newlines).
Результат void

DefineEnum() публичный статический Метод

This function creates a new variable type corresponding to an enum.
public static DefineEnum ( String name, String>.IDictionary labels ) : VariableType
name String Specify a name for the enum type (must be unique).
labels String>.IDictionary A mapping from admissible values to their labels.
Результат VariableType

DefineEnumFromString() публичный статический Метод

This function creates a new variable type corresponding to an enum.
public static DefineEnumFromString ( String name, String enumString ) : VariableType
name String Specify a name for the enum type (must be unique).
enumString String Comma-separated list of labels.
Результат VariableType

DefineStruct() публичный статический Метод

This function creates a new AntTweakBar.Tw.VariableType corresponding to a structure.
public static DefineStruct ( String name, StructMemberInfo>.IDictionary structMembers, int structSize, Tw callback, IntPtr clientData ) : VariableType
name String
structMembers StructMemberInfo>.IDictionary
structSize int
callback Tw
clientData System.IntPtr
Результат VariableType

DeleteAllBars() публичный статический Метод

Delete all bars previously created by AntTweakBar.Tw.NewBar.
public static DeleteAllBars ( ) : void
Результат void

DeleteBar() публичный статический Метод

This function deletes a tweak bar previously created by AntTweakBar.Tw.NewBar.
public static DeleteBar ( IntPtr bar ) : void
bar System.IntPtr Identifier to the tweak bar to delete.
Результат void

Draw() публичный статический Метод

Draws all the created tweak bars. This function must be called once per frame, after all the other drawing calls and just before the application presents (swaps) the frame buffer.
public static Draw ( ) : void
Результат void

EventSDL() публичный статический Метод

The SDL event handler.
public static EventSDL ( IntPtr sdlEvent, byte majorVersion, byte minorVersion ) : bool
sdlEvent System.IntPtr
majorVersion byte
minorVersion byte
Результат bool

EventSFML() публичный статический Метод

The SFML event handler.
public static EventSFML ( IntPtr sfmlEvent, byte majorVersion, byte minorVersion ) : bool
sfmlEvent System.IntPtr
majorVersion byte
minorVersion byte
Результат bool

EventWin() публичный статический Метод

The Windows event handler.
public static EventWin ( IntPtr wnd, int msg, IntPtr wParam, IntPtr lParam ) : bool
wnd System.IntPtr
msg int
wParam System.IntPtr
lParam System.IntPtr
Результат bool

EventX11() публичный статический Метод

The X11 event handler.
public static EventX11 ( IntPtr xEvent ) : bool
xEvent System.IntPtr
Результат bool

GetBarByIndex() публичный статический Метод

Returns the bar of a given index.
public static GetBarByIndex ( int barIndex ) : IntPtr
barIndex int Index of the requested bar.
Результат System.IntPtr

GetBarByName() публичный статический Метод

Returns the bar of a given name.
public static GetBarByName ( String barName ) : IntPtr
barName String Name of the requested bar.
Результат System.IntPtr

GetBarCount() публичный статический Метод

Returns the number of created bars.
public static GetBarCount ( ) : int
Результат int

GetBarName() публичный статический Метод

Returns the name of a given tweak bar.
public static GetBarName ( IntPtr bar ) : String
bar System.IntPtr Identifier to the tweak bar.
Результат String

GetBooleanParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetBooleanParam ( IntPtr bar, String varName, String paramName ) : System.Boolean
bar System.IntPtr
varName String
paramName String
Результат System.Boolean

GetBottomBar() публичный статический Метод

Returns the identifier of the current background bar (the bar displayed behind the others).
public static GetBottomBar ( ) : IntPtr
Результат System.IntPtr

GetColorParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetColorParam ( IntPtr bar, String varName, String paramName ) : Color
bar System.IntPtr
varName String
paramName String
Результат Color

GetCurrentWindow() публичный статический Метод

Returns the current window context identifier previously set by AntTweakBar.Tw.SetCurrentWindow.
public static GetCurrentWindow ( ) : int
Результат int

GetDoubleParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetDoubleParam ( IntPtr bar, String varName, String paramName, int paramCount ) : Double[]
bar System.IntPtr
varName String
paramName String
paramCount int
Результат Double[]

GetIntParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetIntParam ( IntPtr bar, String varName, String paramName, int paramCount ) : System.Int32[]
bar System.IntPtr
varName String
paramName String
paramCount int
Результат System.Int32[]

GetLastError() публичный статический Метод

Returns the last error that has occured during a previous AntTweakBar function call.
public static GetLastError ( ) : String
Результат String

GetPointParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetPointParam ( IntPtr bar, String varName, String paramName ) : Point
bar System.IntPtr
varName String
paramName String
Результат Point

GetSingleParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetSingleParam ( IntPtr bar, String varName, String paramName, int paramCount ) : System.Single[]
bar System.IntPtr
varName String
paramName String
paramCount int
Результат System.Single[]

GetSizeParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetSizeParam ( IntPtr bar, String varName, String paramName ) : Size
bar System.IntPtr
varName String
paramName String
Результат System.Drawing.Size

GetStringParam() публичный статический Метод

This function returns the current value of a bar or variable parameter.
public static GetStringParam ( IntPtr bar, String varName, String paramName ) : String
bar System.IntPtr
varName String
paramName String
Результат String

GetTopBar() публичный статический Метод

Returns the identifier of the current foreground bar (the bar displayed on top of the others).
public static GetTopBar ( ) : IntPtr
Результат System.IntPtr

Init() публичный статический Метод

This function initializes the AntTweakBar library. It must be called once at the beginning of the program, just after graphic mode is initialized.
public static Init ( GraphicsAPI graphicsAPI, IntPtr device ) : void
graphicsAPI GraphicsAPI This parameter specifies which graphic API is used: OpenGL, OpenGL core profile (3.2 and higher), Direct3D 9, Direct3D 10 or Direct3D 11.
device System.IntPtr Pointer to the Direct3D device, or IntPtr.Zero for OpenGL.
Результат void

KeyPressed() публичный статический Метод

Call this function to inform AntTweakBar when a keyboard event occurs.
public static KeyPressed ( Tw key, KeyModifiers modifiers ) : bool
key Tw One of the codes.
modifiers KeyModifiers One or a combination of the constants.
Результат bool

KeyPressed() публичный статический Метод

Call this function to inform AntTweakBar when a keyboard event occurs.
public static KeyPressed ( char key, KeyModifiers modifiers ) : bool
key char The ASCII code of the pressed key.
modifiers KeyModifiers One or a combination of the constants.
Результат bool

KeyTest() публичный статический Метод

This function checks if a key event would be processed but without processing it. This could be helpful to prevent bad handling report.
public static KeyTest ( Tw key, KeyModifiers modifiers ) : bool
key Tw One of the codes.
modifiers KeyModifiers One or a combination of the constants.
Результат bool

KeyTest() публичный статический Метод

This function checks if a key event would be processed but without processing it. This could be helpful to prevent bad handling report.
public static KeyTest ( char key, KeyModifiers modifiers ) : bool
key char The ASCII code of the pressed key.
modifiers KeyModifiers One or a combination of the constants.
Результат bool

MouseClick() публичный статический Метод

Call this function to inform AntTweakBar that a mouse button is pressed.
public static MouseClick ( MouseAction action, MouseButton button ) : bool
action MouseAction Tells if the button is pressed or released. It is one of the constants.
button MouseButton Tells which button is pressed. It is one of the constants.
Результат bool

MouseMotion() публичный статический Метод

Call this function to inform AntTweakBar that the mouse has moved.
public static MouseMotion ( int mouseX, int mouseY ) : bool
mouseX int The new X position of the mouse, relative to the left border of the graphics window.
mouseY int The new Y position of the mouse, relative to the top border of the graphics window.
Результат bool

MouseWheel() публичный статический Метод

Call this function to inform AntTweakBar that the mouse wheel has been used.
public static MouseWheel ( int pos ) : bool
pos int The new position of the wheel.
Результат bool

NewBar() публичный статический Метод

Creates a new tweak bar.
public static NewBar ( string barName ) : IntPtr
barName string Name of the new tweak bar.
Результат System.IntPtr

RefreshBar() публичный статический Метод

Forces bar content to be updated. By default bar content is periodically refreshed when AntTweakBar.Tw.Draw is called (the update frequency is defined by the bar parameter refresh).
public static RefreshBar ( IntPtr bar ) : void
bar System.IntPtr Bar identifier.
Результат void

RemoveAllVars() публичный статический Метод

This function removes all the variables, buttons and separators previously added to a tweak bar.
public static RemoveAllVars ( IntPtr bar ) : void
bar System.IntPtr The tweak bar from which to remove all variables.
Результат void

RemoveVar() публичный статический Метод

This function removes a variable, button or separator from a tweak bar.
public static RemoveVar ( IntPtr bar, String name ) : void
bar System.IntPtr The tweak bar from which to remove a variable.
name String The name of the variable.
Результат void

SetBottomBar() публичный статический Метод

Set the specified bar as the background bar. It will be displayed behind the other bars.
public static SetBottomBar ( IntPtr bar ) : void
bar System.IntPtr Bar identifier.
Результат void

SetCurrentWindow() публичный статический Метод

This function is intended to be used by applications with multiple graphical windows. It tells AntTweakBar to switch its current context to the context associated to the identifier windowID.
public static SetCurrentWindow ( int windowID ) : void
windowID int Window context identifier. This identifier could be any integer.
Результат void

SetParam() публичный статический Метод

This function modifies the value(s) of a bar or variable parameter.
public static SetParam ( IntPtr bar, String varName, String paramName ) : void
bar System.IntPtr
varName String
paramName String
Результат void

SetParam() публичный статический Метод

This function modifies the value(s) of a bar or variable parameter.
public static SetParam ( IntPtr bar, String varName, String paramName, System.Boolean boolean ) : void
bar System.IntPtr
varName String
paramName String
boolean System.Boolean
Результат void

SetParam() публичный статический Метод

This function modifies the value(s) of a bar or variable parameter.
public static SetParam ( IntPtr bar, String varName, String paramName, Color color ) : void
bar System.IntPtr
varName String
paramName String
color Color
Результат void

SetParam() публичный статический Метод

This function modifies the value(s) of a bar or variable parameter.
public static SetParam ( IntPtr bar, String varName, String paramName, Point point ) : void
bar System.IntPtr
varName String
paramName String
point Point
Результат void

SetParam() публичный статический Метод

This function modifies the value(s) of a bar or variable parameter.
public static SetParam ( IntPtr bar, String varName, String paramName, Size size ) : void
bar System.IntPtr
varName String
paramName String
size System.Drawing.Size
Результат void

SetParam() публичный статический Метод

This function modifies the value(s) of a bar or variable parameter.
public static SetParam ( IntPtr bar, String varName, String paramName, String value ) : void
bar System.IntPtr
varName String
paramName String
value String
Результат void

SetTopBar() публичный статический Метод

Set the specified bar as the foreground bar. It will be displayed on top of the other bars.
public static SetTopBar ( IntPtr bar ) : void
bar System.IntPtr Bar identifier.
Результат void

Terminate() публичный статический Метод

Uninitialize the AntTweakBar API. Must be called at the end of the program, before terminating the graphics API.
public static Terminate ( ) : void
Результат void

WindowExists() публичный статический Метод

Check if a window context associated to the identifier windowID exists. A window context exists if it has previously been created by AntTweakBar.Tw.SetCurrentWindow.
public static WindowExists ( int windowID ) : bool
windowID int Window context identifier.
Результат bool

WindowSize() публичный статический Метод

Call this function to inform AntTweakBar of the size of the application graphics window, or to restore AntTweakBar graphics resources (after a fullscreen switch for instance).
public static WindowSize ( int width, int height ) : void
width int Width of the graphics window.
height int Height of the graphics window.
Результат void