Update docs

2025-11-08 12:28:00 +00:00
parent a19ce256d9
commit 18ddfe1576
3 changed files with 30 additions and 16 deletions

12
Fonts.md Normal file

@@ -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);
```

@@ -7,3 +7,5 @@ This wiki details the usage of Quip.
[Window](https://chookspace.com/max/quip/wiki/Window) [Window](https://chookspace.com/max/quip/wiki/Window)
[Widgets](https://chookspace.com/max/quip/wiki/Widgets) [Widgets](https://chookspace.com/max/quip/wiki/Widgets)
[Fonts](https://chookspace.com/max/quip/wiki/Fonts)

@@ -8,45 +8,45 @@ See the "Window" page for information on this.
## List of Avaliable Widgets ## List of Avaliable Widgets
### `Quip::Widget::TextLabel(std::string text, int xpos, int ypos)` ### `Quip::Widget::TextLabel(std::string text, Quip::Font font)`
#### Summary #### 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 #### Members
`std::string text`: The text to be displayed. `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 #### Example
```c++ ```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<void()> callback, int xpos, int ypos)` ### `Quip::Widget::Button(Quip::TextLabel text, std::function<void()> callback)`
#### Summary #### 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 #### 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<void()> callback`: The function to be run when the button is pressed.
#### Example #### Example
```c++ ```c++
Quip::Widget::Button("Click me!", []() { Quip::Widget::Button("Click me!", []() {
std::cout << "Button has been clicked!" << std::endl; 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 #### Summary
@@ -54,12 +54,12 @@ The `Image` widget renders an image given at a provided filepath. If width and h
#### Members #### 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 #### Example
```c++ ```c++
Quip::Widget::Image("image.png", 10, 10, 100, 100); Quip::Widget::Image("image.png", 100, 100);
``` ```