- 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.
39 lines
822 B
C++
39 lines
822 B
C++
#include "ClassA.h"
|
|
#include <list>
|
|
|
|
int main() {
|
|
ClassA a;
|
|
a.Print();
|
|
|
|
ClassA* pA = nullptr;
|
|
pA = new ClassA();
|
|
pA->Print();
|
|
// (*pA).Print(); // same as above, but more complex to write
|
|
delete pA;
|
|
pA = nullptr;
|
|
|
|
a.CompareTo(pA);
|
|
|
|
IComparable* pComparable = nullptr;
|
|
pComparable = new ClassA();
|
|
pComparable->CompareTo(&a);
|
|
// pA = dynamic_cast<ClassA *>(pComparable);
|
|
// if (pA != nullptr) {
|
|
// pA->Print();
|
|
// }
|
|
delete pComparable;
|
|
pComparable = nullptr;
|
|
|
|
ClassA a2 = a;
|
|
|
|
std::list<ClassA> l;
|
|
l.push_back(a);
|
|
l.push_back(a2);
|
|
l.push_back(*pA);
|
|
for (std::list<ClassA>::iterator it = l.begin(); it != l.end(); ++it) {
|
|
// (*it).Print();
|
|
it->Print(); // same as line above, but simpler
|
|
}
|
|
|
|
return 0;
|
|
} |