среда, 30 августа 2017 г.

method param with def

void init(int a, int b, int c) {
...
}

void init(int a, int b) {
    init(a, b, 10); //Значение параметра с поумолчанию 10
}

void init(int a) {
    init(a, 20, 10); //Значение параметра с поумолчанию 10, b поумолчанию 20
}

понедельник, 14 августа 2017 г.

libgdx core

import com.badlogic.gdx.ApplicationAdapter; 
import com.badlogic.gdx.Gdx; 
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture; 
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 
public class XCars extends ApplicationAdapter {
   SpriteBatch batch; 
   Texture img;    
 
   @Override 
   public void create () {
      batch = new SpriteBatch();
      img = new Texture("badlogic.jpg"); 
   }

   @Override
   public void render () {
      Gdx.gl.glClearColor(1, 0, 0, 1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      batch.begin();
      batch.draw(img, 0, 0);
      batch.end(); 
   }
   
   @Override
   public void dispose () {
      batch.dispose();
      img.dispose(); 
   }
}

четверг, 10 августа 2017 г.

VS Code + Java

 Language Support for Java(TM) by Red Hat
 https://marketplace.visualstudio.com/items?itemName=redhat.java

tasks.json
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "build",
            "command": "javac",
            "args": [
                "-g",
                "${file}"
            ]
        }
    ]
}