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:
@@ -1,8 +1,12 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
typedef std::list<long long> LongLongList;
|
||||
typedef LongLongList::iterator LongLongListIterator;
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
// C array
|
||||
int numbers[5] = {1, 2, 3, 4, 5}; // stack array
|
||||
@@ -35,5 +39,31 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
std::cout << "size of v: " << v.size() << "/" << v.capacity() << std::endl;
|
||||
|
||||
// list
|
||||
std::list<int> l = {1, 2, 3, 4, 5};
|
||||
l.push_front(0);
|
||||
// int n = l[0]; // no random access for list
|
||||
|
||||
std::list<int>::iterator it;
|
||||
for (it = l.begin(); it != l.end(); ++it) {
|
||||
std::cout << *it << std::endl;
|
||||
}
|
||||
|
||||
--it; --it;
|
||||
std::cout << *it << std::endl;
|
||||
l.insert(it, 100);
|
||||
for (it = l.begin(); it != l.end(); ++it) {
|
||||
std::cout << *it << std::endl;
|
||||
}
|
||||
|
||||
--it; --it;
|
||||
l.erase(it);
|
||||
for (it = l.begin(); it != l.end(); ++it) {
|
||||
std::cout << *it << std::endl;
|
||||
}
|
||||
|
||||
LongLongList ll = {1, 2, 3, 4, 5};
|
||||
LongLongListIterator it2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user