code cleanup
This commit is contained in:
parent
e35ddf2ce4
commit
2dcf656af4
|
|
@ -11,6 +11,6 @@ Pos=60,60
|
||||||
Size=536,286
|
Size=536,286
|
||||||
|
|
||||||
[Window][sdfkjasbdf]
|
[Window][sdfkjasbdf]
|
||||||
Pos=679,86
|
Pos=679,85
|
||||||
Size=610,481
|
Size=610,481
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
namespace container
|
namespace container
|
||||||
{
|
{
|
||||||
|
|
||||||
using CapacityType = EntityIndex;
|
using CapacityType = EntityIndex;
|
||||||
using BoolArrayType = u8;
|
using BoolArrayType = u8;
|
||||||
|
|
||||||
|
|
@ -22,69 +23,69 @@ public:
|
||||||
using iterator_category = std::forward_iterator_tag;
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Iterator
|
class iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Iterator(data_type* const input)
|
iterator(data_type* input)
|
||||||
: m_ptr(input)
|
: m_ptr(input)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Iterator& operator++()
|
iterator& operator++()
|
||||||
{ m_ptr++; return *this; }
|
{ m_ptr++; return *this; }
|
||||||
|
|
||||||
Iterator operator++(int)
|
iterator operator++(int)
|
||||||
{ auto it = *this; m_ptr++; return it; }
|
{ auto it = *this; m_ptr++; return it; }
|
||||||
|
|
||||||
Iterator& operator--()
|
iterator& operator--()
|
||||||
{ m_ptr--; return *this; }
|
{ m_ptr--; return *this; }
|
||||||
|
|
||||||
Iterator operator--(int)
|
iterator operator--(int)
|
||||||
{ auto it = *this; m_ptr++; return it; }
|
{ auto it = *this; m_ptr++; return it; }
|
||||||
|
|
||||||
|
|
||||||
reference operator[](const CapacityType index) const { return m_ptr[index]; }
|
reference operator[](CapacityType index) const { return m_ptr[index]; }
|
||||||
pointer operator->() const { return m_ptr; }
|
pointer operator->() const { return m_ptr; }
|
||||||
reference operator*() const { return *m_ptr; }
|
reference operator*() const { return *m_ptr; }
|
||||||
|
|
||||||
bool operator==(const Iterator& other) const { return m_ptr == other.m_ptr; }
|
bool operator==(iterator other) const { return m_ptr == other.m_ptr; }
|
||||||
bool operator!=(const Iterator& other) const { return m_ptr != other.m_ptr; }
|
bool operator!=(iterator other) const { return m_ptr != other.m_ptr; }
|
||||||
private:
|
private:
|
||||||
pointer m_ptr;
|
pointer m_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConstIterator
|
class const_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConstIterator(data_type* const input)
|
const_iterator(data_type* input)
|
||||||
: m_ptr(input)
|
: m_ptr(input)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
ConstIterator& operator++()
|
const_iterator& operator++()
|
||||||
{ m_ptr++; return *this; }
|
{ m_ptr++; return *this; }
|
||||||
|
|
||||||
ConstIterator operator++(int)
|
const_iterator operator++(int)
|
||||||
{ auto it = *this; m_ptr++; return it; }
|
{ auto it = *this; m_ptr++; return it; }
|
||||||
|
|
||||||
ConstIterator& operator--()
|
const_iterator& operator--()
|
||||||
{ m_ptr--; return *this; }
|
{ m_ptr--; return *this; }
|
||||||
|
|
||||||
ConstIterator operator--(int)
|
const_iterator operator--(int)
|
||||||
{ auto it = *this; m_ptr++; return it; }
|
{ auto it = *this; m_ptr++; return it; }
|
||||||
|
|
||||||
|
|
||||||
const_reference operator[](const CapacityType index) const { return m_ptr[index]; }
|
const_reference operator[](CapacityType index) const { return m_ptr[index]; }
|
||||||
const_pointer operator->() const { return m_ptr; }
|
const_pointer operator->() const { return m_ptr; }
|
||||||
const_reference operator*() const { return *m_ptr; }
|
const_reference operator*() const { return *m_ptr; }
|
||||||
|
|
||||||
bool operator==(const ConstIterator& other) const { return m_ptr == other.m_ptr; }
|
bool operator==(const_iterator other) const { return m_ptr == other.m_ptr; }
|
||||||
bool operator!=(const ConstIterator& other) const { return m_ptr != other.m_ptr; }
|
bool operator!=(const_iterator other) const { return m_ptr != other.m_ptr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pointer m_ptr;
|
pointer m_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Array() { m_data = new T[capacity]; }
|
Array() { m_data = new T[capacity]{}; }
|
||||||
|
|
||||||
~Array() { delete[] m_data; }
|
~Array() { delete[] m_data; }
|
||||||
|
|
||||||
|
|
@ -114,9 +115,9 @@ public:
|
||||||
|
|
||||||
const_pointer cosntData() const { return m_data; }
|
const_pointer cosntData() const { return m_data; }
|
||||||
|
|
||||||
reference operator[](const CapacityType index) { return m_data[index]; }
|
reference operator[](CapacityType index) { return m_data[index]; }
|
||||||
|
|
||||||
const_reference operator[](const CapacityType index) const { return m_data[index]; }
|
const_reference operator[](CapacityType index) const { return m_data[index]; }
|
||||||
|
|
||||||
pointer operator->() { return m_data; }
|
pointer operator->() { return m_data; }
|
||||||
|
|
||||||
|
|
@ -128,11 +129,11 @@ public:
|
||||||
|
|
||||||
inline constexpr CapacityType size() const { return capacity; }
|
inline constexpr CapacityType size() const { return capacity; }
|
||||||
|
|
||||||
Iterator begin() { return Iterator(m_data); }
|
iterator begin() { return iterator(m_data); }
|
||||||
Iterator end() { return Iterator(m_data + capacity); }
|
iterator end() { return iterator(m_data + capacity); }
|
||||||
|
|
||||||
ConstIterator begin() const { return ConstIterator(m_data); }
|
const_iterator begin() const { return const_iterator(m_data); }
|
||||||
ConstIterator end() const { return ConstIterator(m_data + capacity); }
|
const_iterator end() const { return const_iterator(m_data + capacity); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pointer m_data;
|
pointer m_data;
|
||||||
|
|
@ -145,10 +146,9 @@ class Array<bool, capacity>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class reference;
|
class reference;
|
||||||
class const_reference;
|
|
||||||
using data_type = BoolArrayType;
|
|
||||||
using pointer = reference;
|
using pointer = reference;
|
||||||
using const_pointer = const_reference;
|
using const_reference = bool;
|
||||||
|
using data_type = BoolArrayType;
|
||||||
using difference_type = std::ptrdiff_t;
|
using difference_type = std::ptrdiff_t;
|
||||||
using iterator_category = std::forward_iterator_tag;
|
using iterator_category = std::forward_iterator_tag;
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ public:
|
||||||
class reference
|
class reference
|
||||||
{
|
{
|
||||||
friend class Array;
|
friend class Array;
|
||||||
reference(data_type* const ptr_in, const data_type mask_in)
|
reference(data_type* ptr_in, data_type mask_in)
|
||||||
: m_ptr(ptr_in)
|
: m_ptr(ptr_in)
|
||||||
, m_mask(mask_in)
|
, m_mask(mask_in)
|
||||||
{
|
{
|
||||||
|
|
@ -167,14 +167,14 @@ public:
|
||||||
~reference()
|
~reference()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
reference(const reference&) = default;
|
reference(reference&) = default;
|
||||||
|
|
||||||
operator bool () const
|
operator bool () const
|
||||||
{
|
{
|
||||||
return !!(*m_ptr & m_mask);
|
return !!(*m_ptr & m_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
reference& operator=(const bool input)
|
reference& operator=(bool input)
|
||||||
{
|
{
|
||||||
switch ((int)input)
|
switch ((int)input)
|
||||||
{
|
{
|
||||||
|
|
@ -182,7 +182,7 @@ public:
|
||||||
*m_ptr |= m_mask;
|
*m_ptr |= m_mask;
|
||||||
break;
|
break;
|
||||||
case false:
|
case false:
|
||||||
*m_ptr &= m_mask;
|
*m_ptr &= ~m_mask;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -203,42 +203,44 @@ public:
|
||||||
const data_type m_mask;
|
const data_type m_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
class const_reference
|
|
||||||
{
|
|
||||||
friend class Array;
|
|
||||||
const_reference(const data_type* ptr_in, const data_type mask_in)
|
|
||||||
: m_ptr(ptr_in)
|
|
||||||
, m_mask(mask_in)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
public:
|
//class const_reference
|
||||||
~const_reference()
|
//{
|
||||||
{ }
|
// friend class Array;
|
||||||
|
// const_reference(const data_type* ptr_in, const data_type mask_in)
|
||||||
|
// : m_ptr(ptr_in)
|
||||||
|
// , m_mask(mask_in)
|
||||||
|
// { }
|
||||||
|
|
||||||
const_reference(const const_reference&) = delete;
|
//public:
|
||||||
|
// ~const_reference()
|
||||||
|
// { }
|
||||||
|
|
||||||
operator bool () const { return !!(*m_ptr & m_mask); }
|
// const_reference(const const_reference&) = delete;
|
||||||
|
|
||||||
const_reference& operator=(bool) = delete;
|
// operator bool () const { return !!(*m_ptr & m_mask); }
|
||||||
|
|
||||||
const_reference& operator=(const const_reference& other) = delete;
|
// const_reference& operator=(bool) = delete;
|
||||||
const_reference& operator=(const reference& other) = delete;
|
|
||||||
|
|
||||||
private:
|
// const_reference& operator=(const const_reference& other) = delete;
|
||||||
const data_type* const m_ptr;
|
// const_reference& operator=(const reference& other) = delete;
|
||||||
const data_type m_mask;
|
|
||||||
};
|
//private:
|
||||||
|
// const data_type* const m_ptr;
|
||||||
|
// const data_type m_mask;
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
class Iterator
|
|
||||||
|
class iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Iterator(data_type* const input, const data_type index)
|
iterator(const data_type* input, data_type index)
|
||||||
: m_ptr(input)
|
: m_ptr(input)
|
||||||
, m_bitIndex(index)
|
, m_bitIndex(index)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Iterator& operator++()
|
iterator& operator++()
|
||||||
{
|
{
|
||||||
switch (m_bitIndex++)
|
switch (m_bitIndex++)
|
||||||
{
|
{
|
||||||
|
|
@ -253,7 +255,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator operator++(int)
|
iterator operator++(int)
|
||||||
{
|
{
|
||||||
auto it = *this;
|
auto it = *this;
|
||||||
switch (m_bitIndex++)
|
switch (m_bitIndex++)
|
||||||
|
|
@ -269,7 +271,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator& operator--()
|
iterator& operator--()
|
||||||
{
|
{
|
||||||
switch (m_bitIndex--)
|
switch (m_bitIndex--)
|
||||||
{
|
{
|
||||||
|
|
@ -284,7 +286,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator operator--(int)
|
iterator operator--(int)
|
||||||
{
|
{
|
||||||
auto it = *this;
|
auto it = *this;
|
||||||
switch (m_bitIndex--)
|
switch (m_bitIndex--)
|
||||||
|
|
@ -300,18 +302,22 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator[](const int) = delete;
|
reference operator[](CapacityType index)
|
||||||
|
{
|
||||||
|
return reference(m_ptr + (index / 7), m_bitIndex + (index % 8));
|
||||||
|
}
|
||||||
|
|
||||||
reference operator*() const
|
reference operator*() const
|
||||||
{
|
{
|
||||||
return reference(m_ptr, 1 << m_bitIndex);
|
return reference(m_ptr, 1 << m_bitIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const Iterator& other) const
|
bool operator==(const iterator& other) const
|
||||||
{
|
{
|
||||||
return (m_ptr == other.m_ptr) && (m_bitIndex == other.m_bitIndex);
|
return (m_ptr == other.m_ptr) && (m_bitIndex == other.m_bitIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Iterator& other) const
|
bool operator!=(const iterator& other) const
|
||||||
{
|
{
|
||||||
return (m_ptr != other.m_ptr) || (m_bitIndex != other.m_bitIndex);
|
return (m_ptr != other.m_ptr) || (m_bitIndex != other.m_bitIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -321,15 +327,15 @@ public:
|
||||||
data_type m_bitIndex{};
|
data_type m_bitIndex{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConstIterator
|
class const_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConstIterator(const data_type* input, const data_type index)
|
const_iterator(const data_type* input, data_type index)
|
||||||
: m_ptr(input)
|
: m_ptr(input)
|
||||||
, m_bitIndex(index)
|
, m_bitIndex(index)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
ConstIterator& operator++()
|
const_iterator& operator++()
|
||||||
{
|
{
|
||||||
switch (m_bitIndex++)
|
switch (m_bitIndex++)
|
||||||
{
|
{
|
||||||
|
|
@ -344,7 +350,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstIterator operator++(int)
|
const_iterator operator++(int)
|
||||||
{
|
{
|
||||||
auto it = *this;
|
auto it = *this;
|
||||||
switch (m_bitIndex++)
|
switch (m_bitIndex++)
|
||||||
|
|
@ -360,7 +366,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstIterator& operator--()
|
const_iterator& operator--()
|
||||||
{
|
{
|
||||||
switch (m_bitIndex--)
|
switch (m_bitIndex--)
|
||||||
{
|
{
|
||||||
|
|
@ -375,7 +381,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstIterator operator--(int)
|
const_iterator operator--(int)
|
||||||
{
|
{
|
||||||
auto it = *this;
|
auto it = *this;
|
||||||
switch (m_bitIndex--)
|
switch (m_bitIndex--)
|
||||||
|
|
@ -391,15 +397,17 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator[](const int) = delete;
|
const_reference operator[](CapacityType index) const
|
||||||
|
{ return (m_ptr + (index / 8)) & (1 << (index % 8)); }
|
||||||
|
|
||||||
const_reference operator*() const
|
const_reference operator*() const
|
||||||
{ return const_reference(m_ptr, 1 << m_bitIndex); }
|
{ return *m_ptr & (1 << m_bitIndex); }
|
||||||
|
|
||||||
bool operator==(const ConstIterator& other) const
|
bool operator==(const const_iterator& other) const
|
||||||
{ return (m_ptr == other.m_ptr) && (m_bitIndex == other.m_bitIndex); }
|
{ return (m_ptr == other.m_ptr) && (m_bitIndex == other.m_bitIndex); }
|
||||||
|
|
||||||
|
|
||||||
bool operator!=(const ConstIterator& other) const
|
bool operator!=(const const_iterator& other) const
|
||||||
{ return (m_ptr != other.m_ptr) || (m_bitIndex != other.m_bitIndex); }
|
{ return (m_ptr != other.m_ptr) || (m_bitIndex != other.m_bitIndex); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -408,7 +416,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Array() { m_data = new data_type[(capacity / 8) + 1]; }
|
Array() { m_data = new data_type[(capacity / 8) + 1]{}; }
|
||||||
|
|
||||||
~Array() { delete[] m_data; }
|
~Array() { delete[] m_data; }
|
||||||
|
|
||||||
|
|
@ -433,20 +441,19 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reference operator[](CapacityType index)
|
||||||
//use readAt() instead
|
|
||||||
reference operator[](const CapacityType index)
|
|
||||||
{ return reference(m_data + (index / 8), 1 << (index % 8)); }
|
{ return reference(m_data + (index / 8), 1 << (index % 8)); }
|
||||||
|
|
||||||
|
|
||||||
const_reference operator[](const CapacityType index) const
|
const_reference operator[](CapacityType index) const
|
||||||
{ return reference(m_data + (index / 8), 1 << (index % 8)); }
|
{ return m_data[index / 8] & (1 << (index % 8)); }
|
||||||
|
|
||||||
inline constexpr CapacityType size() { return capacity; }
|
inline constexpr CapacityType size() { return capacity; }
|
||||||
|
|
||||||
bool readAt(const CapacityType index) const { return m_data[index / 8] & (1 << (index % 8)); }
|
const_reference readAt(CapacityType index) const
|
||||||
|
{ return m_data[index / 8] & (1 << (index % 8)); }
|
||||||
|
|
||||||
void changeAt(const CapacityType index, const bool input)
|
void changeAt(CapacityType index, bool input)
|
||||||
{
|
{
|
||||||
switch ((int)input)
|
switch ((int)input)
|
||||||
{
|
{
|
||||||
|
|
@ -459,11 +466,11 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator begin() { return Iterator(m_data, 0); }
|
iterator begin() { return iterator(m_data, 0); }
|
||||||
Iterator end() { return Iterator(m_data + (capacity / 8), capacity % 8); }
|
iterator end() { return iterator(m_data + (capacity / 8), capacity % 8); }
|
||||||
|
|
||||||
ConstIterator begin() const { return ConstIterator(m_data, 0); }
|
const_iterator begin() const { return const_iterator(m_data, 0); }
|
||||||
ConstIterator end() const { return ConstIterator(m_data + (capacity / 8), capacity % 8); }
|
const_iterator end() const { return const_iterator(m_data + (capacity / 8), capacity % 8); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
data_type* m_data;
|
data_type* m_data;
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,13 @@ public:
|
||||||
class Texture : public Component
|
class Texture : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
sf::Texture& texture;
|
Texture() = default;
|
||||||
|
int texture{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class BoundingBox : public Component
|
class BoundingBox : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
BoundingBox() = default;
|
||||||
sf::FloatRect bBox{};
|
sf::FloatRect bBox{};
|
||||||
};
|
};
|
||||||
|
|
@ -3,16 +3,15 @@
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
class EntityManager;
|
class EntityManager;
|
||||||
class EntityViewIterator;
|
class EntityView;
|
||||||
class EntityViewConstIterator;
|
class EntityMemoryPool;
|
||||||
|
|
||||||
class Entity
|
class Entity
|
||||||
{
|
{
|
||||||
//private:
|
|
||||||
public:
|
public:
|
||||||
friend class EntityManager;
|
friend class EntityManager;
|
||||||
friend class EntityViewIterator;
|
friend class EntityView;
|
||||||
friend class EntityViewConstIterator;
|
friend class EntityMemoryPool;
|
||||||
|
|
||||||
Entity() = delete;
|
Entity() = delete;
|
||||||
Entity(EntityIndex);
|
Entity(EntityIndex);
|
||||||
|
|
@ -25,14 +24,11 @@ public:
|
||||||
T& getComponent() const;
|
T& getComponent() const;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& getComponent();
|
void addComponent(const T&);
|
||||||
|
|
||||||
template<typename T>
|
size_t id() const;
|
||||||
void addComponent(const T&&);
|
|
||||||
|
|
||||||
EntityIndex id() const;
|
Tag tag() const;
|
||||||
|
|
||||||
EntityTag tag() const;
|
|
||||||
|
|
||||||
bool isAlive() const;
|
bool isAlive() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,18 @@
|
||||||
#include "Entities/EntityView.h"
|
#include "Entities/EntityView.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include <Entities/EntityMemoryPool.h>
|
#include <Entities/EntityMemoryPool.h>
|
||||||
#include <array>
|
#include <Containers.h>
|
||||||
|
|
||||||
class EntityManager
|
class EntityManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void update();
|
void update();
|
||||||
private:
|
|
||||||
EntityView getEntiites(EntityTag);
|
EntityView getEntiites(Tag);
|
||||||
|
|
||||||
inline Entity player();
|
inline Entity player();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Entity m_player{0};
|
EntityIndex m_numEntitiesByTag[util::TAG_COUNT];
|
||||||
std::array<u16, tagCount> m_numEntitiesByTag{};
|
|
||||||
u16 m_numEntities{};
|
u16 m_numEntities{};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,73 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "utility.h"
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <Entities/Components.h>
|
#include <Entities/Components.h>
|
||||||
#include <Entities/Entity.h>
|
#include <Containers.h>
|
||||||
|
#include <utility.h>
|
||||||
|
|
||||||
using ComponentVectorTuple = std::tuple
|
class EntityManager;
|
||||||
|
class Entity;
|
||||||
|
|
||||||
|
using ComponentsContainer = std::tuple
|
||||||
<
|
<
|
||||||
std::vector<Transform>,
|
container::Array<Transform, util::MAX_ENTITIES>,
|
||||||
std::vector<Texture>,
|
container::Array<Texture, util::MAX_ENTITIES>,
|
||||||
std::vector<BoundingBox>
|
container::Array<BoundingBox, util::MAX_ENTITIES>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
class EntityMemoryPool
|
class EntityMemoryPool
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ComponentVectorTuple m_components;
|
friend class EntityManager;
|
||||||
std::vector<EntityTag> m_tags;
|
friend class Entity;
|
||||||
std::vector<bool> m_aliveStates;
|
|
||||||
std::vector<size_t> m_ids;
|
ComponentsContainer m_components;
|
||||||
|
container::Array<Tag, util::MAX_ENTITIES> m_tags;
|
||||||
|
container::Array<bool, util::MAX_ENTITIES> m_aliveStates;
|
||||||
|
container::Array<size_t, util::MAX_ENTITIES> m_ids;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EntityMemoryPool();
|
EntityMemoryPool();
|
||||||
|
|
||||||
EntityMemoryPool(const EntityMemoryPool&) = delete;
|
EntityMemoryPool(const EntityMemoryPool&) = delete;
|
||||||
|
|
||||||
public:
|
static EntityMemoryPool& instance()
|
||||||
static EntityMemoryPool& instance();
|
{
|
||||||
|
static EntityMemoryPool pool{};
|
||||||
|
return pool;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool hasComponent(EntityIndex) const;
|
bool hasComponent(EntityIndex index) const
|
||||||
|
{ return std::get<container::Array<T, util::MAX_ENTITIES>>(m_components)[index].active; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& getComponent(EntityIndex) const;
|
T& getComponent(EntityIndex index)
|
||||||
|
{
|
||||||
|
return std::get<container::Array<T, util::MAX_ENTITIES>>(m_components)[index];
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
Tag getTag(EntityIndex index) const
|
||||||
T& getComponent(EntityIndex);
|
{
|
||||||
|
return m_tags[index];
|
||||||
|
}
|
||||||
|
|
||||||
EntityTag getTag(EntityIndex) const;
|
bool getAlive(EntityIndex index) const
|
||||||
|
{
|
||||||
|
return m_aliveStates[index];
|
||||||
|
}
|
||||||
|
|
||||||
bool getAlive(EntityIndex) const;
|
size_t& getId(EntityIndex index)
|
||||||
|
{
|
||||||
|
return m_ids[index];
|
||||||
|
}
|
||||||
|
|
||||||
size_t getId(EntityIndex) const;
|
void removeEntity(EntityIndex index)
|
||||||
|
{
|
||||||
void removeEntity(EntityIndex);
|
m_aliveStates[index] = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -3,59 +3,6 @@
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include <Entities/Entity.h>
|
#include <Entities/Entity.h>
|
||||||
|
|
||||||
class EntityView;
|
|
||||||
|
|
||||||
class EntityViewIterator
|
|
||||||
{
|
|
||||||
friend class EntityView;
|
|
||||||
|
|
||||||
EntityViewIterator(EntityIndex);
|
|
||||||
|
|
||||||
EntityViewIterator& operator++();
|
|
||||||
|
|
||||||
EntityViewIterator operator++(int);
|
|
||||||
|
|
||||||
EntityViewIterator& operator--();
|
|
||||||
|
|
||||||
EntityViewIterator operator--(int);
|
|
||||||
|
|
||||||
Entity operator*();
|
|
||||||
|
|
||||||
Entity operator[](int);
|
|
||||||
|
|
||||||
bool operator==(EntityViewIterator);
|
|
||||||
bool operator!=(EntityViewIterator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
EntityIndex m_currentEntity;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EntityViewConstIterator
|
|
||||||
{
|
|
||||||
friend class EntityView;
|
|
||||||
|
|
||||||
EntityViewConstIterator(EntityIndex index);
|
|
||||||
|
|
||||||
EntityViewConstIterator& operator++();
|
|
||||||
|
|
||||||
EntityViewConstIterator operator++(int);
|
|
||||||
|
|
||||||
EntityViewConstIterator& operator--();
|
|
||||||
|
|
||||||
EntityViewConstIterator operator--(int);
|
|
||||||
|
|
||||||
const Entity operator*();
|
|
||||||
|
|
||||||
const Entity operator[](int index);
|
|
||||||
|
|
||||||
|
|
||||||
bool operator==(EntityViewConstIterator);
|
|
||||||
bool operator!=(EntityViewConstIterator);
|
|
||||||
|
|
||||||
private:
|
|
||||||
EntityIndex m_currentEntity;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EntityView
|
class EntityView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -63,8 +10,40 @@ public:
|
||||||
EntityView() = delete;
|
EntityView() = delete;
|
||||||
EntityView(EntityIndex, EntityIndex);
|
EntityView(EntityIndex, EntityIndex);
|
||||||
|
|
||||||
using iterator = EntityViewIterator;
|
|
||||||
using const_iterator = EntityViewConstIterator;
|
class iterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
iterator(EntityIndex);
|
||||||
|
iterator& operator++();
|
||||||
|
iterator operator++(int);
|
||||||
|
iterator& operator--();
|
||||||
|
iterator operator--(int);
|
||||||
|
Entity operator*();
|
||||||
|
Entity operator[](int);
|
||||||
|
bool operator==(iterator);
|
||||||
|
bool operator!=(iterator);
|
||||||
|
private:
|
||||||
|
EntityIndex m_currentEntity;
|
||||||
|
};
|
||||||
|
|
||||||
|
class const_iterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const_iterator(EntityIndex index);
|
||||||
|
const_iterator& operator++();
|
||||||
|
const_iterator operator++(int);
|
||||||
|
const_iterator& operator--();
|
||||||
|
const_iterator operator--(int);
|
||||||
|
const Entity operator*();
|
||||||
|
const Entity operator[](int index);
|
||||||
|
bool operator==(const_iterator);
|
||||||
|
bool operator!=(const_iterator);
|
||||||
|
private:
|
||||||
|
EntityIndex m_currentEntity;
|
||||||
|
};
|
||||||
|
|
||||||
|
Entity operator[](EntityIndex) const;
|
||||||
|
|
||||||
iterator begin() { return iterator(m_start); }
|
iterator begin() { return iterator(m_start); }
|
||||||
iterator end() { return iterator(m_start + m_size); }
|
iterator end() { return iterator(m_start + m_size); }
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,11 @@ using s8 = int8_t;
|
||||||
using s16 = int16_t;
|
using s16 = int16_t;
|
||||||
using s32 = int32_t;
|
using s32 = int32_t;
|
||||||
using s64 = int64_t;
|
using s64 = int64_t;
|
||||||
|
using tag_type = u8;
|
||||||
|
|
||||||
using EntityIndex = u16;
|
using EntityIndex = u16;
|
||||||
|
|
||||||
enum EntityTag : u8
|
enum class Tag : tag_type
|
||||||
{
|
{
|
||||||
player,
|
player,
|
||||||
tile,
|
tile,
|
||||||
|
|
@ -23,8 +24,6 @@ enum EntityTag : u8
|
||||||
tagCount
|
tagCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace util
|
namespace util
|
||||||
{
|
{
|
||||||
using namespace std::string_view_literals;
|
using namespace std::string_view_literals;
|
||||||
|
|
@ -33,28 +32,36 @@ namespace util
|
||||||
inline constexpr EntityIndex MAX_TILES {1'000u};
|
inline constexpr EntityIndex MAX_TILES {1'000u};
|
||||||
inline constexpr EntityIndex MAX_ENEMIES {1'000u};
|
inline constexpr EntityIndex MAX_ENEMIES {1'000u};
|
||||||
inline constexpr EntityIndex MAX_ENTITIES {MAX_PLAYERS + MAX_TILES + MAX_ENEMIES};
|
inline constexpr EntityIndex MAX_ENTITIES {MAX_PLAYERS + MAX_TILES + MAX_ENEMIES};
|
||||||
|
inline constexpr tag_type TAG_COUNT {(tag_type)Tag::tagCount};
|
||||||
|
|
||||||
// used for imgui
|
// used for imgui
|
||||||
inline constexpr std::array<const char*, tagCount> tagStringsC =
|
inline constexpr char* tagStringsC[TAG_COUNT] =
|
||||||
{
|
{
|
||||||
"player",
|
"player",
|
||||||
"tile",
|
"tile",
|
||||||
"enemy"
|
"enemy",
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr std::array<std::string_view, tagCount> tagStrings =
|
inline constexpr std::string_view tagStrings[TAG_COUNT] =
|
||||||
{
|
{
|
||||||
"player"sv,
|
"player"sv,
|
||||||
"tile"sv,
|
"tile"sv,
|
||||||
"enemy"sv
|
"enemy"sv,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr std::array<EntityIndex, tagCount> tagStart =
|
inline constexpr EntityIndex tagStart[TAG_COUNT] =
|
||||||
{
|
{
|
||||||
0,//player
|
0,//player
|
||||||
1,//tile start
|
1,//tile start
|
||||||
MAX_TILES,//enemy start
|
MAX_TILES,//enemy start
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline constexpr EntityIndex tagSize[TAG_COUNT] =
|
||||||
|
{
|
||||||
|
MAX_PLAYERS,
|
||||||
|
MAX_TILES,
|
||||||
|
MAX_ENEMIES,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,12 +153,13 @@ project "2d-platformer"
|
||||||
|
|
||||||
--config settings
|
--config settings
|
||||||
filter "configurations:debug"
|
filter "configurations:debug"
|
||||||
defines"LOG_ENABLE"
|
defines {"LOG_ENABLE", "GAME_DEBUG"}
|
||||||
symbols "on"
|
symbols "on"
|
||||||
runtime "Debug"
|
runtime "Debug"
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
|
|
||||||
filter "configurations:release"
|
filter "configurations:release"
|
||||||
|
defines {"GAME_RELEASE"}
|
||||||
optimize "Speed"
|
optimize "Speed"
|
||||||
inlining "Auto"
|
inlining "Auto"
|
||||||
symbols "off"
|
symbols "off"
|
||||||
|
|
|
||||||
|
|
@ -23,25 +23,19 @@ T& Entity::getComponent() const
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& Entity::getComponent()
|
void Entity::addComponent(const T& data)
|
||||||
{
|
|
||||||
return EntityMemoryPool::instance().getComponent<T>(m_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void Entity::addComponent(const T&& data)
|
|
||||||
{
|
{
|
||||||
T& component = EntityMemoryPool::instance().getComponent<T>(m_index);
|
T& component = EntityMemoryPool::instance().getComponent<T>(m_index);
|
||||||
component = data;
|
component = data;
|
||||||
component.active = true;
|
component.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityIndex Entity::id() const
|
size_t Entity::id() const
|
||||||
{
|
{
|
||||||
return EntityMemoryPool::instance().getId(m_index);
|
return EntityMemoryPool::instance().getId(m_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityTag Entity::tag() const
|
Tag Entity::tag() const
|
||||||
{
|
{
|
||||||
return EntityMemoryPool::instance().getTag(m_index);
|
return EntityMemoryPool::instance().getTag(m_index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
#include "Entities/EntityView.h"
|
#include "Entities/EntityView.h"
|
||||||
#include "utility.h"
|
|
||||||
#include <Entities/EntityManager.h>
|
#include <Entities/EntityManager.h>
|
||||||
#include <Entities/Entity.h>
|
#include <Entities/Entity.h>
|
||||||
|
|
||||||
inline constexpr EntityIndex PLAYER_INDEX = 0;
|
#include "utility.h"
|
||||||
|
|
||||||
|
inline constexpr EntityIndex PLAYER_INDEX = util::tagStart[(tag_type)Tag::player];
|
||||||
|
|
||||||
void EntityManager::update()
|
void EntityManager::update()
|
||||||
{
|
{
|
||||||
|
|
@ -12,10 +13,10 @@ void EntityManager::update()
|
||||||
|
|
||||||
inline Entity EntityManager::player()
|
inline Entity EntityManager::player()
|
||||||
{
|
{
|
||||||
return m_player;
|
return Entity(PLAYER_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityView EntityManager::getEntiites(EntityTag tag)
|
EntityView EntityManager::getEntiites(Tag tag)
|
||||||
{
|
{
|
||||||
return EntityView(util::tagStart[tag], m_numEntitiesByTag[tag]);
|
return EntityView(util::tagStart[(tag_type)tag], m_numEntitiesByTag[(tag_type)tag]);
|
||||||
}
|
}
|
||||||
|
|
@ -4,55 +4,22 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
#include <Entities/EntityView.h>
|
||||||
|
|
||||||
EntityMemoryPool::EntityMemoryPool()
|
EntityMemoryPool::EntityMemoryPool()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
std::apply([=](auto&&... args) {((args.reserve(util::MAX_ENTITIES)), ...); }, m_components);
|
std::apply([=](auto&&... args) {((args.reserve(util::MAX_ENTITIES)), ...); }, m_components);
|
||||||
m_tags.reserve(util::MAX_ENTITIES);
|
m_tags.reserve(util::MAX_ENTITIES);
|
||||||
m_aliveStates.reserve(util::MAX_ENTITIES);
|
m_aliveStates.reserve(util::MAX_ENTITIES);
|
||||||
}
|
*/
|
||||||
|
|
||||||
EntityMemoryPool& EntityMemoryPool::instance()
|
for (int i = 0; i < util::TAG_COUNT; i++)
|
||||||
{
|
{
|
||||||
static EntityMemoryPool pool{};
|
EntityView x(util::tagStart[i], util::tagSize[i]);
|
||||||
return pool;
|
for (auto entity : x)
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
bool EntityMemoryPool::hasComponent(EntityIndex index) const
|
|
||||||
{
|
{
|
||||||
return std::get<std::vector<T>>(m_components)[index].active;
|
m_tags[entity.m_index] = (Tag)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& EntityMemoryPool::getComponent(EntityIndex index) const
|
|
||||||
{
|
|
||||||
return std::get<std::vector<T>>(m_components)[index];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& EntityMemoryPool::getComponent(EntityIndex index)
|
|
||||||
{
|
|
||||||
return std::get<std::vector<T>>(m_components)[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTag EntityMemoryPool::getTag(EntityIndex index) const
|
|
||||||
{
|
|
||||||
return m_tags[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EntityMemoryPool::getAlive(EntityIndex index) const
|
|
||||||
{
|
|
||||||
return m_aliveStates[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t EntityMemoryPool::getId(EntityIndex index) const
|
|
||||||
{
|
|
||||||
return m_ids[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityMemoryPool::removeEntity(EntityIndex index)
|
|
||||||
{
|
|
||||||
m_aliveStates[index] = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
@ -5,109 +5,111 @@
|
||||||
EntityView::EntityView(EntityIndex start, EntityIndex size)
|
EntityView::EntityView(EntityIndex start, EntityIndex size)
|
||||||
: m_start(start)
|
: m_start(start)
|
||||||
, m_size(size)
|
, m_size(size)
|
||||||
{
|
{ }
|
||||||
|
|
||||||
|
Entity EntityView::operator[](EntityIndex index) const
|
||||||
|
{
|
||||||
|
return Entity(m_start + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//non-const iterator
|
//non-const iterator
|
||||||
EntityViewIterator::EntityViewIterator(EntityIndex index)
|
EntityView::iterator::iterator(EntityIndex index)
|
||||||
: m_currentEntity(index)
|
: m_currentEntity(index)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewIterator& EntityViewIterator::operator++()
|
EntityView::iterator& EntityView::iterator::operator++()
|
||||||
{
|
{
|
||||||
m_currentEntity++;
|
m_currentEntity++;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewIterator EntityViewIterator::operator++(int)
|
EntityView::iterator EntityView::iterator::operator++(int)
|
||||||
{
|
{
|
||||||
m_currentEntity++;
|
m_currentEntity++;
|
||||||
return m_currentEntity - 1;
|
return m_currentEntity - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewIterator& EntityViewIterator::operator--()
|
EntityView::iterator& EntityView::iterator::operator--()
|
||||||
{
|
{
|
||||||
m_currentEntity--;
|
m_currentEntity--;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewIterator EntityViewIterator::operator--(int)
|
EntityView::iterator EntityView::iterator::operator--(int)
|
||||||
{
|
{
|
||||||
m_currentEntity--;
|
m_currentEntity--;
|
||||||
return m_currentEntity + 1;
|
return m_currentEntity + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity EntityViewIterator::operator*()
|
Entity EntityView::iterator::operator*()
|
||||||
{
|
{
|
||||||
return m_currentEntity;
|
return m_currentEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity EntityViewIterator::operator[](int index)
|
Entity EntityView::iterator::operator[](int index)
|
||||||
{
|
{
|
||||||
return m_currentEntity + index;
|
return m_currentEntity + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityViewIterator::operator==(EntityViewIterator other)
|
bool EntityView::iterator::operator==(iterator other)
|
||||||
{
|
{
|
||||||
return m_currentEntity == other.m_currentEntity;
|
return m_currentEntity == other.m_currentEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityViewIterator::operator!=(EntityViewIterator other)
|
bool EntityView::iterator::operator!=(iterator other)
|
||||||
{
|
{
|
||||||
return m_currentEntity != other.m_currentEntity;
|
return m_currentEntity != other.m_currentEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
//const iterator
|
//const iterator
|
||||||
EntityViewConstIterator::EntityViewConstIterator(EntityIndex index)
|
EntityView::const_iterator::const_iterator(EntityIndex index)
|
||||||
: m_currentEntity(index)
|
: m_currentEntity(index)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewConstIterator& EntityViewConstIterator::operator++()
|
EntityView::const_iterator& EntityView::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
m_currentEntity++;
|
m_currentEntity++;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewConstIterator EntityViewConstIterator::operator++(int)
|
EntityView::const_iterator EntityView::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
m_currentEntity++;
|
m_currentEntity++;
|
||||||
return m_currentEntity - 1;
|
return m_currentEntity - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewConstIterator& EntityViewConstIterator::operator--()
|
EntityView::const_iterator& EntityView::const_iterator::operator--()
|
||||||
{
|
{
|
||||||
m_currentEntity--;
|
m_currentEntity--;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityViewConstIterator EntityViewConstIterator::operator--(int)
|
EntityView::const_iterator EntityView::const_iterator::operator--(int)
|
||||||
{
|
{
|
||||||
m_currentEntity--;
|
m_currentEntity--;
|
||||||
return m_currentEntity + 1;
|
return m_currentEntity + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Entity EntityViewConstIterator::operator*()
|
const Entity EntityView::const_iterator::operator*()
|
||||||
{
|
{
|
||||||
return m_currentEntity;
|
return m_currentEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Entity EntityViewConstIterator::operator[](int index)
|
const Entity EntityView::const_iterator::operator[](int index)
|
||||||
{
|
{
|
||||||
return m_currentEntity + index;
|
return m_currentEntity + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityViewConstIterator::operator==(EntityViewConstIterator other)
|
bool EntityView::const_iterator::operator==(EntityView::const_iterator other)
|
||||||
{
|
{
|
||||||
return m_currentEntity == other.m_currentEntity;
|
return m_currentEntity == other.m_currentEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityViewConstIterator::operator!=(EntityViewConstIterator other)
|
bool EntityView::const_iterator::operator!=(EntityView::const_iterator other)
|
||||||
{
|
{
|
||||||
return m_currentEntity != other.m_currentEntity;
|
return m_currentEntity != other.m_currentEntity;
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "Containers/Array.h"
|
#include "Containers.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
#include <imgui-SFML.h>
|
#include <imgui-SFML.h>
|
||||||
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
container::Array<bool, 3> arr;
|
|
||||||
|
|
||||||
auto window = sf::RenderWindow(sf::VideoMode({ 1920u, 1080u }), "Fake Mario");
|
auto window = sf::RenderWindow(sf::VideoMode({ 1920u, 1080u }), "Fake Mario");
|
||||||
window.setFramerateLimit(144);
|
window.setFramerateLimit(144);
|
||||||
if (!ImGui::SFML::Init(window))
|
if (!ImGui::SFML::Init(window))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue