Skip to content

Instantly share code, notes, and snippets.

View xeekworx's full-sized avatar
💭
Looking for open-source tool ideas.

Xeek xeekworx

💭
Looking for open-source tool ideas.
View GitHub Profile
@xeekworx
xeekworx / sdl_nanovg_example.cpp
Last active April 11, 2024 14:34
SDL + GLAD + OpenGL + NanoVG Example in C++
#include <SDL.h>
#include <glad\glad.h>
#include <nanovg.h>
#define NANOVG_GL3_IMPLEMENTATION
#include <nanovg_gl.h>
#include <nanovg_gl_utils.h> // For framebuffer utilities not shown in this code
#include <string>
#include <iostream>
#include <iomanip> // for setw
@xeekworx
xeekworx / sdl_opengl_example.cpp
Created February 28, 2018 15:14
SDL + GLAD + OpenGL + Example in C++
#include <SDL.h>
#include <glad\glad.h>
#include <string>
#include <iostream>
#include <iomanip> // for setw
int main(int argc, char *argv[])
{
int screen_width = 640, screen_height = 480;
SDL_Window * main_window = nullptr;
@xeekworx
xeekworx / sdl_image_move_example.cpp
Last active March 1, 2018 02:17
SDL Renderer + A Moving Image
#include <SDL.h>
#include <iostream>
#include <sstream>
#include <string>
int main(int argc, char *argv[])
{
int screen_width = 1024, screen_height = 768;
SDL_Window* main_window = NULL;
SDL_Renderer* renderer = NULL;
@xeekworx
xeekworx / nvgTriangle.c
Last active July 28, 2018 18:47
nvgTriangle
void nvgTriangle(NVGcontext * ctx, float x1, float y1, float x2, float y2, float x3, float y3)
{
nvgMoveTo(ctx, x1, y1);
nvgLineTo(ctx, x2, y2);
nvgLineTo(ctx, x3, y3);
nvgClosePath(ctx);
}
@xeekworx
xeekworx / sdl_nanovg_triangle_example.cpp
Last active July 28, 2018 19:27
SDL + GLAD + OpenGL + NanoVG Example in C++ (Triangle)
#include <SDL.h>
#include <glad\glad.h>
#include <nanovg.h>
#define NANOVG_GL3_IMPLEMENTATION
#include <nanovg_gl.h>
#include <nanovg_gl_utils.h> // For framebuffer utilities not shown in this code
#include <string>
#include <iostream>
#include <iomanip> // for setw
@xeekworx
xeekworx / sdl_box_move_example.cpp
Last active January 5, 2023 23:01
SDL Renderer & Keyboard State Example
#include <SDL.h>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <format>
int main(int argc, char* argv[])
{
std::string app_title = "SDL Box Movement Example - Use the arrow keys!";
Imports System
Imports System.IO
Imports System.Linq
Imports System.Net
Imports System.Net.Http
Imports System.Runtime.InteropServices
Imports System.Threading.Tasks
Imports Dropbox.Api
Imports Dropbox.Api.Common
Imports Dropbox.Api.Files
#include <SDL.h>
#include <iostream>
#include <sstream>
#include <string>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" // https://github.com/nothings/stb/blob/master/stb_image.h
int main(int argc, char* argv[])
{
std::string app_title = "SDL_Guide 03: Image Loading & Rendering";
#pragma once
#include <SDL.h> // Unnecessary if the source including this header already includes SDL.h
#include <cmath> // For round()
struct SDL_RectF {
float x, y, w, h;
operator SDL_Rect()
{
return SDL_Rect{
@xeekworx
xeekworx / findstring_demo.c
Created April 28, 2021 20:54
FindString Example in C
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#define MATCH_NOT_FOUND SIZE_MAX
size_t findstring(const char* str, const char* match, size_t current_pos);
void main(void)