Skip to content

Commit

Permalink
introduce betterButtonManager and an example ini file
Browse files Browse the repository at this point in the history
  • Loading branch information
T3chArmy committed Mar 28, 2015
1 parent 4103e4e commit 74b1261
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 0 deletions.
18 changes: 18 additions & 0 deletions GUI/sample/sample.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[default]
Top = 0
Left = 64

[HUD_Main]
Top=0
Left=0
Width=72
Height=12
Style[]=ISB_DARK

[HUD_Text]
Top=2
Left=1
Width=13
Height=4
Style[]=ISB_LEFT
Style[]=ISB_C1
53 changes: 53 additions & 0 deletions betterButtonManager-ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
This is a user based Button manager, this adds support for
* dynamic GUIs that can be moved around on screen (not dragable)
* alternating text
* buttons that expire after certain amount of time
To use:
* on NCN:
* You will need to have a variable in your plugin class that stores ButtonHandlers
* create new button Manger:
* $this->BTNMan[$NCN->UName] = new betterButtonManager($UCID);
* create a timer like so:
$this->createNamedTimer("PluginName_ButtonHandle_{$NCN->UName}", 'DoButtonHandle', 0.50, Timer::REPEAT, array($NCN->UName));
* The function for this timer is:
public function DoButtonHandle($UName)
{
$this->BTNMan[$UName]->HandleButtons();
}
* To create a new button:
* $this->BTNMan[$UName]->InitButton(ButtonName, Group, Top, Left, Width, Height, ButtonStyle, Text, SecondsToShow);
* example: $this->BTNMan[$UName]->InitButton('Welcome', 'welcomescreen', 50, 50, 100, 100, ISB_DARK, 'Welcome to Our Server!', 10);
This will create a button that is:
* 50 down from the top
* 50 from the left
* 100 wide
* 100 tall
* Dark Background
* Welcomes the user,
* Stays on screen for 10 seconds
* To load a cluster:
* $this->BTNMan[$UName]->LoadGUICluster('example_cluster', 'example_layout', 100, 100);
* this will load the ini file /plugins/gui/example_cluster/example_layout.ini
* To remove a single button:
* $this->BTNMan[$UName]->RemoveButton('Welcome');
* To remove a button group/cluster
* $this->BTNMan[$UName]->RemoveGroup('welcomescreen'); #this will remove the button we used
* $this->BTNMan[$UName]->RemoveGroup('example_cluster'); #this will remove the cluster we used
* To move a cluster
* you have 3 options
* move just vertically
* $this->BTNMan[$UName]->MoveGUIClusterV('example_cluster', 5)
* Will move the cluster down 5
* move just horizontally
* $this->BTNMan[$UName]->MoveGUIClusterH('example_cluster', 10)
* Will move the cluster right 10
* or move both vertical and horizontal
* $this->BTNMan[$UName]->MoveGUIClusterD('example_cluster', 5, 10)
* Will move the cluster down 5, and right 10
* SIDE NOTE: each cluster will only show 1 layout at a time
* For example if you do
* $this->BTNMan[$UName]->LoadGUICluster('example_cluster', 'example_layout', 100, 100);
* then do
* $this->BTNMan[$UName]->LoadGUICluster('example_cluster', 'example_layout2', 100, 100);
* the call to load the 2nd layout will remove all buttons from the example_cluster that is shown
and then show the new layout
Loading

0 comments on commit 74b1261

Please sign in to comment.