fixed deskop shader stuff.

This commit is contained in:
Bryce Covert
2017-03-11 09:45:39 -08:00
parent 5f92863a5e
commit 4d22701c0f
12 changed files with 90 additions and 58 deletions

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>94</string>
<string>100</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>LSRequiresIPhoneOS</key>
@@ -36,6 +36,8 @@
<key>UILauunchImages</key>
<array>
<string>Default-568h</string>
<string>Default-568h@2x</string>
<string>Default-Portrait~ipad</string>
</array>
<key>UIRequiresFullScreen</key>
<true />

Binary file not shown.

View File

@@ -8,16 +8,13 @@
[log4j/log4j "1.2.16"]
[org.clojure/clojure "1.8.0"]
[com.mobidevelop.robovm/robovm-cocoatouch "2.3.0"]
[com.mobidevelop.robovm/robovm-objc "2.3.0"]
[com.mobidevelop.robovm/robovm-rt "2.3.0"]
[com.mobidevelop.robovm/robovm-compiler "2.3.0"]
[com.mobidevelop.robovm/robovm-dist-compiler "2.3.0"]
[play-clj "0.4.6-BRYCE"]]
:source-paths ["src/clojure" "../desktop/src-common"]
:java-source-paths ["src/java"]
:plugins [[lein-fruit "0.2.4-SNAPSHOT"]]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:jvm-opts ["-Dis-desktop=false"]
:jvm-opts []
:ios {:robovm-opts ["-config" "robovm.xml"]
:robovm-path "/Users/brycecovert/.robovm-sdks/robovm-2.2.1-SNAPSHOT"
:version 2.1}

View File

@@ -18,6 +18,9 @@
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.ogg</exclude>
</excludes>
<skipPngCrush>true</skipPngCrush>
</resource>
</resources>

View File

@@ -9,30 +9,31 @@ import com.badlogic.gdx.backends.iosrobovm.*;
public class Saver {
public static Pixmap takeScreenshot(){
public static Pixmap flipPixmap(Pixmap src) {
final int width = src.getWidth();
final int height = src.getHeight();
Pixmap flipped = new Pixmap(width, height, src.getFormat());
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
flipped.drawPixel(x, y, src.getPixel(x, height - y -1));
}
}
return flipped;
}
public static UIImage takeScreenshot(){
UIImage newImage;
UIGraphics.beginImageContext(new CGSize(1280, 960));
((IOSApplication) Gdx.app).getUIViewController().getView().drawViewHierarchy(
new CGRect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()) , true);
//((IOSApplication) Gdx.app).getUIViewController().getView().setTransform(CGAffineTransform.createScale(1, -1));
UIView view = ((IOSApplication) Gdx.app).getUIViewController().getView();
UIGraphics.beginImageContext(new CGSize(view.getFrame().getWidth(), view.getFrame().getHeight()), true, 0.0);
view.drawViewHierarchy(
new CGRect(0, 0, view.getFrame().getWidth(), view.getFrame().getHeight()), true);
newImage = UIGraphics.getImageFromCurrentImageContext();
UIGraphics.endImageContext();
//((IOSApplication) Gdx.app).getUIViewController().getView().setTransform(CGAffineTransform.createScale(1, 1));
return newImage;
NSData data = newImage.toPNGData();
newImage.dispose();
PixmapIO.PNG p = new PixmapIO.PNG();
Pixmap stepResult = new Pixmap(data.getBytes(), 0, data.getBytes().length);
p.setFlipY(true);
try {
p.write(Gdx.files.local("screenshot.png"), stepResult);
stepResult.dispose();
p.dispose();
return new Pixmap(Gdx.files.local("screenshot.png"));
} catch (Exception e) {
return new Pixmap(160, 120, Pixmap.Format.RGBA8888);
}
}
}