Browse Source

Made Fullscreen almost working….

hutattedonmyarm 12 years ago
parent
commit
762d400587

BIN
CubeControl/CubeControlMac.jar View File


+ 2
- 1
CubeControl/Frame.java View File

@@ -544,7 +544,8 @@ public class Frame extends JFrame implements ListSelectionListener {
544 544
 	// Anfang Ereignisprozeduren
545 545
 	
546 546
 	public void enterFullscreen(ActionEvent evt) {
547
-		FullscreenWindow fw = new FullscreenWindow(worker);
547
+		ledView.enterFullscreen();
548
+		FullscreenWindow fw = new FullscreenWindow(worker, cubeCanvas, ledView);
548 549
 	}
549 550
 	
550 551
 	public void editA_ActionPerformed(ActionEvent evt) {

+ 12
- 1
CubeControl/FullscreenWindow.java View File

@@ -10,10 +10,12 @@ public class FullscreenWindow extends JFrame {
10 10
 	private Container cp = getContentPane();
11 11
 	private cubeWorker worker;
12 12
 	private JButton exitButton;
13
+	private Canvas3D canvas;
14
+	private Led3D led;
13 15
 	private int width;
14 16
 	private int height;
15 17
 	
16
-	public FullscreenWindow (cubeWorker cw) {
18
+	public FullscreenWindow (cubeWorker cw, Canvas3D cv, Led3D ledview) {
17 19
 		//Basic layout stuff
18 20
 		this.setUndecorated(true);
19 21
 		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
@@ -25,15 +27,24 @@ public class FullscreenWindow extends JFrame {
25 27
 		worker = cw;
26 28
 		width = d.width;
27 29
 		height = d.height;
30
+		canvas = cv;
31
+		led = ledview;
28 32
 		exitButton = new JButton("Exit Fullscreen");
29 33
 		exitButton.setBounds(width-150, height-25, 150, 25);
30 34
 		exitButton.addActionListener(new ActionListener() {
31 35
 			public void actionPerformed(ActionEvent evt) {
32 36
 				dispose();
37
+				led.leaveFullscreen();
33 38
 			}
34 39
 		});
40
+		
41
+		canvas.setBounds(0,0, width, height-50);
42
+
43
+		
35 44
 		cp.add(exitButton);
45
+		cp.add(canvas);
36 46
 		
37 47
 		setVisible(true);
38 48
 	}
49
+
39 50
 }

+ 30
- 1
CubeControl/Led3D.java View File

@@ -27,6 +27,7 @@ import javax.media.j3d.*;
27 27
 import javax.vecmath.*;
28 28
 import com.sun.j3d.utils.behaviors.mouse.*;
29 29
 import com.sun.j3d.utils.image.TextureLoader;
30
+import java.awt.Toolkit;
30 31
 
31 32
 /**
32 33
  * This class is responsible for displaying the 3D View of our Cube.
@@ -55,6 +56,8 @@ public class Led3D {
55 56
 	private static Material redMat = new Material(
56 57
 			new Color3f(1.0f, 0.0f, 0.0f), new Color3f(1.0f, 0.0f, 0.0f),
57 58
 			new Color3f(1.0f, 0.0f, 0.0f), new Color3f(1.0f, 0.0f, 0.0f), 64.0f);
59
+	private Background background;
60
+	private Background fullscreenBackground;
58 61
 
59 62
 	/**
60 63
 	 * @param canv The Canvas3D we render our cube in
@@ -96,7 +99,11 @@ public class Led3D {
96 99
 		beh3.setSchedulingBounds(boundBox);
97 100
 		transGroup.addChild(beh3);
98 101
 
99
-		group.addChild(createBackground());
102
+		background = createBackground();
103
+		fullscreenBackground = createFullscreenBackground();
104
+		group.addChild(background);
105
+		
106
+		
100 107
 
101 108
 		// Add all our led sphares to the universe
102 109
 		for (int x = 0; x < 8; x++) {
@@ -241,4 +248,26 @@ public class Led3D {
241 248
 				100.0));
242 249
 		return bg;
243 250
 	}
251
+	
252
+	//create fullscreen background
253
+	private Background createFullscreenBackground() {
254
+		Background bg = new Background();
255
+		int radius = Toolkit.getDefaultToolkit().getScreenSize().width;
256
+		bg.setApplicationBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), radius));
257
+		return bg;
258
+
259
+	}
260
+	
261
+	public void enterFullscreen() {
262
+
263
+		group.removeChild(background);
264
+		group.addChild(fullscreenBackground);
265
+		
266
+	}
267
+	
268
+	public void leaveFullscreen() {
269
+		group.removeChild(fullscreenBackground);
270
+		group.addChild(background);
271
+		
272
+	}
244 273
 }

Loading…
Cancel
Save