From 14586e310f25600c1e7517f58212a008bd9ceea4 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 21 Sep 2005 00:51:00 +0000 Subject: Added algorithm module. Removed docs from control (leave to generate) --- algorithm.mod/.cvsignore | 5 ++ algorithm.mod/algorithm.bmx | 118 +++++++++++++++++++++++++++++++++ bitmapfont.mod/doc/commands.html | 43 ------------ glflag.mod/doc/commands.html | 19 ------ simplegui.mod/doc/commands.html | 138 --------------------------------------- vector.mod/doc/commands.html | 56 ---------------- 6 files changed, 123 insertions(+), 256 deletions(-) create mode 100644 algorithm.mod/.cvsignore create mode 100644 algorithm.mod/algorithm.bmx delete mode 100644 bitmapfont.mod/doc/commands.html delete mode 100644 glflag.mod/doc/commands.html delete mode 100644 simplegui.mod/doc/commands.html delete mode 100644 vector.mod/doc/commands.html diff --git a/algorithm.mod/.cvsignore b/algorithm.mod/.cvsignore new file mode 100644 index 0000000..72fba4e --- /dev/null +++ b/algorithm.mod/.cvsignore @@ -0,0 +1,5 @@ +.bmx +algorithm.debug.win32.a +algorithm.debug.win32.i +algorithm.release.win32.a +algorithm.release.win32.i \ No newline at end of file diff --git a/algorithm.mod/algorithm.bmx b/algorithm.mod/algorithm.bmx new file mode 100644 index 0000000..db68305 --- /dev/null +++ b/algorithm.mod/algorithm.bmx @@ -0,0 +1,118 @@ +Rem +bbdoc: noddybox.algorithm +EndRem +Module noddybox.algorithm + +ModuleInfo "Framework: Various algorithm routines" +ModuleInfo "Copyright: Public Domain" +ModuleInfo "Author: Ian Cowburn" +ModuleInfo "Version: $Revision$" + +' $Id$ + +Strict +Import brl.math +Import brl.linkedlist + +Rem +bbdoc: Used to return points from algorithms. +EndRem +Type TAlgoPoint + Rem + bbdoc: The X co-ordinate of the point + EndRem + Field x:Int + Rem + bbdoc: The Y co-ordinate of the point + EndRem + Field y:Int + + Rem + bbdoc: Create a point. + returns: Newly created point. + about: @x and @y are initialised with the passed parameters. + EndRem + Function Create:TAlgoPoint(x:Int, y:Int) + Local o:TAlgoPoint=New TAlgoPoint + o.x=x + o.y=y + Return o + End Function + +End Type + +Rem +bbdoc: Implements a Bresenham style line. +returns: A list of points making up the line. +about: @px1, @py1, @px2 and @py2 are the end points of the line. +EndRem +Function DoLine:TList(p1x:Int, p1y:Int, p2x:Int, p2y:Int) + Local list:TList=CreateList() + Local f:Int + Local dx:Int + Local dy:Int + Local ix:Int + Local iy:Int + Local incrE:Int + Local incrNE:Int + Local d:Int + Local x:Int + Local y:Int + Local ymode:Int + + dx=p2x-p1x + dy=p2y-p1y + + ix=Sgn(dx) + iy=Sgn(dy) + + dx=Abs(dx) + dy=Abs(dy) + + If dy>dx + ymode=True + d=dx*2-dy + incrE=dx*2 + incrNE=(dx-dy)*2 + Else + ymode=False + d=dy*2-dx + incrE=dy*2 + incrNE=(dy-dx)*2 + EndIf + + x=p1x + y=p1y + + list.AddLast(TAlgoPoint.Create(x,y)) + + If ymode + While y<>p2y + If d<=0 + d:+incrE + y:+iy + Else + d:+incrNE + y:+iy + x:+ix + EndIf + + list.AddLast(TAlgoPoint.Create(x,y)) + Wend + Else + While x<>p2x + If d<=0 + d:+incrE + x:+ix + Else + d:+incrNE + y:+iy + x:+ix + EndIf + + list.AddLast(TAlgoPoint.Create(x,y)) + Wend + EndIf + + Return list +End Function diff --git a/bitmapfont.mod/doc/commands.html b/bitmapfont.mod/doc/commands.html deleted file mode 100644 index d196db5..0000000 --- a/bitmapfont.mod/doc/commands.html +++ /dev/null @@ -1,43 +0,0 @@ - - -BlitzMax Module Reference - - - -

Type Reference

-

-
Type TBitmapFont Defines a bitmap font

The TBitmapFont object works from BMF Files, which are created using a tool called BitmapFontEd available at -http://www.noddybox.demon.co.uk/free/index-csharp.html
-Note that when colours are referenced they simply modify the colours in the font images as SetColor() would do on a norml image.
-When drawing characters the current scale, alpha and rotation settings are applied.


-
Method DrawColoured( txt:String, x:Int, y:Int, red:Int, green:Int, blue:Int ) Draws coloured text.

Draws txt at the supplied x,y co-ordinates. red,green and blue control the colour.



-

-
Method Draw( txt:String, x:Int, y:Int ) Draws white text.

Draws txt at the supplied x,y co-ordinates in white.



-

-
Method CentreColoured( txt:String, y:Int, red:Int, green:Int, blue:Int ) Draws centred, coloured text.

Draws txt centred at the supplied y co-ordinate. red,green and blue control the colour.



-

-
Method Centre( txt:String, y:Int ) Draws centred, white text.

Draws txt centred at the supplied y co-ordinate in white.



-

-
Method TextWidth:Int( txt:String ) Width of the supplied string.

Returns: The length of the string txt in pixels.

The current scale settings are taken into account.



-

-
Method TextHeight:Int( txt:String ) Height of the supplied string.

Returns: The height of the string txt in pixels.

The current scale settings are taken into account.



-

-
Method MaxWidth:Int() Width of the largest character.

Returns: The width in pixels of the largest character in the font.



-

-
Method MaxHeight:Int() Height of the largest character.

Returns: The height in pixels of the largest character in the font.



-

-
Function Load:TBitmapFont( path:String, image_flags:Int ) Loads a font from the supplied BMF file.

Returns: The created font, or null if the BMF file couldn't be loaded.

The image_flags are passed onto CreateImage() when the images for the font are being created.



-

-

Module Information

- - - - - - - - - -
Framework Simple Bitmap Font Routines
Copyright Public Domain
Author Ian Cowburn
Version $Revision$
- - diff --git a/glflag.mod/doc/commands.html b/glflag.mod/doc/commands.html deleted file mode 100644 index e59624f..0000000 --- a/glflag.mod/doc/commands.html +++ /dev/null @@ -1,19 +0,0 @@ - - -BlitzMax Module Reference - - - -

Module Information

- - - - - - - - - -
Framework Simple Open GL Backdrop flag
Copyright Public Domain
Author Ian Cowburn
Version $Revision$
- - diff --git a/simplegui.mod/doc/commands.html b/simplegui.mod/doc/commands.html deleted file mode 100644 index b857360..0000000 --- a/simplegui.mod/doc/commands.html +++ /dev/null @@ -1,138 +0,0 @@ - - -BlitzMax Module Reference - - - -

Function Reference

-

-
Function GUINotify( s:String, i:TImage=Null ) Displays a notification alert with the supplied string.

The string s can be split into multiple lines using the '|' character. If i is not null then this image is drawn as a mouse cursor.



-

-
Function GUIYesNo:Int( s:String, i:TImage=Null ) Displays a yes/no alert with the supplied string.

Returns: True if Yes selected, otherwise False.

The string s can be split into multiple lines using the '|' character. If i is not null then this image is drawn as a mouse cursor.



-

-
Function GUIMenu( title:String, options:String[], x:Int, y:Int, i:TImage=Null ) Displays a pop-up menu.

Returns: The index of the selected option, -1 for none.

title is the menu title, options the options to display and x and y specify its position. -If i is not null then this image is drawn as a mouse cursor.



-

Type Reference

-

-
Type TGUIFont Defines the TBitmapFont to be used by the GUI.

-
Global font:TBitmapFont The font to use.


-

-

-
Type TWidget Abstract The base widget type.

-
Field enabled:Int If true the widget is displayed and can be used.


-

-
Field text:String The text displayed in the widget.


-

-
Field x:Int The X co-ordinate of the widget.


-

-
Field y:Int The Y co-ordinate of the widget.


-

-
Field w:Int The width of the widget.


-

-
Field h:Int The height of the widget.


-

-
Field callback(w:TWidget) Callback to call when clicked.


-

-
Field mouse_over:Int True if the mouse is over this widget, False otherwise.


-

-
Field owner:TGUIHandler The TGUIHandler that owns this widget.


-

-
Method HandleKey( k:Int ) Override this accept keypresses


-

-
Method MouseEnter() Override this for when the mouse enters. Call this parent version to handle mouse_over too.


-

-
Method MouseLeave() Override this for when the mouse leaves. Call this parent version to handle mouse_over too.


-

-
Method HandleClick() Override to handle a mouse button press.


-

-
Method Draw() Must be provided by a widget to draw itself.


-

-
Function DrawBox( x:Int, y:Int, w:Int, h:Int ) Helper to draw a wireframe rectangle.


-

-
Function Draw3DBox( x:Int, y:Int, w:Int, h:Int, invert:Int, size:Int=2 ) Helper to draw a 3D rectangle.


-

-

-
Type TLabel Extends TWidget The label widget (simply displays the supplied string)

-
Function Create:TLabel( gui:TGUIHandler,x:Int, y:Int, text:String ) Create a TLabel widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position and text is the text to display in the label.



-

-

-
Type TText Extends TWidget The text entry widget

-
Function Create:TText( gui:TGUIHandler,x:Int, y:Int, text:String, maxlen:Int, callback(w:TWidget)=Null ) Create a TText widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position and text is the initial text in the widget. -maxlen is the maximum number of characters allowed. callback is called when RETURN is pressed in the text field.



-

-

-
Type TCheckbox Extends TWidget The checkbox widget

-
Field checked:Int True if the box is checked, False otherwise.


-

-
Function Create:TCheckbox( gui:TGUIHandler, x:Int, y:Int, text:String, callback(w:TWidget)=Null ) Create a TCheckox widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position and text is the text to display by the checkbox. -callback is called when the checkbox is toggled.



-

-

-
Type TButton Extends TWidget The button widget

-
Function Create:TButton( gui:TGUIHandler, x:Int, y:Int, w:Int, h:Int, text:String, callback(w:TWidget) ) Create a TButton widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x, y, w and h are its position and size, and text is the text to display in the button. -callback is called when the button is pressed.



-

-

-
Type TButtonList Extends TWidget A drop down list type widget

-
Field selected:Int The selected item.


-

-
Function Create:TButtonList( gui:TGUIHandler, x:Int, y:Int, options:String[], selected:Int, callback(w:TWidget) ) Create a TButtonList widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position. options are the options for the list and -selected is the currently selected item. callback is called when the selection changes.



-

-

-
Type TNumberFloat Extends TWidget A number up/down widget for floats

-
Field value:Float The value


-

-
Field change:Float The increment/decrement


-

-
Field maxval:Float The maximum value


-

-
Field minval:Float The minimum value


-

-
Function Create:TNumberFloat( gui:TGUIHandler, x:Int, y:Int, callback(w:TWidget)=Null ) Create a TNumber widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position. -callback is called when the value changes.



-

-

-
Type TNumberInt Extends TWidget A number up/down widget for ints

-
Field value:Int The value


-

-
Field change:Int The increment/decrement


-

-
Field maxval:Int The maximum value


-

-
Field minval:Int The minimum value


-

-
Function Create:TNumberInt( gui:TGUIHandler, x:Int, y:Int, callback(w:TWidget)=Null ) Create a TNumber widget.

Returns: The created widget.

gui is the TGUIHandler object managing this wiget. x and y are its position. -callback is called when the value changes.



-

-

-
Type TGUIHandler Handles the GUI.

-
Method Register( w:TWidget ) Register a widget.

Widgets call this themselves.



-

-
Method Clear() Remove all widgets.


-

-
Method SetEnable( state:Int ) Sets the enable state of all widgets.

If state is true then all widgets are enabled, otherwise all widgets are disabled



-

-
Method SetFocus( w:TWidget ) Sets the keyboard focus to the supplied widget. Pass null for no focus.


-

-
Method GetFocus:TWidget() Gets the keyboard focus.

Returns: The currently focused TWidget, or null for no focus.



-

-
Method Clicked:TWidget() Gets the last clicked widget.

Returns: The last clicked TWidget. Null is returned if this is called again before another widget is clicked.



-

-
Method EventLoop() Perform the event loop and pass any necessary events.

KeyHit(KEY_MOUSELEFT) and GetChar() are used to consume events for the interface.



-

-
Function Create:TGUIHandler() Create a GUI Handler.

Returns: The GUI Hanbler.



-

-

Module Information

- - - - - - - - - -
Framework (Very) Simple GUI
Copyright Public Domain
Author Ian Cowburn
Version $Revision$
- - diff --git a/vector.mod/doc/commands.html b/vector.mod/doc/commands.html deleted file mode 100644 index 4cb9c08..0000000 --- a/vector.mod/doc/commands.html +++ /dev/null @@ -1,56 +0,0 @@ - - -BlitzMax Module Reference - - - -

Type Reference

-

-
Type TVector Implements a 3D vector. Can be used as a 2D vector by ignoring Z.

-
Field x:Float The X component of the vector.


-

-
Field y:Float The Y component of the vector.


-

-
Field z:Float The Z component of the vector.


-

-
Method IsNull:Int() Is the vector null.

Returns: True if the vector is null (all components zero), False otherwise.



-

-
Method Length:Float() The length of the vector.

Returns: The length of the vector.



-

-
Method Normalise() Normalise the vector so its length is 1.


-

-
Method SetLength( sc:Float ) Set the vector so its length is sc.


-

-
Method AddScalar( sc:Float ) Adds sc to all components.


-

-
Method Minus() Reverse the direction of the vector.


-

-
Method Scale( sc:Float ) Scale all components by sc.


-

-
Method Add( v:TVector ) Add another vector to this vector.


-

-
Method Subtract( v:TVector ) Subtract another vector from this vector.


-

-
Method ScaleVector( v:TVector ) Scale this vector by another vector.


-

-
Method InverseScaleVector( v:TVector ) Inverse scale this vector by another vector.


-

-
Method Cross:TVector( v:TVector ) Calculate the cross product of this vector with another.

Returns: A new TVector holding the cross product.



-

-
Method Dot:Float( v:TVector ) Calculate the dot product of this vector with another.

Returns: The dot product.



-

-
Function Create:TVector( dx:Float=0.0, dy:Float=0.0, dz:Float=0.0 ) Create a vector.

Returns: The created vector.

dx, dy and dz are the initial component values.



-

-

Module Information

- - - - - - - - - -
Framework Simple Vector class
Copyright Public Domain
Author Ian Cowburn
Version $Revision$
- - -- cgit v1.2.3