Permalink
Browse files

* Clean up a little

* Added examples
* Deleted helper, moved to FullScreenBase
* Add a way to find out available resolutions

git-svn-id: http://svn.gna.org/svn/fullscreen-p5/trunk@9 2047cd6a-46a1-4efc-9f20-c343b47ea501
  • Loading branch information...
1 parent fb0c5a0 commit 2df2cb734147b19c54797b08b47eb44f0e38bd4c kritzikratzi committed Jun 10, 2008
View
@@ -37,7 +37,7 @@
<!-- compile the sources, place the class files in the bin folder -->
<target name="compile">
<mkdir dir="bin"/>
- <javac srcdir="src" destdir="bin" classpathref="cp"/>
+ <javac srcdir="src" destdir="bin" classpathref="cp" target="1.4" />
</target>
<!-- create the files for the website -->
@@ -55,9 +55,13 @@
<copy todir="fs_api/library/">
<fileset dir="lib"/>
</copy>
+ <copy todir="fs_api/examples">
+ <fileset dir="examples"/>
+ </copy>
- <!-- create the jar file and copy it over -->
- <jar destfile="fs_api/library/fullscreen.jar" basedir="bin"/>
+ <!-- create the jar files and copy them over -->
+ <jar destfile="fs_api/library/fullscreen.jar" basedir="bin" includes="fullscreen/**"/>
+ <jar destfile="fs_api/library/fullscreen_GLsupport.jar" basedir="bin" includes="processing/**"/>
<!-- done, zip it up! -->
<zip destfile="dist/fullscreen.zip">
@@ -77,6 +81,9 @@
<fileset dir="dependencies"/>
</copy>
+ <copy todir="fs_src/examples">
+ <fileset dir="examples"/>
+ </copy>
<copy todir="fs_src/src">
<fileset dir="src"/>
</copy>
@@ -0,0 +1,36 @@
+// very basic demonstration of the fullscreen api's capabilities
+import fullscreen.*;
+
+FullScreen fs;
+
+void setup(){
+ // set size to 640x480
+ size(640, 480);
+
+ // 5 fps
+ frameRate(5);
+
+ // Create the fullscreen object
+ fs = new FullScreen(this);
+
+ // enter fullscreen mode
+ fs.enter();
+}
+
+
+void draw(){
+ background(0);
+ fill(255, 0, 0);
+
+ for(int i = 0; i < 10; i++){
+ fill(
+ random(255),
+ random(255),
+ random(255)
+ );
+ rect(
+ i*10, i*10,
+ width - i*20, height - i*20
+ );
+ }
+}
@@ -0,0 +1,42 @@
+// Demonstrates the SoftFullScreen mode.
+// softfullscreen is just a giant window on top of all the other windows
+// (that is a big difference to the normal fullscreen, where the fullscreen
+// window get's exclusive access to the system resources).
+// that also means you can't change resolution etc.
+// why would you use it at all then?
+// look at the dualscreen example!
+import fullscreen.*;
+
+SoftFullScreen fs;
+
+void setup(){
+ // set size to 640x480
+ size(640, 480);
+
+ // 5 fps
+ frameRate(5);
+
+ // Create the fullscreen object
+ fs = new SoftFullScreen(this);
+
+ // enter fullscreen mode
+ fs.enter();
+}
+
+
+void draw(){
+ background(0);
+ fill(255, 0, 0);
+
+ for(int i = 0; i < 10; i++){
+ fill(
+ random(255),
+ random(255),
+ random(255)
+ );
+ rect(
+ i*10, i*10,
+ width - i*20, height - i*20
+ );
+ }
+}
@@ -0,0 +1,40 @@
+// demonstrates the use of a sketch that spans over two screens.
+// you need to manually set the resolution of each screen to
+// 1024x768 (both screens need to be the same!)
+// then run this sketch.
+
+import fullscreen.*;
+
+SoftFullScreen fs;
+
+void setup(){
+ // set size to 640x480
+ size(2048, 768);
+
+ // 5 fps
+ frameRate(5);
+
+ // Create the fullscreen object
+ fs = new SoftFullScreen(this);
+
+ // enter fullscreen mode
+ fs.enter();
+}
+
+
+void draw(){
+ background(0);
+ fill(255, 0, 0);
+
+ for(int i = 0; i < 10; i++){
+ fill(
+ random(255),
+ random(255),
+ random(255)
+ );
+ rect(
+ i*10, i*10,
+ width - i*20, height - i*20
+ );
+ }
+}
@@ -0,0 +1,19 @@
+// You can use the fullscreen api to find out which
+// resolutions are available on your computer
+import fullscreen.*;
+
+FullScreen fs;
+
+void setup(){
+ // set size to 640x480
+ size(640, 480);
+
+ // Create the fullscreen object
+ fs = new FullScreen(this);
+
+ // list available resolutions
+ println( "Resolutions: " );
+ println( fs.getResolutions() );
+
+ exit();
+}
@@ -0,0 +1,42 @@
+// processing will show/hide the cursor whenever you
+// go to fullscreen mode / leave fullscreen mode.
+// here's an example how you can supress this behaviour
+import fullscreen.*;
+
+FullScreen fs;
+
+void setup(){
+ // set size to 640x480
+ size(640, 480);
+
+ // 5 fps
+ frameRate(5);
+
+ // Create the fullscreen object
+ fs = new FullScreen(this);
+
+ noCursor();
+}
+
+
+void draw(){
+ background(0);
+ fill(255, 0, 0);
+
+ for(int i = 0; i < 10; i++){
+ fill(
+ random(255),
+ random(255),
+ random(255)
+ );
+ rect(
+ i*10, i*10,
+ width - i*20, height - i*20
+ );
+ }
+}
+
+// every time the display mode changes hide the cursor!
+void displayChanged(){
+ noCursor();
+}
View
@@ -1,49 +0,0 @@
-/*
- Part of the Processing Fullscreen API
-
- Copyright (c) 2006-08 Hansi Raber
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 3 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU General
- Public License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA
-*/
-package fullscreen;
-
-import java.awt.MenuShortcut;
-import java.lang.reflect.Method;
-
-import processing.core.PApplet;
-
-class Helper {
-
- /**
- * Notifies the sketch about a display mode change.
- */
- public static void notifySketch( PApplet dad ){
- try{
- Method m = dad.getClass().getMethod( "displayChanged", new Class[]{ } );
- m.invoke( dad, new Object[]{ } );
- }
- catch( Exception e ){
-
- }
- }
-
-
- /**
- * Adds listeners
- */
- public static void addKeyListeners( PApplet p, FullScreen f ){
- }
-}

0 comments on commit 2df2cb7

Please sign in to comment.