Add misc and sfml modules with initial implementations, including new classes, assets, and CMake integration.

This commit is contained in:
2026-02-27 16:02:24 +01:00
parent 939e98d5b2
commit 8c726d9cb5
883 changed files with 365 additions and 5 deletions
+64
View File
@@ -0,0 +1,64 @@
#include <iostream>
#include <ostream>
#include <random>
#include <chrono>
#include "inlines.h"
#include "structs_enums_unions.h"
#include "templates.h"
int main() {
int* pI = new int(0);
long* pL = new long(0);
safeDelete<int>(pI);
safeDelete(pL);
Node<int> n1(10);
Node<int> n2(20);
Node<int> n3(30);
n1.next = &n2;
n2.next = &n3;
// structs
Vector3 v1 = { 1.0f, 2.0f, 3.0f };
Vector3 v2 = { 4.0f, 5.0f, 6.0f };
bool isEqual = v1 == v2;
v1 = v1 * 3.0f;
v1 *= 3.0f;
Vector3 v3 = 3.0f * v2;
std::cout << "v1: " << v1 << std::endl;
// enums
Weekdays day = Weekdays::Friday;
std::cout << "day: " << day << std::endl;
// union
ScreenSize screen_size;
screen_size.u.width = 1920;
screen_size.u.height = 1080;
// screen_size.width = 1920;
// screen_size.height = 1080;
std::cout << sizeof(screen_size) << std::endl;
// inline
Value v(42);
v.setValue(69);
std::cout << "Value: " << v.getValue() << std::endl;
// random
// rand(); // old c implementation, don't use it
// srand(time(NULL)); // old c implementation, don't use it
std::default_random_engine generator(std::chrono::system_clock::now().time_since_epoch().count());
std::uniform_int_distribution<int> distribution(0,100);
std::cout << distribution(generator) << std::endl;
for (int i = 0; i < 10; i++) {
std::cout << distribution(generator) << std::endl;
}
return 0;
}