Project

General

Profile

Revision 638

Added by Greg Tress about 16 years ago

New robot movement works. Battery meters work with new timing scheme. Still have some repainting issues.

View differences:

Colonet.java
191 191
		panelRobotDirectionButtons.add(btnR);
192 192

  
193 193
		imageVectorControl = gc.createCompatibleImage(VECTOR_CONTROLLER_WIDTH, VECTOR_CONTROLLER_HEIGHT);
194
		vectorController = new VectorController(imageVectorControl, self, csi);
194
		vectorController = new VectorController(imageVectorControl, self);
195 195
		panelRobotDirection.setLayout(new BorderLayout());
196 196
		panelRobotDirection.add(vectorController, BorderLayout.CENTER);
197 197
		panelRobotDirection.add(panelRobotDirectionButtons, BorderLayout.SOUTH);
......
323 323
		btnAssignID.addActionListener(this);
324 324
		panelWebcam.addMouseListener(this);
325 325
	}
326
	
327
	public ColonetServerInterface getCSI () {
328
	    return csi;
329
	}
326 330

  
327 331
	public void paint (Graphics g) {
328 332
		super.paint(g);
......
527 531
		RobotIcon r = robotIcons.get(botNum);
528 532
		if (r != null) {
529 533
		    r.battery = batteryIcon.convert(level);  // set contextual battery meter
530
		    batteryIcon.setLevel(level); // set solo battery meter
531
		    System.out.println("Set " + r.id + " battery value to " + level);
534
		    batteryIcon.setLevel(level);             // set solo battery meter
532 535
		}
533
		repaint();
536
		super.repaint();
534 537
	}
535 538

  
536 539
	/**
......
936 939
					bufferedGraphics.drawOval(px-RADIUS, py-RADIUS, 2*r.RADIUS, 2*r.RADIUS);
937 940
					// Battery
938 941
					if (r.battery >= 0) {
939
					    int pixels = r.battery * BATTERY_WIDTH / 160;  // 160 should be fully charged
942
					    int pixels = r.battery * BATTERY_WIDTH / 100;  // 160 should be fully charged
940 943
						if (r.battery > 50)
941 944
						    bufferedGraphics.setColor(Color.GREEN);
942 945
						else if (r.battery > 25)
......
1064 1067
		}
1065 1068
	}
1066 1069

  
1067
}
1070
}

Also available in: Unified diff