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).

1  
asclass G22WatchTarget {
2  
  void mainWindow(Window window) {}
3  
  abstract void configureScreenCamStream(ScreenCamStream stream);
4  
5  
  S toolTip() { null; }
6  
}
7  
8  
// screenNr: 1 = screen 1 etc
9  
srecord WatchScreen(int screenNr) > G22WatchTarget {
10  
  toString { ret "Screen " + screenNr; }
11  
12  
  void configureScreenCamStream(ScreenCamStream stream) {
13  
    stream.useScreen(screenNr-1);
14  
  }
15  
}
16  
17  
srecord WatchMouse(int width, int height) > G22WatchTarget {
18  
  WatchMouse() {
19  
    height = 256;
20  
    width = iround(height*16.0/9);
21  
  }
22  
  
23  
  toString { ret "Mouse"; }
24  
  
25  
  void configureScreenCamStream(ScreenCamStream stream) {
26  
    stream.area(mouseArea(width, height));
27  
  }
28  
29  
  @Override
30  
  S toolTip() { ret "Watch an area of " + str_px(width, height) + " around the mouse pointer"; }
31  
}
32  
33  
srecord WatchScreenWithMouse > G22WatchTarget {
34  
  toString { ret "Screen w/mouse"; }
35  
36  
  void configureScreenCamStream(ScreenCamStream stream) {
37  
    stream.useScreen(screenNrContaining(mouseLocationPt()));
38  
  }
39  
40  
  @Override
41  
  S toolTip() { ret "Watch the screen the mouse pointer is in"; }
42  
}
43  
44  
// Screen where Gazelle window is not
45  
srecord WatchOtherScreen > G22WatchTarget {
46  
  toString { ret "Other Screen"; }
47  
48  
  transient void settable Window mainWindow;
49  
50  
  void configureScreenCamStream(ScreenCamStream stream) {
51  
    stream.useScreen(mod(screenNrOfWindow(mainWindow)+1, numberOfScreens()));
52  
  }
53  
54  
  @Override
55  
  S toolTip() { ret "Watch the first screen the Gazelle window is NOT in"; }
56  
}

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: 114 / 172
Referenced in: [show references]