Skip to content

Instantly share code, notes, and snippets.

#include <windows.h>
#include <gdiplus.h>
LRESULT CALLBACK WindowProcessMessages(HWND hwnd, UINT msg, WPARAM param, LPARAM lparam);
void draw(HDC hdc);
int WINAPI WinMain(HINSTANCE currentInstance, HINSTANCE previousInstance, PSTR cmdLine, INT cmdCount) {
// Initialize GDI+
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
#include <windows.h>
LRESULT CALLBACK WindowProcessMessages(HWND hwnd, UINT msg, WPARAM param, LPARAM lparam);
int WINAPI WinMain(HINSTANCE currentInstance, HINSTANCE previousInstance, PSTR cmdLine, INT cmdCount) {
// Register the window class
const char *CLASS_NAME = "myWin32WindowClass";
WNDCLASS wc{};
wc.hInstance = currentInstance;
wc.lpszClassName = CLASS_NAME;
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <SDL2/SDL.h>
// Utility macros
#define CHECK_ERROR(test, message) \
do { \
#include <iostream>
#include <sqlite3.h>
int main() {
sqlite3 *db;
int fd = sqlite3_open("mydb.db", &db);
if (fd == SQLITE_OK) {
std::cout << "Success opening the database.\n";
}
// Check video tutorial at https://www.youtube.com/watch?v=GVMrllOh44U
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <SDL2/SDL.h>
// Utility macros
#define CHECK_ERROR(test, message) \
// OpenCV 3 demo - Convert a color image to gray
// See YouTube tutorial https://www.youtube.com/watch?v=9lra7lTKpbs
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
int main() {
const std::string img_file{"water.png"};
// Check if we can open the file
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include "SDL.h"
// Get a random number between 0 and 255
int randCol()
{