Commit f4b94d91 authored by w4t's avatar w4t

VectorCombo, VectorListBox demo

parent d8d09ed5
Pipeline #67 canceled with stages
......@@ -47,6 +47,14 @@ void ofApp::setup()
std::cout << "GPU : "<< glGetString(GL_RENDERER) << std::endl;
std::cout << "OpenGL ver. " << glGetString(GL_VERSION) << std::endl;
std::cout << "GLSL ver. " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
ofDirectory dataDirectory(ofToDataPath("", true));
files = dataDirectory.getFiles();
for(size_t i=0; i<files.size(); i++)
{
fileNames.push_back(files[i].getFileName());
}
}
//--------------------------------------------------------------
......@@ -100,12 +108,36 @@ void ofApp::draw() {
ImGui::ShowDemoWindow(&show_test_window);
}
ImGui::ShowTabsDemo("Tabs Demo");
//ImGui::ShowTabsDemo("Tabs Demo");
if(!fileNames.empty())
{
//ofxImGui::VectorListBox allows for the use of a vector<string> as a data source
static int currentListBoxIndex = 0;
if(ofxImGui::VectorListBox("VectorListBox", &currentListBoxIndex, fileNames))
{
ofLog() << " VectorListBox FILE PATH: " << files[currentListBoxIndex].getAbsolutePath();
}
//ofxImGui::VectorCombo allows for the use of a vector<string> as a data source
static int currentFileIndex = 0;
if(ofxImGui::VectorCombo("VectorCombo", &currentFileIndex, fileNames))
{
ofLog() << "VectorCombo FILE PATH: " << files[currentFileIndex].getAbsolutePath();
}
}
//GetImTextureID is a static function define in Helpers.h that accepts ofTexture, ofImage, or GLuint
if(ImGui::ImageButton(GetImTextureID(imageButtonID), ImVec2(200, 200)))
{
ofLog() << "PRESSED";
}
//or do it manually
ImGui::Image((ImTextureID)(uintptr_t)textureSourceID, ImVec2(200, 200));
ImGui::Image(GetImTextureID(pixelsButtonID), ImVec2(200, 200));
bool pressed = ImGui::ImageButton((ImTextureID)(uintptr_t)imageButtonID, ImVec2(200, 200));
pressed = ImGui::ImageButton((ImTextureID)(uintptr_t)pixelsButtonID, ImVec2(200, 200));
pressed = ImGui::ImageButton((ImTextureID)(uintptr_t)textureSourceID, ImVec2(200, 200));
if(doThemeColorsWindow) {
gui.openThemeColorWindow();
}
......@@ -113,9 +145,6 @@ void ofApp::draw() {
//required to call this at end
gui.end();
if(textureSource.isAllocated()) {
//textureSource.draw(ofRandom(200), ofRandom(200));
}
}
//--------------------------------------------------------------
......
......@@ -36,4 +36,6 @@ public:
ofTexture textureSource;
GLuint textureSourceID;
std::vector<std::string> fileNames;
std::vector<ofFile> files;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment