canslp
March 23, 2021, 10:30pm
1
this is a follow up to this problem When i build this application it just makes a blank grey window
so i have identified the problem! for some reason it doesn’t like when i load svg shapes from a graphics folder. here is the problematic code
imagePINE = loadShape("graphics/pine.svg");
imageOAK = loadShape("graphics/oak.svg");
imageBUSH = loadShape("graphics/bush.svg");
imageOAKf = loadShape("graphics/oak-flowered.svg");
imageBUSHf = loadShape("graphics/bush-flowered.svg");
imageSTEPSTONES = loadShape("graphics/stepstones.svg");
imageFOLIAGE = loadShape("graphics/foliage.svg");
imageSHOPFRONT = loadShape("graphics/shop-front.svg");
imageSHOPROOF = loadShape("graphics/shop-roof.svg");
it runs fine when i test in in-ide but when i build an actual app it freezes and the screen is just blank grey. these are all real svg files in a folder i made in the main project folder called ‘graphics’. does that folder not carry over to the build? this has never been a problem before. can anyone help me dubug this?
UPDATE
okay actually there is a another function that is also causing a crash. it’s uiUpdate(), a function that updates some ui variables. again, i have no idea why it is doing that
void uiUpdate(){
if(mousePressed&&mouseButton==LEFT){
if(iMOUSE == 0){
iMOUSE = 1;
} else {
iMOUSE = 2;
}
} else {
iMOUSE = 0;
}
if(mousePressed&&mouseButton==RIGHT){
if(iRMOUSE == 0){
iRMOUSE = 1;
} else {
iRMOUSE = 2;
}
} else {
iRMOUSE = 0;
}
if(mousePressed&&mouseButton==CENTER){
if(iMMOUSE == 0){
iMMOUSE = 1;
} else {
iMMOUSE = 2;
}
} else {
iMMOUSE = 0;
}
if(hENTER){
if(iENTER == 0){
iENTER = 1;
} else {
iENTER = 2;
}
} else {
iENTER = 0;
}
if(hSHIFT){
if(iSHIFT == 0){
iSHIFT = 1;
} else {
iSHIFT = 2;
}
} else {
iSHIFT = 0;
}
if(hTAB){
if(iTAB == 0){
iTAB = 1;
} else {
iTAB = 2;
}
} else {
iTAB = 0;
}
if(hR){
if(iR == 0){
iR = 1;
} else {
iR = 2;
}
} else {
iR = 0;
}
if(hE){
if(iE == 0){
iE = 1;
} else {
iE = 2;
}
} else {
iE = 0;
}
if(hUP){
if(iUP == 0){
iUP = 1;
} else {
iUP = 2;
}
} else {
iUP = 0;
}
if(hDOWN){
if(iDOWN == 0){
iDOWN = 1;
} else {
iDOWN = 2;
}
} else {
iDOWN = 0;
}
if(hRIGHT){
if(iRIGHT == 0){
iRIGHT = 1;
} else {
iRIGHT = 2;
}
} else {
iRIGHT = 0;
}
if(hLEFT){
if(iLEFT == 0){
iLEFT = 1;
} else {
iLEFT = 2;
}
} else {
iLEFT = 0;
}
mouseScroll=round(mouseScroll*0.5);
}
You need to use processing functions and variables for the mouse.
mouseWheel is called using
https://processing.org/reference/mouseWheel_.html
And if the variables beginning with i are system variables then they also need to be changed to processing variables or you need to use keyCode
or key
Also CENTER is reserved for rectMode() or ellipseMode(), again you need to use the processing.
canslp
March 23, 2021, 10:52pm
3
that’s odd, i thought i was using the processing members, because i’m coding this in the processing ide. is there a general resource for what members i should use for all the mouse input stuff
canslp
March 23, 2021, 10:52pm
4
i actually am using mouseWheel() btw, here’s the whole ui class
boolean hUP;
int iUP;
boolean hDOWN;
int iDOWN;
boolean hRIGHT;
int iRIGHT;
boolean hLEFT;
int iLEFT;
boolean hR;
int iR;
boolean hE;
int iE;
boolean hSPACE;
int iMOUSE;
int iRMOUSE;
int iMMOUSE;
boolean hENTER;
int iENTER;
boolean hSHIFT;
int iSHIFT;
boolean hTAB;
int iTAB;
float mouseScroll;
float mouseSV = 0;
float msLAST = 0;
void uiUpdate(){
if(mousePressed&&mouseButton==LEFT){
if(iMOUSE == 0){
iMOUSE = 1;
} else {
iMOUSE = 2;
}
} else {
iMOUSE = 0;
}
if(mousePressed&&mouseButton==RIGHT){
if(iRMOUSE == 0){
iRMOUSE = 1;
} else {
iRMOUSE = 2;
}
} else {
iRMOUSE = 0;
}
if(mousePressed&&mouseButton==CENTER){
if(iMMOUSE == 0){
iMMOUSE = 1;
} else {
iMMOUSE = 2;
}
} else {
iMMOUSE = 0;
}
if(hENTER){
if(iENTER == 0){
iENTER = 1;
} else {
iENTER = 2;
}
} else {
iENTER = 0;
}
if(hSHIFT){
if(iSHIFT == 0){
iSHIFT = 1;
} else {
iSHIFT = 2;
}
} else {
iSHIFT = 0;
}
if(hTAB){
if(iTAB == 0){
iTAB = 1;
} else {
iTAB = 2;
}
} else {
iTAB = 0;
}
if(hR){
if(iR == 0){
iR = 1;
} else {
iR = 2;
}
} else {
iR = 0;
}
if(hE){
if(iE == 0){
iE = 1;
} else {
iE = 2;
}
} else {
iE = 0;
}
if(hUP){
if(iUP == 0){
iUP = 1;
} else {
iUP = 2;
}
} else {
iUP = 0;
}
if(hDOWN){
if(iDOWN == 0){
iDOWN = 1;
} else {
iDOWN = 2;
}
} else {
iDOWN = 0;
}
if(hRIGHT){
if(iRIGHT == 0){
iRIGHT = 1;
} else {
iRIGHT = 2;
}
} else {
iRIGHT = 0;
}
if(hLEFT){
if(iLEFT == 0){
iLEFT = 1;
} else {
iLEFT = 2;
}
} else {
iLEFT = 0;
}
mouseScroll=round(mouseScroll*0.5);
}
void keyPressed(){
if(keyCode == 38 || keyCode == 87){
hUP = true;
}
if(keyCode == 39 || keyCode == 68){
hRIGHT = true;
}
if(keyCode == 37 || keyCode == 65){
hLEFT = true;
}
if(keyCode == 40 || keyCode == 83){
hDOWN = true;
}
if(keyCode == 82){
hR = true;
}
if(keyCode == 69){
hE = true;
}
if(keyCode == 32){
hSPACE = true;
}
if(keyCode == 10){
hENTER = true;
}
if(keyCode == 16){
hSHIFT = true;
}
if(keyCode == 9){
hTAB = true;
}
//println(keyCode);
}
void keyReleased(){
if(keyCode == 38 || keyCode == 87){
hUP = false;
}
if(keyCode == 39 || keyCode == 68){
hRIGHT = false;
}
if(keyCode == 37 || keyCode == 65){
hLEFT = false;
}
if(keyCode == 40 || keyCode == 83){
hDOWN = false;
}
if(keyCode == 82){
hR = false;
}
if(keyCode == 69){
hE = false;
}
if(keyCode == 32){
hSPACE = false;
}
if(keyCode == 10){
hENTER = false;
}
if(keyCode == 16){
hSHIFT = false;
}
if(keyCode == 9){
hTAB = false;
}
}
void mouseWheel(MouseEvent event) {
mouseScroll = event.getCount();
}
What error do you get the debugger aught to be saying something.
https://processing.org/examples/mousefunctions.html
https://processing.org/reference/keyCode.html
https://processing.org/reference/key.html
That should cover all mouse keyboard activity. More complex logic has to be coded manually.
canslp
March 23, 2021, 11:27pm
6
i don’t think i’m getting getting errors? maybe i don’t know where the debugger is. this is a build of the app, so the console of the ide doesn’t say anything right
Can you try and run it in the pde preview, that will post errors to the console.
canslp
March 23, 2021, 11:42pm
8
yea it runs totally fine in the preview that’s what i’m saying. it breaks when you build it
What platform are you building to?
canslp
March 23, 2021, 11:54pm
10
mac and windows both have the same problem
Not sure what to suggest other than make sure you have all prequesjtes java etc, and all environment variables are set, perhaps clean version of processing, also can you replicate this problem on previous processing builds.
canslp
March 24, 2021, 2:34am
12
what do you mean by environment variables. like the surface parameters and framerate and stuff? or like all variables