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 <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; |
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 <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; |
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 <stdlib.h> | |
#include <stdbool.h> | |
#include <time.h> | |
#include <SDL2/SDL.h> | |
// Utility macros | |
#define CHECK_ERROR(test, message) \ | |
do { \ |
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 <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"; | |
} |
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
// 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) \ |
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
// 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 |
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 <cstdio> | |
#include <cstdlib> | |
#include <ctime> | |
#include <cstring> | |
#include "SDL.h" | |
// Get a random number between 0 and 255 | |
int randCol() | |
{ |