Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

56
LINES

< > BotCompany Repo | #1035738 // G22WatchTarget etc

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (14173L/80K).

asclass G22WatchTarget {
  void mainWindow(Window window) {}
  abstract void configureScreenCamStream(ScreenCamStream stream);

  S toolTip() { null; }
}

// screenNr: 1 = screen 1 etc
srecord WatchScreen(int screenNr) > G22WatchTarget {
  toString { ret "Screen " + screenNr; }

  void configureScreenCamStream(ScreenCamStream stream) {
    stream.useScreen(screenNr-1);
  }
}

srecord WatchMouse(int width, int height) > G22WatchTarget {
  WatchMouse() {
    height = 256;
    width = iround(height*16.0/9);
  }
  
  toString { ret "Mouse"; }
  
  void configureScreenCamStream(ScreenCamStream stream) {
    stream.area(mouseArea(width, height));
  }

  @Override
  S toolTip() { ret "Watch an area of " + str_px(width, height) + " around the mouse pointer"; }
}

srecord WatchScreenWithMouse > G22WatchTarget {
  toString { ret "Screen w/mouse"; }

  void configureScreenCamStream(ScreenCamStream stream) {
    stream.useScreen(screenNrContaining(mouseLocationPt()));
  }

  @Override
  S toolTip() { ret "Watch the screen the mouse pointer is in"; }
}

// Screen where Gazelle window is not
srecord WatchOtherScreen > G22WatchTarget {
  toString { ret "Other Screen"; }

  transient void settable Window mainWindow;

  void configureScreenCamStream(ScreenCamStream stream) {
    stream.useScreen(mod(screenNrOfWindow(mainWindow)+1, numberOfScreens()));
  }

  @Override
  S toolTip() { ret "Watch the first screen the Gazelle window is NOT in"; }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035738
Snippet name: G22WatchTarget etc
Eternal ID of this version: #1035738/1
Text MD5: c5e4a099f4e62bbe449b631011dbfcb4
Transpilation MD5: 6a550e2e89e565ad11a117c17d83fd41
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-17 21:53:33
Source code size: 1509 bytes / 56 lines
Pitched / IR pitched: No / No
Views / Downloads: 115 / 172
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)