Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Ellouze <[email protected]>
  • Loading branch information
AdamOnAir authored Dec 22, 2024
1 parent 509ca6e commit caea3f0
Showing 1 changed file with 56 additions and 5 deletions.
61 changes: 56 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<a><img alt="linux" src="https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black">
</p>


# VDL

**V**ideo **D**evelopment **L**ibrary is a low-level, cross-platform development library for OpenGL written in portable C (C99).
Expand Down Expand Up @@ -36,11 +35,63 @@ sudo ./installer.sh
- Download `setup-vdl.exe`
- Execute

## License
## Demo

The following code is an demo of VDL usage.
```c
#include <stdbool.h>

#include "include/vdl.h"
#include <GL/gl.h>
#include <stdio.h>

#define WINDOW_WIDTH 600
#define WINDOW_HEIGHT 800

int main() {
const Win *window = createWindowInstance();

window->create(WINDOW_WIDTH, WINDOW_HEIGHT, "VDL Demo");
window->createFramebuffer(WINDOW_WIDTH, WINDOW_HEIGHT);

GLuint textureID = window->loadTexture("assets/ness.png"); // texture LOADED
if (!textureID) {
printf("Failed to load texture\n");
return 1;
}

while (!window->shouldClose()) { // () in shouldClose is very important
// Clear the screen first
glClear(GL_COLOR_BUFFER_BIT);

// text color
unsigned char textColor[3] = {0, 0, 254};
window->drawText(10, 10, "VDL drew this;", textColor, 2.0f); // scaled up text : 1.0 if default

Distribute, modify and use freely under the terms of the [ZLib License](./LICENSE).
window->drawTexture(textureID, 100, 100, 200, 200); // texture DRAWN

<!--
// key press
window->drawText(10, 350, "Press E to make a button appear", textColor, 2.0f);

if (window->keyboard->isKeyPressed(KB_KEY_E)) {
window->drawButton(100, 300, 100, 50, "Play RUSH E");
}

// Draw framebuffer to screen
window->drawTexture(window->getFramebufferTexture(), 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);

window->swapBuffers();
window->pollEvents();
}

window->destroy();
return 0;
}
```

## License

```text
Copyright (C) 2024 Ellouze Adam <[email protected]>
This software is provided 'as-is', without any express or implied
Expand All @@ -58,4 +109,4 @@ freely, subject to the following restrictions:
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-->
```

0 comments on commit caea3f0

Please sign in to comment.