Simple Screen Mapper

Hello,

This is mindbogglingly dumb and yet useful at the same time (much like me.) My first post, so I'm sure you'll let me know what you think, right?

The following program is a very simple way to record screen mapping locations based on a predetermined display. I wanted to get a detailed map of where things were on the screen grid without having to play guessing games. Maybe I overlooked it, but I couldn't find a simple screen mapping tool among these really complex apps, so I made my own.

I load the display into the Processing window (don't forget to change this for your system) and just move the mouse to map the locations.

Upper left of the screen shows the mouse/screen x/y position (you may need to change color if background is black.) LEFT BUTTON = Records the location in the console window. RIGHT BUTTON = Draws a delimiter line in the console window.

Then I just copy and paste from the console screen to a text file and indicated what button the coordinate sets belong to such as, "middle row of buttons" or "center of gauge indicator".

I used [pmouseX],[pmouseY] as I wanted the previous position (in case my hand shook a little), but if I had used just [mouseX] the results are the same since I need the still position of the mouse, not a moving one.

This code could be greatly modified to do a lot more and have more accuracy, but this is all I wanted it for, for now.

  • Hope it helps some. Phoenix_Infinity

P.S. - I tried to put this under 'Share Your Work", but it said I didn't have the perms for it.

SS_Mapper2 SS_Mapper1

/*
   Upper Left of the screen shows the mouse/screen x/y position

  LEFT BUTTON  = Records the location in the console window.
  RIGHT BUTTON = Draws a delimiter line in the console window.

  This could be greatly modified to do a lot more, but this is all I wanted for now.

  - Hope it helps some.
    Phoenix_Infinity
*/

PImage img;  // Declare variable of type PImage

void setup()
{
  size(1024, 768);
  img = loadImage("/Volumes/CODE_TRAINING/TEST_ScreenMapper/DemoDisplay.png");
}

void draw()
{
  background(255);
  image(img, 0, 0, width, height);

  String s = "x="+pmouseX+":y="+pmouseY;

  fill(50);
  textSize(32);
  text(s, 0, 30);
}

void mouseClicked() {
  if (mouseButton == LEFT) {
    println("x="+pmouseX+":y="+pmouseY);
  } else {
    println("=========================");
  }  
}

Answers

  • Answer ✓

    line 23 should be in setup () - loading the same image on every draw loop is a waste...

  • Yes, it should. Ha! Tis true... I said I'm "mindbogglingly dumb." You must have missed that part. Thanks. I updated that in the code display.

    Yeah, I'll miss the obvious for weeks and blow scads of computational cycles as long as it works - I'll never know. I started programming on a teletype machine and saw the first Vic-20 in stores. These things are so fast by comparison, I stopped optimizing code a bit after college. :) (Prof. Botting would click his tongue at me tsk..tsk..tsk..)

Sign In or Register to comment.