enum in class doesn't change when call own function : <h1>Short Problem Description</h1>

<p>I have a problem that is when I change a enum but it doesn't change.<br>
It looks like just a local change.</p>

<p>if I do the below quote is fine.</p>

<pre><code>level = new level_1();
while(true)
{
    cout &lt;&lt; level-&gt;state &lt;&lt; endl; // show '1' at first loop. Another loop show '2'
    level-&gt;state = STATE_INITIALIZE;
}
</code></pre>

<p>but I have to change state in his function</p>

<pre><code>level = new level_1();
while(true)
{
    cout &lt;&lt; level-&gt;state &lt;&lt; endl; // show '1' only
    level.do();
}
</code></pre>

<p>level.do function  </p>

<pre><code>void Level_1::do()
{
    state = STATE_INITIALIZE; // If this work, it should be '2'
    // this-&gt;state = STATE_INITIALIZE;
}
</code></pre>

<p>so this is a big problem for me it doesn't change!! T_T</p>

<hr>

<h1>Long Code</h1>

<p>this is some code (almost full code)</p>

<h1>Level.h</h1>

<pre><code>enum LEVEL_STATE
{       STATE_LOAD = 1,
        STATE_INITIALIZE = 2,
        STATE_UPDATE = 3,
        STATE_DRAW = 4,
        STATE_FREE = 5,
        STATE_UNLOAD = 6
};

class Level {
public:
    LEVEL_STATE state = STATE_LOAD;
    vector&lt;Shader&gt; shader;
    vector&lt;Model&gt; model;
    virtual void load()=0;
    virtual void initialize()=0;
    virtual void update()=0;
    virtual void draw(Shader)=0;
    virtual void free()=0;
    virtual void unload()=0;
    virtual Level* next()=0;
};
</code></pre>

<h1>Map_Level_1.h</h1>

<pre><code>#include"Level.h"

class Level_1 : public Level {
public:
    LEVEL_STATE state;
    vector&lt;Shader&gt; shader;
    vector&lt;Model&gt; model;
    void load();
    void initialize();
    void update();
    void draw(Shader);
    void free();
    void unload();
    Level* next();
};
</code></pre>

<h1>Map_Level_1.cpp</h1>

<pre><code>#pragma once
#include"Map_Level_0.h"
#include"Map_Level_1.h"

extern Camera camera;
extern float SCR_WIDTH;
extern float SCR_HEIGHT;

void Level_1::load()
{
    shader.push_back(Shader("../Shader/alpha.vertex", "../Shader/alpha.fragment")); // this worked!
    model.push_back(Model (FileSystem::getPath("res/arcade/arcade.obj"))); // this worked!
    state = STATE_INITIALIZE; // this is not worked! the value doesn't change!
}

void Level_1::initialize()
{
    shader[0].use();
    state = STATE_UPDATE; // this is not worked! the value doesn't change!
}

void Level_1::update()
{
    shader[0].use();
    state = STATE_DRAW; // this is not worked! the value doesn't change!
}

void Level_1::draw(Shader shader)
{
    glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 10000.0f);
    glm::mat4 view = camera.GetViewMatrix();
    glm::mat4 model;

    shader.setMat4("projection", projection);
    shader.setMat4("view", view);
    shader.setInt("mode", 0);

    //model = scale(vec3(5.0f, 5.0f, 5.0f));
    shader.setMat4("model", model);
    shader.setInt("fragMode", 1);
    shader.setVec3("fragColor", vec3(0.92f, 0.92f, 0.92f));
    this-&gt;model[0].Draw(shader);
    state = STATE_UPDATE; // this is not worked! the value doesn't change!
}

void Level_1::free()
{

}

void Level_1::unload()
{

}

Level* Level_1::next() {
    return new Level_0();
}
</code></pre>

<h1>Main.cpp</h1>

<pre><code>level = new Level_1();
while (!glfwWindowShouldClose(window))
{
    DEV_processInput(window);

    cout &lt;&lt; level-&gt;state;
    switch (level-&gt;state)
    {
    case STATE_LOAD:
        level-&gt;load();
    case STATE_INITIALIZE:
        level-&gt;initialize();
    case STATE_UPDATE:
        level-&gt;update();
    case STATE_DRAW:
        level-&gt;draw(shader_1);
    case STATE_FREE:
        level-&gt;free();
    case STATE_UNLOAD:
        level-&gt;unload();
    }

    glfwSwapBuffers(window);
    glfwPollEvents();
}
</code></pre>

<hr>

<p>If I<br>
1.) do something wrong that it is easy to fix<br>
2.) repeat any questions</p>

<p>I will apologize.. </p>
