diff --git a/Fonts.md b/Fonts.md new file mode 100644 index 0000000..240b2e3 --- /dev/null +++ b/Fonts.md @@ -0,0 +1,12 @@ +# Fonts + +The `Quip::Font` class allows you to import fonts for usage in your application. + +## Usage + +```c++ +// first paramater is font location, second is size +Quip::Font("/usr/share/fonts/noto/NotoSans-Regular.ttf", 16); + +Quip::Widget::TextLabel("Hello from custom font!", font); +``` diff --git a/Home.md b/Home.md index cae885d..6fa250c 100644 --- a/Home.md +++ b/Home.md @@ -1,9 +1,11 @@ # Quip Wiki -This wiki details the usage of Quip. +This wiki details the usage of Quip. ## Main Pages [Window](https://chookspace.com/max/quip/wiki/Window) -[Widgets](https://chookspace.com/max/quip/wiki/Widgets) \ No newline at end of file +[Widgets](https://chookspace.com/max/quip/wiki/Widgets) + +[Fonts](https://chookspace.com/max/quip/wiki/Fonts) diff --git a/Widgets.md b/Widgets.md index 16dc821..fc7a657 100644 --- a/Widgets.md +++ b/Widgets.md @@ -8,45 +8,45 @@ See the "Window" page for information on this. ## List of Avaliable Widgets -### `Quip::Widget::TextLabel(std::string text, int xpos, int ypos)` +### `Quip::Widget::TextLabel(std::string text, Quip::Font font)` #### Summary -The `TextLabel` widget allows you to render text on the screen. For now, text is rendered as Noto Sans 16pt. This will be customisable in the future. +The `TextLabel` widget allows you to render text on the screen. #### Members `std::string text`: The text to be displayed. -`int xpos, ypos`: The xpos and ypos of the text label. +`Quip::Font font`: The font for the text to be rendered in. #### Example ```c++ -Quip::Widget::TextLabel("Hello!", 10, 10); +Quip::Widget::TextLabel("Hello!", Quip::Font("/path/to/font.ttf", 16)); ``` -### `Quip::Widget::Button(std::string text, std::function callback, int xpos, int ypos)` +### `Quip::Widget::Button(Quip::TextLabel text, std::function callback)` #### Summary -The `Button` widget creates a clickable button which runs a provided function upon click. For now, button text is rendered as Noto Sans 16pt, the button background is slightly blue, and the clickable size is constant. This will be customisable in the future. +The `Button` widget creates a clickable button which runs a provided function upon click. Takes a textlabel which is the text displayed on the button. #### Members -`std::string text`: The text to be displayed. +`Quip::TextLabel text`: The textlabel to be displayed. -`int xpos, ypos`: The xpos and ypos of the button. +`std::function callback`: The function to be run when the button is pressed. #### Example ```c++ Quip::Widget::Button("Click me!", []() { std::cout << "Button has been clicked!" << std::endl; -}, 10, 10) +}) ``` -### `Quip::Widget::Image(std::string filepath, int xpos, int ypos, int width = -1, int height = -1)` +### `Quip::Widget::Image(std::string filepath, int width = -1, int height = -1)` #### Summary @@ -54,12 +54,12 @@ The `Image` widget renders an image given at a provided filepath. If width and h #### Members -`int width, height`: The width and height of the image. +`std::string filepath`: The path to look for the image in. -`int xpos, ypos`: The xpos and ypos of the image. +`int width, height`: The width and height of the image. #### Example ```c++ -Quip::Widget::Image("image.png", 10, 10, 100, 100); -``` \ No newline at end of file +Quip::Widget::Image("image.png", 100, 100); +```