Skip to content

Commit 03c1f2e

Browse files
authoredFeb 8, 2019
Update README.md
This should be short to lower file size etc
1 parent 547d056 commit 03c1f2e

File tree

1 file changed

+1
-73
lines changed

1 file changed

+1
-73
lines changed
 

‎README.md

+1-73
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,4 @@
11
# libBoolUI [![HitCount](http://hits.dwyl.io/UIPlugins/libBoolUI.svg)](http://hits.dwyl.io/UIPlugins/libBoolUI)
22
A simple API to create yes no forms
33
# Documentation
4-
This library is to make easy things easier (and have less boilerplate), so here's some docs to help!
5-
#### Creating a form
6-
7-
Simply create a ```YesNoForm``` object using the new keyword!
8-
9-
```
10-
$form = new YesNoForm($closure, 'Are you sure?');
11-
```
12-
13-
The first argument is the callable (we'll get to that later) and the second is the title of the form, they're both optional.
14-
However, if you leave the callable out you'll have to set it later.
15-
16-
**Adding the buttons**
17-
18-
Add the buttons by calling the method ```registerButtons()``` in your object!
19-
20-
```
21-
$form->registerButtons();
22-
```
23-
24-
Optionally, you can change the text for the buttons by passing an argument to the method.
25-
26-
```
27-
$form->registerButtons(['Custom Yes', 'Custom No']);
28-
```
29-
30-
**Images**
31-
32-
After you register your buttons, you can call the function ```setImage()``` to give it an image!
33-
34-
The parameters for setImage are ```(int $yesOrNo, bool $isURL, string $imageURL)``` the first is yes or no, there are predefined constants for this that you can access like ```YesNoForm::YES``` and ```YesNoForm::NO```, then simply put true if your image is accessed via URL or false if it's a path to a texture.
35-
36-
I recommend using a texture because URL's load really slow to the client.
37-
38-
Code example
39-
40-
```
41-
$form->setImage($form::YES, false, 'textures/ui/checkboxFilledYellow');
42-
$form->setImage($form::NO, false, 'textures/ui/checkboxUnFilled');
43-
```
44-
45-
**Randomization**
46-
47-
You can randomize the order of the options by calling the method ```randomize()``` in your object!
48-
49-
```
50-
$form->randomize();
51-
```
52-
53-
**Forcing user input**
54-
55-
You can force the user to press one of your options by calling the setter method ```setForced()``` in your object
56-
```
57-
$form->setForced();
58-
```
59-
60-
#### Sending the form to a player
61-
62-
Sending a form is as simple as
63-
```
64-
$player->sendForm($form)
65-
```
66-
with ```$form``` being your YesNoForm object mentioned above!
67-
68-
#### Callables and return values
69-
70-
Your callable function should have the arguments ```(Player $player, $data)```
71-
If the player hits yes, the ```$data``` variable will be true; pressing no makes it false.
72-
73-
74-
#### That's it!
75-
76-
It's really that simple, if you need help with this refer to the [sample plugin](https://github.com/UIPlugins/PvPUI)
4+
Refer to [wiki](https://github.com/UIPlugins/libBoolUI/wiki/Documentation)

0 commit comments

Comments
 (0)