public SWTGraphics (SWTPlatform splat, final Composite comp) { super(splat); this.plat = splat; boolean isMac = "Mac OS X".equals(System.getProperty("os.name")); final Hack hack = isMac ? new SWTMacHack() : new Hack(); // special scale fiddling on Mac scaleChanged(hack.hackScale()); // create our GLCanvas GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data); hack.hackCanvas(canvas); canvas.setCurrent(); GL.createCapabilities(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); canvas.setCurrent(); hack.convertToBacking(canvas, bounds); viewportChanged(bounds.width, bounds.height); } }); plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height); setSize(plat.config.width, plat.config.height, plat.config.fullscreen); }
public SWTGraphics (SWTPlatform splat, final Composite comp) { super(splat); this.plat = splat; boolean isMac = "Mac OS X".equals(System.getProperty("os.name")); final Hack hack = isMac ? new SWTMacHack() : new Hack(); // special scale fiddling on Mac scaleChanged(hack.hackScale()); // create our GLCanvas GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data); hack.hackCanvas(canvas); canvas.setCurrent(); GL.createCapabilities(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); canvas.setCurrent(); hack.convertToBacking(canvas, bounds); viewportChanged(bounds.width, bounds.height); } }); plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height); setSize(plat.config.width, plat.config.height, plat.config.fullscreen); }