Skip to content

Commit b5350e5

Browse files
authored
Merge pull request #1 from dark-tree/next
WINX 1.1.0
2 parents 31a95ff + e853556 commit b5350e5

File tree

10 files changed

+471
-254
lines changed

10 files changed

+471
-254
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
WINX is a simple to use, minimal, cross-platform and single-header window management C library designed to easily create an OpenGL 3.0+ compatible window on both Windows and Linux (as well as on MacOS through X11).
33

44
#### Usage
5-
To use WINX compile the single source file `winx.c` with the `-lGL -lX11` options on Linux and `-lopengl32 -lgdi32` on Windows, after that include the `winx.h`
5+
To use WINX compile the single source file `winx.c` with the `-lGL -lX11 -lXcursor` options on Linux and `-lopengl32 -lgdi32` on Windows, after that include the `winx.h`
66
header anywhere you need access to WINX functions, and link the object files. For small single-file programs you can also directly include the `winx.c` source file -
7-
but note that this is not recommended as it sometimes causes issues with other libraries such as GLAD if done incorrectly. If you plan on using both GLAD and WINX
8-
together consider the combined library [WXGL](wxgl/).
7+
but note that this is not recommended as it sometimes causes issues with other libraries such as GLAD if done incorrectly.
98

109
#### Example
1110
To see WINX in action run the `build.sh` (or `./build.bat` on Windows) script to compile and execute a simple OpenGL program using a WINX created context and window.
@@ -14,4 +13,4 @@ To see WINX in action run the `build.sh` (or `./build.bat` on Windows) script to
1413
Documentation describing the basics of using WINX can be found at the beginning of the `winx.h` header file, just under the license.
1514

1615
#### License
17-
Boost Software License - Version 1.0 - August 17th, 2003
16+
This project is licensed under the MIT license.

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
gcc -g -O0 winx.c example/main.c example/glad/glad.c -I. -lopengl32 -lgdi32 -o main.exe && main.exe
1+
gcc -g -Wall -Wextra -Wno-unused-parameter -Wno-cast-function-type -O0 winx.c example/main.c example/glad/glad.c -I. -lopengl32 -lgdi32 -o main.exe && main.exe

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
set -x
3-
gcc -g -O0 winx.c example/main.c example/glad/glad.c -I. -ldl -lGL -lX11 -o main && ./main
3+
gcc -g -Wall -Wextra -Wno-unused-parameter -O0 winx.c example/main.c example/glad/glad.c -I. -ldl -lGL -lX11 -lXcursor -o main && ./main

example/main.c

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11

22
#include "glad/glad.h"
33
#include <winx.h>
4-
54
#include <stdio.h>
6-
#include <sys/time.h>
7-
85
#include "render.h"
96

10-
// for printing fps every 5s
11-
void watch() {
12-
static int t0 = -1;
13-
static int frames = 0;
14-
15-
struct timeval tv;
16-
struct timezone tz;
17-
gettimeofday(&tv, &tz);
18-
int t = (int) tv.tv_sec;
19-
20-
if (t0 < 0) t0 = t;
21-
22-
frames++;
23-
24-
if (t - t0 >= 5.0) {
25-
float seconds = t - t0;
26-
float fps = frames / seconds;
27-
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
28-
t0 = t;
29-
frames = 0;
30-
}
31-
}
32-
337
void closeEventHandle() {
348
winxClose();
359
exit(0);
@@ -41,7 +15,7 @@ void resizeEventHandle(int w, int h) {
4115

4216
int main() {
4317

44-
if (!winxOpen(500, 300, "WINX OpenGL 3.0 Example")) {
18+
if (!winxOpen(400, 300, "WINX OpenGL 3.0 Example")) {
4519
printf("Error occured! %s\n", winxGetError());
4620
exit(1);
4721
}
@@ -60,7 +34,6 @@ int main() {
6034

6135
winxSwapBuffers();
6236
winxPollEvents();
63-
watch();
6437
}
6538

6639
}

0 commit comments

Comments
 (0)