This file contains 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 <SDL.h> | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
#include <algorithm> | |
#include <format> | |
int main(int argc, char* argv[]) | |
{ | |
std::string app_title = "SDL Box Example"; |
This file contains 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 <SDL.h> | |
#include <SDL_ttf.h> | |
#include <iostream> | |
int main(int argc, char* argv[]) | |
{ | |
const std::string app_title = "SDL_TextBoxExample"; | |
const SDL_Color background_color = SDL_Color{ 0, 50, 255, 255 }; | |
const SDL_Color foreground_color = SDL_Color{ 255, 255, 255, 255 }; | |
const SDL_Rect window_rect = SDL_Rect{ SDL_WINDOWPOS_CENTERED , SDL_WINDOWPOS_CENTERED , 1280, 720 }; |
This file contains 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 <SDL.h> | |
#include <stdio.h> | |
// Macros used to keep the box within the screen's boundaries. In C++ std::min and std::max can be used. | |
#define MIN(a,b) (((a)<(b))?(a):(b)) | |
#define MAX(a,b) (((a)>(b))?(a):(b)) | |
// This is the forward declaration for shutdown so that main() knows it exists, check below main() for the function | |
// body. | |
int shutdown(SDL_Window* main_window, SDL_Renderer* renderer, const char* error_prefix, const char* error); |
This file contains 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 <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) |
This file contains 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
#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{ |
This file contains 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 <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"; |
This file contains 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
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 |
This file contains 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 <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!"; |
This file contains 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 <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 |
This file contains 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
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); | |
} |
NewerOlder