<?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/d77/HealthComponent_8cpp" kind="file" language="C++">
    <compoundname>HealthComponent.cpp</compoundname>
    <includes refid="d2/dad/HealthComponent_8h" local="yes">../include/HealthComponent.h</includes>
    <incdepgraph>
      <node id="3">
        <label>Component.hpp</label>
        <link refid="df/d1f/Component_8hpp_source"/>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>../include/HealthComponent.h</label>
        <link refid="d2/dad/HealthComponent_8h_source"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>src/HealthComponent.cpp</label>
        <link refid="db/d77/HealthComponent_8cpp"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>SDL.h</label>
      </node>
      <node id="10">
        <label>algorithm</label>
      </node>
      <node id="5">
        <label>imgui.h</label>
      </node>
      <node id="6">
        <label>imgui_impl_sdl2.h</label>
      </node>
      <node id="7">
        <label>imgui_impl_sdlrenderer.h</label>
      </node>
      <node id="9">
        <label>string</label>
      </node>
      <node id="8">
        <label>vector</label>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Created<sp/>by<sp/>gigaw<sp/>on<sp/>4/4/2023.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;../include/HealthComponent.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight></codeline>
<codeline lineno="7" refid="dd/d81/classHealthComponent_1aa28f1db8018726c3aca9110369ab7fda" refkind="member"><highlight class="normal"><ref refid="dd/d81/classHealthComponent_1aa28f1db8018726c3aca9110369ab7fda" kindref="member">HealthComponent::HealthComponent</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>totalHealth)<sp/>{</highlight></codeline>
<codeline lineno="8"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(totalHealth<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="9"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>totalHealth<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="10"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="11"><highlight class="normal"><sp/><sp/><sp/><sp/>m_totalHealth<sp/>=<sp/>m_currentHealth<sp/>=<sp/>totalHealth;</highlight></codeline>
<codeline lineno="12"><highlight class="normal">}</highlight></codeline>
<codeline lineno="13"><highlight class="normal"></highlight></codeline>
<codeline lineno="14" refid="dd/d81/classHealthComponent_1aac06fe69b879a4eb47ddce62f18ca2f9" refkind="member"><highlight class="normal"><ref refid="dd/d81/classHealthComponent_1aac06fe69b879a4eb47ddce62f18ca2f9" kindref="member">HealthComponent::~HealthComponent</ref>()<sp/>{</highlight></codeline>
<codeline lineno="15"><highlight class="normal"></highlight></codeline>
<codeline lineno="16"><highlight class="normal">}</highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight></codeline>
<codeline lineno="18" refid="dd/d81/classHealthComponent_1ab754979c3a0ac83d2fb7e163dd168d18" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d81/classHealthComponent_1ab754979c3a0ac83d2fb7e163dd168d18" kindref="member">HealthComponent::Update</ref>(SDL_Event<sp/>r,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>frame,<sp/>std::vector&lt;std::string&gt;<sp/>broadcastList)<sp/>{</highlight></codeline>
<codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="d8/d6b/classComponent_1aea8f0f460a62d86183020bd667b6cbf0" kindref="member">ParseAndUpdateBroadcast</ref>(broadcastList);</highlight></codeline>
<codeline lineno="20"><highlight class="normal">}</highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="comment">//<sp/>Maybe<sp/>render<sp/>health<sp/>bar?<sp/>Might<sp/>assume<sp/>too<sp/>much<sp/>/<sp/>promote<sp/>coupling</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23" refid="dd/d81/classHealthComponent_1a196e71923fbf5458a243846e5b71fa6f" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d81/classHealthComponent_1a196e71923fbf5458a243846e5b71fa6f" kindref="member">HealthComponent::Render</ref>(SDL_Renderer<sp/>*ren)<sp/>{</highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal">}</highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight></codeline>
<codeline lineno="27" refid="dd/d81/classHealthComponent_1a8ee269e60d65fb673c09ed1678ee433d" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d81/classHealthComponent_1a8ee269e60d65fb673c09ed1678ee433d" kindref="member">HealthComponent::ShowComponentEditor</ref>(</highlight><highlight class="keywordtype">bool</highlight><highlight class="normal">*<sp/>showEditor){</highlight></codeline>
<codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/>ImGuiWindowFlags<sp/>window_flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/>window_flags<sp/>|=<sp/>ImGuiWindowFlags_MenuBar;</highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/>window_flags<sp/>|=<sp/>ImGuiWindowFlags_NoCollapse;</highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ImGui::Begin(</highlight><highlight class="stringliteral">&quot;Editing<sp/>Health<sp/>Component&quot;</highlight><highlight class="normal">,<sp/>showEditor,<sp/>window_flags)){</highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ImGui::InputInt(</highlight><highlight class="stringliteral">&quot;Total<sp/>Health&quot;</highlight><highlight class="normal">,<sp/>&amp;m_totalHealth);</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ImGui::End();</highlight></codeline>
<codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="36"><highlight class="normal">}</highlight></codeline>
<codeline lineno="37"><highlight class="normal"></highlight></codeline>
<codeline lineno="38" refid="dd/d81/classHealthComponent_1a1318c479f692c3dede234ecbb2530558" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d81/classHealthComponent_1a1318c479f692c3dede234ecbb2530558" kindref="member">HealthComponent::SetHealth</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>newHealth)<sp/>{</highlight></codeline>
<codeline lineno="39"><highlight class="normal"><sp/><sp/><sp/><sp/>m_currentHealth<sp/>=<sp/>newHealth;</highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(m_currentHealth<sp/>&gt;<sp/>m_totalHealth)<sp/>{</highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>m_totalHealth<sp/>=<sp/>m_currentHealth;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="43"><highlight class="normal">}</highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight></codeline>
<codeline lineno="45" refid="dd/d81/classHealthComponent_1a453210b44b4483b3e74fdff60fc832bb" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="dd/d81/classHealthComponent_1a453210b44b4483b3e74fdff60fc832bb" kindref="member">HealthComponent::UpdateHealth</ref>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>changeInHealth)<sp/>{</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/>m_currentHealth<sp/>+=<sp/>changeInHealth;</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(m_currentHealth<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>m_currentHealth<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(m_currentHealth<sp/>&gt;<sp/>m_totalHealth)<sp/>{</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>m_currentHealth<sp/>=<sp/>m_totalHealth;</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="53"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="src/HealthComponent.cpp"/>
  </compounddef>
</doxygen>
