Created
September 30, 2017 18:59
-
-
Save FRex/6f80ef13eb12511d4d558162729b8709 to your computer and use it in GitHub Desktop.
This file contains 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
#include <iostream> | |
class Ensurer | |
{ | |
public: | |
void bind(int ptr, bool texturing) | |
{ | |
std::printf("bind(%d, %s)\n", ptr, texturing ? "true" : "false"); | |
if(ptr != m_ptr) | |
{ | |
m_ptr = ptr; | |
m_texturing = false; | |
std::printf("Ptr changed, binding color and vertices for %d\n", m_ptr); | |
} | |
if(!m_texturing && texturing) | |
{ | |
std::printf("Texturing got enabled, binding texture for %d\n", m_ptr); | |
m_texturing = true; | |
} | |
} | |
private: | |
int m_ptr = 0; | |
bool m_texturing = false; | |
}; | |
int main(int argc, char ** argv) | |
{ | |
Ensurer ens; | |
ens.bind(1, false); | |
ens.bind(1, true); | |
ens.bind(1, false); | |
ens.bind(2, false); | |
ens.bind(3, true); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment