river.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. function River(){
  2. this._timer;
  3. this._bg;
  4. this._gui;
  5. this._checks;
  6. this._poi;
  7. this.enter = function()
  8. {
  9. this._timer=millis();
  10. this._bg = loadImage('oreto_restyle_1720x520.png');
  11. //background("#b86af0");
  12. console.log("ENTER RIVER")
  13. }
  14. this.setup = function() {
  15. createCanvas(_w, _h);
  16. this._gui = createGui();
  17. this._checks=[]
  18. for (let step = 0; step < pois.length; step++) {
  19. this._checks.push(createCheckbox("Checkbox"+step, 50, 50 + (step*20),10,10,true));
  20. }
  21. }
  22. this.draw = function() {
  23. if(millis()-this._timer > 20000){
  24. _mgr.showScene( Screensaver );
  25. }
  26. background(this._bg);
  27. drawGui();
  28. for (let step = 0; step < pois.length; step++) {
  29. cb = this._checks[step];
  30. if(cb.val){
  31. fill(255)
  32. //getPin(trx1,try1);
  33. pois[step].adapt();
  34. pois[step].pin();
  35. }
  36. }
  37. if (mouseIsPressed) {
  38. fill(0);
  39. resetTimer();
  40. }
  41. }
  42. this.mouseClicked = function(){
  43. for (let step = 0; step < pois.length; step++) {
  44. if(pois[step].overMe()){
  45. $jq("#poi_"+step).modal();
  46. console.log("Clicked on: " + poi.id);
  47. }
  48. }
  49. }
  50. function resetTimer(){
  51. console.log("Timer: " + this._timer)
  52. this._timer=millis()
  53. console.log("Timer: " + this._timer + " millis: " + millis())
  54. }
  55. }