<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.7" xml:lang="en-US">
  <compounddef id="db/d41/ProjectileComponent_8cpp" kind="file" language="C++">
    <compoundname>ProjectileComponent.cpp</compoundname>
    <includes refid="d8/da5/ProjectileComponent_8hpp" local="yes">ProjectileComponent.hpp</includes>
    <incdepgraph>
      <node id="8">
        <label>Component.hpp</label>
        <link refid="df/d1f/Component_8hpp_source"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>IPhysicsComponent.hpp</label>
        <link refid="d5/d69/IPhysicsComponent_8hpp_source"/>
        <childnode refid="8" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="3" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>ProjectileComponent.hpp</label>
        <link refid="d8/da5/ProjectileComponent_8hpp_source"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="6">
        <label>RigidbodyComponent.hpp</label>
        <link refid="d8/d16/RigidbodyComponent_8hpp_source"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>TinyMath.hpp</label>
        <link refid="d9/dec/TinyMath_8hpp_source"/>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>TransformComponent.hpp</label>
        <link refid="d9/da8/TransformComponent_8hpp_source"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>src/ProjectileComponent.cpp</label>
        <link refid="db/d41/ProjectileComponent_8cpp"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>SDL.h</label>
      </node>
      <node id="15">
        <label>algorithm</label>
      </node>
      <node id="4">
        <label>cmath</label>
      </node>
      <node id="10">
        <label>imgui.h</label>
      </node>
      <node id="11">
        <label>imgui_impl_sdl2.h</label>
      </node>
      <node id="12">
        <label>imgui_impl_sdlrenderer.h</label>
      </node>
      <node id="5">
        <label>ostream</label>
      </node>
      <node id="14">
        <label>string</label>
      </node>
      <node id="13">
        <label>vector</label>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&quot;ProjectileComponent.hpp&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight></codeline>
<codeline lineno="3" refid="dd/d7a/classProjectileComponent_1ac67ad7b89802466876a93ff01ab291f5" refkind="member"><highlight class="normal"><ref refid="dd/d7a/classProjectileComponent_1ac67ad7b89802466876a93ff01ab291f5" kindref="member">ProjectileComponent::ProjectileComponent</ref>(<ref refid="de/d87/classRigidbodyComponent" kindref="compound">RigidbodyComponent</ref><sp/>*_projectile,<sp/><ref refid="d2/d0a/classTransformComponent" kindref="compound">TransformComponent</ref><sp/>*_target,<sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>_homing,<sp/></highlight><highlight class="keywordtype">float</highlight><highlight class="normal"><sp/>_var)</highlight></codeline>
<codeline lineno="4"><highlight class="normal">{</highlight></codeline>
<codeline lineno="5"><highlight class="normal"><sp/><sp/><sp/><sp/>projectile<sp/>=<sp/>_projectile;</highlight></codeline>
<codeline lineno="6"><highlight class="normal"><sp/><sp/><sp/><sp/>target<sp/>=<sp/>_target;</highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="dd/d7a/classProjectileComponent_1afe0e491cb2d431b1f8f13ea15058cc11" kindref="member">homing</ref><sp/>=<sp/>_homing;</highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="dd/d7a/classProjectileComponent_1afe0e491cb2d431b1f8f13ea15058cc11" kindref="member">homing</ref>)</highlight></codeline>
<codeline lineno="11"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>speed<sp/>=<sp/>_var;</highlight></codeline>
<codeline lineno="13"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="15"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="16"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>angle<sp/>=<sp/>_var;</highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref><sp/>projectileXZPos<sp/>=<sp/>projectile-&gt;<ref refid="d9/d15/classIPhysicsComponent_1abfaa678eb1c7312e9bf098bc1473f794" kindref="member">GetPosition</ref>();</highlight></codeline>
<codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref><sp/>targetXZPos<sp/>=<sp/>target-&gt;<ref refid="d2/d0a/classTransformComponent_1a5452c308a26521441745d3edc1ab5d4d" kindref="member">getPos</ref>();</highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">float</highlight><highlight class="normal"><sp/>deltaY<sp/>=<sp/>targetXZPos.y<sp/>-<sp/>projectileXZPos.y;</highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">float</highlight><highlight class="normal"><sp/>distance<sp/>=<sp/>targetXZPos.x<sp/>-<sp/>projectileXZPos.x;</highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">float</highlight><highlight class="normal"><sp/>time<sp/>=<sp/>sqrt(((2.0f<sp/>/<sp/>gravity)<sp/>*<sp/>(deltaY<sp/>-<sp/>(tan(angle<sp/>*<sp/>0.01745329)<sp/>*<sp/>distance))));</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">float</highlight><highlight class="normal"><sp/>vX<sp/>=<sp/>distance<sp/>/<sp/>time;</highlight></codeline>
<codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">float</highlight><highlight class="normal"><sp/>vY<sp/>=<sp/>(deltaY<sp/>-<sp/>0.5f<sp/>*<sp/>gravity<sp/>*<sp/>time<sp/>*<sp/>time)<sp/>/<sp/>time;</highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref><sp/>v<sp/>=<sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref>(vX,<sp/>vY);</highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>projectile-&gt;<ref refid="de/d87/classRigidbodyComponent_1a5c6caca7d911fb61f00a2a35de0f62ef" kindref="member">SetVelocity</ref>(v);</highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="34"><highlight class="normal">}</highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="36" refid="dd/d7a/classProjectileComponent_1afd2a72d0f2027c9a89240891741654d4" refkind="member"><highlight class="normal"><ref refid="dd/d7a/classProjectileComponent_1afd2a72d0f2027c9a89240891741654d4" kindref="member">ProjectileComponent::~ProjectileComponent</ref>()</highlight></codeline>
<codeline lineno="37"><highlight class="normal">{</highlight></codeline>
<codeline lineno="38"><highlight class="normal">}</highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight></codeline>
<codeline lineno="40" refid="dd/d7a/classProjectileComponent_1a38c9c6161b276691004f672991795b54" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d7a/classProjectileComponent_1a38c9c6161b276691004f672991795b54" kindref="member">ProjectileComponent::Update</ref>(SDL_Event<sp/>e,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>frame,<sp/>std::vector&lt;std::string&gt;<sp/>broadcastList)</highlight></codeline>
<codeline lineno="41"><highlight class="normal">{</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="d8/d6b/classComponent_1aea8f0f460a62d86183020bd667b6cbf0" kindref="member">ParseAndUpdateBroadcast</ref>(broadcastList);</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="dd/d7a/classProjectileComponent_1afe0e491cb2d431b1f8f13ea15058cc11" kindref="member">homing</ref>)</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref><sp/>projectileXZPos<sp/>=<sp/>projectile-&gt;<ref refid="d9/d15/classIPhysicsComponent_1abfaa678eb1c7312e9bf098bc1473f794" kindref="member">GetPosition</ref>();</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref><sp/>targetXZPos<sp/>=<sp/>target-&gt;<ref refid="d2/d0a/classTransformComponent_1a5452c308a26521441745d3edc1ab5d4d" kindref="member">getPos</ref>();</highlight></codeline>
<codeline lineno="47"><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref><sp/>v<sp/>=<sp/>Normalize(<ref refid="dd/d40/structVec2D" kindref="compound">Vec2D</ref>(targetXZPos.x<sp/>-<sp/>projectileXZPos.x,<sp/>targetXZPos.y,<sp/>projectileXZPos.y))<sp/>*<sp/>speed;</highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>projectile-&gt;<ref refid="de/d87/classRigidbodyComponent_1a5c6caca7d911fb61f00a2a35de0f62ef" kindref="member">SetVelocity</ref>(v);</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="52"><highlight class="normal">}</highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight></codeline>
<codeline lineno="54" refid="dd/d7a/classProjectileComponent_1aee9362f7012bd2f0ca5088c63a175dd7" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d7a/classProjectileComponent_1aee9362f7012bd2f0ca5088c63a175dd7" kindref="member">ProjectileComponent::Render</ref>(SDL_Renderer<sp/>*ren)</highlight></codeline>
<codeline lineno="55"><highlight class="normal">{</highlight></codeline>
<codeline lineno="56"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="src/ProjectileComponent.cpp"/>
  </compounddef>
</doxygen>
