package com.mygdx.game;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
public class RectrenderTest extends ApplicationAdapter {
private ShapeRenderer shapeRenderer;
private float alpha = 1f;
private float dAlpha = -0.5f;
private boolean fadingOut = true;
@Override
public void create() {
shapeRenderer = new ShapeRenderer();
}
@Override
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Включается блендинг:
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
// Задается форма:
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
update(Gdx.graphics.getDeltaTime());
// Задается цвет и прозрачность alpha:
shapeRenderer.setColor(new Color(1, 1, 1, alpha));
// Рисуется линия:
shapeRenderer.line(0, 0, 470, 350);
shapeRenderer.end();
// Выключается блендинг:
Gdx.gl.glDisable(GL20.GL_BLEND);
}
private void update(float dt) {
// System.out.println("dt=" + dt + ", alpha=" + alpha + ", dAlpha=" + dAlpha);
// Если прозрачность за пределами допустимых значений, меняем направление
if (fadingOut && alpha <= 0 || !fadingOut && alpha >= 1f) {
dAlpha = -dAlpha;
fadingOut = !fadingOut;
}
alpha += dAlpha * dt;
}
@Override
public void dispose() {
shapeRenderer.dispose();
}
}
sb.begin();
Texture unnamed = new Texture("unnamed.png");
int width = unnamed.getWidth();
int height = unnamed.getHeight();
sb.draw(unnamed, 350, 350, width, height, 0, 0, width, height, true, false);
sb.end();
sb.begin();
Texture unnamed = new Texture("unnamed.png");
Sprite sprite = new Sprite(unnamed);
sprite.flip(true, false);
sprite.setCenter(700, 600);
sprite.draw(sb);
sb.end();
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
...
}
}
allprojects {
repositories {
jcenter()
google()
}
}
Yes it is normal.
There have been some changes in JDK8 that prevent AS7 and current version of EAP6 to start under JDK8.
We have many JDK8 related fixes in WildFly so I would recommend you to use that.
As for EAP goes, the start up on JDK8 is fixed in upcoming 6.2 release.
So in short, I would be more then welcome if people would test WildFly on JDK8 as we are working on making whole testsuite pass on it.
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9092/~/Downloads/h2/mydb", "sa", "");
PreparedStatement ps = conn.prepareStatement("select PDF from FILES");
ResultSet rs = ps.executeQuery();
Blob blob = null;
if (rs.next()) blob = rs.getBlob("PDF");
if (blob != null) {
File myPdf = new File("mypdf.pdf");
ByteArrayInputStream is = new ByteArrayInputStream(blob.getBytes(0, (int) blob.length()));
FileOutputStream fos = new FileOutputStream(myPdf);
byte[] buf = new byte[is.available()];
is.read(buf, 0, buf.length);
fos.write(buf);
is.close();
fos.close();
}
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;
public class KeyEventDemo implements NativeKeyListener {
public static void main(String[] args) {
try {
GlobalScreen.registerNativeHook();
}
catch (NativeHookException ex) {
System.err.println(ex.getMessage());
System.exit(1);
}
GlobalScreen.addNativeKeyListener(new KeyEventDemo());
}
@Override
public void nativeKeyPressed(final NativeKeyEvent nativeKeyEvent) {
System.out.println("Key code: " + nativeKeyEvent.getKeyCode()
+ ", raw code: " + nativeKeyEvent.getRawCode());
}
@Override
public void nativeKeyReleased(final NativeKeyEvent nativeKeyEvent) {}
@Override
public void nativeKeyTyped(final NativeKeyEvent nativeKeyEvent) {}
}
@param rawCode the hardware code associated with the native key in this event.
compile "com.badlogicgames.box2dlights:box2dlights:1.4"