This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.18.0) | |
| project(kmsgreader VERSION 0.1.0) | |
| set(APP_NAME "kmsgreader") | |
| set(THREADS_PREFER_PTHREAD_FLAG ON) | |
| find_package(Threads REQUIRED) | |
| add_executable(${APP_NAME} | |
| kmsgreader.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Miminal C++ SDL2 OpenGL 4.5 example | |
| // | |
| // by Poddubny Michael | |
| // | |
| // Download OpenGL header: | |
| // wget https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h | |
| // | |
| // Compile: | |
| // g++ -std=c++11 sdl2_opengl_4_5_triangle.cpp -I. -lSDL2 -o sdl2_opengl_4_5_triangle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <assert.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #ifndef ABS | |
| #define ABS(v) ((v) < 0 ? -(v) : (v)) | |
| #endif | |
| char * | |
| str_replace_once_fast(const char *orig, size_t orig_size, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdbool.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <X11/Xlib.h> | |
| bool quited = false; | |
| void on_delete(Display * display, Window window) | |
| { | |
| XDestroyWindow(display, window); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // feof equivalent for SDL_rwops | |
| int rweof(SDL_RWops *ctx) { | |
| return SDL_RWsize(ctx) == SDL_RWtell(ctx); | |
| } | |
| // fgetc equivalent for SDL_rwops | |
| int rwgetc(SDL_RWops *rw) { | |
| char c; | |
| return SDL_RWread(rw, &c, 1, 1) == 1 ? c : EOF; |