Skip to content

Commit 080dac7

Browse files
committed
some code cleaning
1 parent 0b652e9 commit 080dac7

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/ofxVisualProgramming.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,29 @@ ofxVisualProgramming::~ofxVisualProgramming(){
102102
}
103103

104104
//--------------------------------------------------------------
105-
void ofxVisualProgramming::setup(ofxImGui::Gui* _guiRef){
106-
107-
// Load resources
108-
font->setup(MAIN_FONT,1.0,2048,true,8,3.0f);
105+
void ofxVisualProgramming::setRetina(bool retina){
106+
isRetina = retina;
109107

110-
// Check retina screens
111-
if(ofGetScreenWidth() >= RETINA_MIN_WIDTH && ofGetScreenHeight() >= RETINA_MIN_HEIGHT){
112-
isRetina = true;
108+
if(isRetina){
113109
scaleFactor = 2;
114110
fontSize = 26;
111+
canvas.setScale(2);
112+
}else{
113+
scaleFactor = 1;
114+
fontSize = 12;
115115
}
116116

117117
nodeCanvas.setRetina(isRetina);
118118
profiler.setIsRetina(isRetina);
119119

120+
}
121+
122+
//--------------------------------------------------------------
123+
void ofxVisualProgramming::setup(ofxImGui::Gui* _guiRef){
124+
125+
// Load resources
126+
font->setup(MAIN_FONT,1.0,2048,true,8,3.0f);
127+
120128
// Initialise GUI
121129
if( _guiRef == nullptr ){
122130
ofxVPGui = new ofxImGui::Gui();
@@ -173,18 +181,12 @@ void ofxVisualProgramming::update(){
173181
// canvas init
174182
if(!inited){
175183
inited = true;
176-
canvasViewport.set(0,20,ofGetWindowWidth(),ofGetWindowHeight()-20);
177-
178-
// RETINA FIX
179-
if(ofGetScreenWidth() >= RETINA_MIN_WIDTH && ofGetScreenHeight() >= RETINA_MIN_HEIGHT){
180-
canvas.setScale(2);
181-
}
184+
//canvasViewport.set(0,20,ofGetWindowWidth(),ofGetWindowHeight()-20);
182185
}
183186

184187
// Clear map from deleted objects
185188
clearObjectsMap();
186189

187-
188190
// update patch objects
189191
if(!bLoadingNewPatch && !patchObjects.empty()){
190192

src/ofxVisualProgramming.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ofxVisualProgramming : public pdsp::Wrapper {
5858
ofxVisualProgramming();
5959
~ofxVisualProgramming();
6060

61+
void setRetina(bool retina);
6162
void setup(ofxImGui::Gui* guiRef = nullptr);
6263
void update();
6364
void updateCanvasViewport();
@@ -116,7 +117,7 @@ class ofxVisualProgramming : public pdsp::Wrapper {
116117

117118
void setIsHoverMenu(bool ish){ isHoverMenu = ish; }
118119
void setIsHoverLogger(bool isl){ isHoverLogger = isl; }
119-
void setIsHoverCodeEditor(bool isl){ isHoverCodeEditor = isl; }
120+
void setIsHoverCodeEditor(bool isl){ isHoverCodeEditor = isl; }
120121

121122
// PATCH CANVAS
122123
ofxInfiniteCanvas canvas;

0 commit comments

Comments
 (0)