Add SFML project with Paddle class and miscellaneous utilities
- 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.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user