Created
January 4, 2019 16:08
-
-
Save kim366/72635fa385b38d46681fe5767cca3919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include <Identifiers.hpp> | |
| #include <Inputs.hpp> | |
| #include <SFML/Graphics/Drawable.hpp> | |
| #include <SFML/Graphics/RenderWindow.hpp> | |
| #include <SFML/Graphics/Transformable.hpp> | |
| #include <SFML/Graphics/View.hpp> | |
| #include <SFML/System/Vector2.hpp> | |
| #include <Utility.hpp> | |
| #include <entityx/Entity.h> | |
| #include <iostream> | |
| #include <memory> | |
| namespace ex = entityx; | |
| template<typename T> | |
| struct SingleValue | |
| { | |
| operator T&() { return data; } | |
| T& operator*() { return data; } | |
| const T& operator*() const { return data; } | |
| T* operator->() { return &data; } | |
| const T* operator->() const { return &data; } | |
| T data; | |
| }; | |
| struct CTransformable : SingleValue<sf::Transformable> | |
| { | |
| sf::Transformable previous_frame; | |
| }; | |
| struct CMaxSpeed : SingleValue<float> | |
| { | |
| }; | |
| struct CVelocity : SingleValue<sf::Vector2f> | |
| { | |
| }; | |
| struct CFov : SingleValue<float> | |
| { | |
| }; | |
| struct CUserInput | |
| { | |
| const Inputs& inputs; | |
| }; | |
| struct CDrawable : SingleValue<std::shared_ptr<sf::Drawable>> | |
| { | |
| unsigned layer; | |
| }; | |
| struct CTransparency : SingleValue<float> | |
| { | |
| }; | |
| struct CParentEntity : SingleValue<ex::Entity> | |
| { | |
| }; | |
| struct CAttachedEntities | |
| { | |
| CAttachedEntities(ex::Entity owning_entity_, | |
| std::vector<ex::Entity>&& entities_) | |
| : entities{std::move(entities_)} | |
| { | |
| for (auto entity : entities) | |
| entity.assign_from_copy(CParentEntity{{owning_entity_}}); | |
| } | |
| ~CAttachedEntities() | |
| { | |
| for (auto entity : entities) | |
| entity.destroy(); | |
| } | |
| std::vector<ex::Entity> entities; | |
| }; | |
| struct CShadow | |
| { | |
| util::Line line; | |
| }; | |
| struct CFovAim | |
| { | |
| CFovAim(float default_value_, float aimed_value_) | |
| : default_value{default_value_}, aimed_value{aimed_value_} | |
| { | |
| } | |
| enum class ChangeState | |
| { | |
| Growing, | |
| Shrinking | |
| }; | |
| float default_value; | |
| float aimed_value; | |
| float change_time; | |
| std::optional<ChangeState> state; | |
| }; | |
| struct CPoints : SingleValue<std::vector<sf::Vector2f>> | |
| { | |
| }; | |
| struct CDrawableFromPointsInterpreter | |
| { | |
| sf::PrimitiveType point_interpretation; | |
| }; | |
| struct CCircularHitbox | |
| { | |
| float radius; | |
| }; | |
| struct CRectangularHitbox | |
| { | |
| float width, height; | |
| }; | |
| struct CTriangleFanHitbox | |
| { | |
| }; | |
| struct COutlineHitbox | |
| { | |
| }; | |
| struct CFastMovingHitbox | |
| { | |
| }; | |
| // if no whitelist component provided, all entities are possible collision | |
| // targets | |
| struct CCollisionLayerWhitelist : SingleValue<std::vector<id::Layer::Layer>> | |
| { | |
| }; | |
| struct CCollisionEntityWhitelist : SingleValue<std::vector<ex::Entity>> | |
| { | |
| }; | |
| struct CCollisionEntityTypeWhitelist : SingleValue<std::vector<id::EntityType>> | |
| { | |
| }; | |
| struct CCollisionEntityBlacklist : SingleValue<std::vector<ex::Entity>> | |
| { | |
| }; | |
| struct CColliding | |
| { | |
| operator bool() { return other_entity.valid(); } | |
| ex::Entity other_entity; | |
| }; | |
| struct CCollisionMovementConstraint | |
| { | |
| std::vector<util::Line> colliding_edges; | |
| }; | |
| struct CGun | |
| { | |
| CGun(bool fully_automatic_, | |
| int rounds_per_minute_, | |
| int mag_size_, | |
| float reload_time_, | |
| float kickback_amount_) | |
| : fully_automatic{fully_automatic_} | |
| , rounds_per_minute{rounds_per_minute_} | |
| , mag_size{mag_size_} | |
| , reload_time{reload_time_} | |
| , kickback_amount{kickback_amount_} | |
| , loaded_ammo{mag_size} | |
| { | |
| } | |
| bool fully_automatic; | |
| int rounds_per_minute, mag_size; | |
| float reload_time; | |
| float kickback_amount; | |
| int loaded_ammo; | |
| float time_since_last_shot; | |
| }; | |
| struct CReloading : SingleValue<bool> | |
| { | |
| float time_left; | |
| }; | |
| struct CEntityType : SingleValue<id::EntityType> | |
| { | |
| }; | |
| struct CEmitOnCollision | |
| { | |
| id::CollisionEventType type; | |
| }; | |
| struct CCursorTrace | |
| { | |
| }; | |
| struct CPlayer | |
| { | |
| }; | |
| struct CRotateToMouse | |
| { | |
| }; | |
| struct CViewFollower | |
| { | |
| }; | |
| struct CAnimateMovement | |
| { | |
| }; | |
| struct CFovLimiter | |
| { | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment