This library should help to easily print tables in C and C++ like following:
+--------+------+--------+------+
| N | | Square | |
+--------+------+--------+------+
| 4 | even | 16 | even |
+--------+------+--------+------+
| #define IEEE754_32BIT_MANTISSA_MASK 0x7fffff | |
| #define IEEE754_32BIT_MANTISSA_NBITS 23 | |
| #define IEEE754_32BIT_MANTISSA_SHIFT 0 | |
| #define IEEE754_32BIT_EXPONENT_MASK 0xff | |
| #define IEEE754_32BIT_EXPONENT_NBITS 8 | |
| #define IEEE754_32BIT_EXPONENT_SHIFT 23 | |
| #define IEEE754_32BIT_SIGN_BIT_MASK 0x1 |
| #include <stdint.h> | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| #include <GL/gl.h> | |
| #define WGL_DRAW_TO_WINDOW_ARB 0x2001 | |
| #define WGL_ACCELERATION_ARB 0x2003 | |
| #define WGL_SUPPORT_OPENGL_ARB 0x2010 | |
| #define WGL_DOUBLE_BUFFER_ARB 0x2011 |
| #include <stdint.h> | |
| #define WIN32_LEAN_AND_MEAN | |
| #include <windows.h> | |
| #include <GL/gl.h> | |
| #define WGL_DRAW_TO_WINDOW_ARB 0x2001 | |
| #define WGL_ACCELERATION_ARB 0x2003 | |
| #define WGL_SUPPORT_OPENGL_ARB 0x2010 | |
| #define WGL_DOUBLE_BUFFER_ARB 0x2011 |
| #include <stdio.h> | |
| #include <sys/mman.h> | |
| #include <sys/stat.h> | |
| #include <fcntl.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #include <semaphore.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> |
Previous part: Geometric algebra in 2D and 3D
Disclaimer: there will be NO proofs or rigorous explanations here, just some results and notes on how to use the library
We start with lines. As you can remember, the equation for a line in 2D looks like this:
In the previous part (Part 2) I created hover and click behaviours, so we could make buttons or just any hover elements. But how to use them in the game? I don't want to store a pointer to the button. UI library could reorder elements or delete them as it wishes, I don't want this hard constraint, especially with no way to check is my pointer valid or not.
Last time (Part 1) I finished by drawing a couple of rectangles on the screen. But I missed the bug, so let's fix it. Let's have a look at the code below, can you spot it?
void draw(system *s)
{
// ...