- Introduced `Paddle` class for player controls in the SFML project. - Added `main.cpp` to demonstrate basic paddle movement and rendering. - Created reusable templates (`templates.h`) and inline class (`inlines.h`) in the `misc` module. - Defined `structs`, `enums`, `unions` in `misc/structs_enums_unions.h`. - Updated CMake configuration for the `sfml` and `misc` modules. - Included new assets for backgrounds, characters, enemies, and tiles.
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#include <random>
|
|
#include <iostream>
|
|
|
|
#include "templates.h"
|
|
#include "structs_enums_unions.h"
|
|
#include "inlines.h"
|
|
|
|
int main() {
|
|
int *pI = new int(0);
|
|
long *pL = new long(0);
|
|
|
|
safeDelete<int>(pI);
|
|
safeDelete(pL);
|
|
|
|
Node<int> n1(1);
|
|
Node<int> n2(2);
|
|
Node<int> n3(3);
|
|
|
|
n1.next = &n2;
|
|
n2.next = &n3;
|
|
|
|
// random
|
|
std::default_random_engine generator;
|
|
std::uniform_int_distribution<int> distribution(1, 100);
|
|
|
|
std::cout << distribution(generator) << std::endl;
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
std::cout << distribution(generator) << std::endl;
|
|
}
|
|
|
|
// enums
|
|
Weekdays weekday = Weekdays::Monday;
|
|
std::cout << "Today is " << weekday << std::endl;
|
|
|
|
// unions
|
|
ScreenSize screen_size;
|
|
screen_size.u.width = 1920;
|
|
screen_size.u.height = 1080;
|
|
|
|
int size = sizeof(screen_size);
|
|
|
|
// structs
|
|
Vector3 v1 = {1.0f, 2.0f, 3.0f};
|
|
Vector3 v2 = {4.0f, 5.0f, 6.0f};
|
|
Vector3 v3 = {7.0f, 8.0f, 9.0f};
|
|
|
|
bool isEqual = v1 == v2;
|
|
std::cout << "v1 == v2: " << isEqual << std::endl;
|
|
std::cout << "v1: " << v1 << std::endl;
|
|
|
|
// inline
|
|
Value v(42);
|
|
std::cout << "Value: " << v.getValue() << std::endl;
|
|
|
|
return 0;
|
|
}
|