Skip to content

Instantly share code, notes, and snippets.

View Mr00Anderson's full-sized avatar
🏠

Daniel Anderson Mr00Anderson

🏠
View GitHub Profile

Caveat: At the release of this wiki page, Java 14 is the current released Java Development Kit (JDK).

Introduction

Every project will require the usage of at least one Java Development Kit (JDK). This is the source, root or core

package com.virtual_hex.gdx.engine.maps;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.IntIntMap;
public class SubArraySum {
public static void main(String[] args) {
package com.virtual_hex.gdx.engine.maps;
public class IndexCalculation2D {
public static int rowMajorYTopLeft(int x, int y, int width){
return (width * x) + y;
}
public static int rowMajorYBottomLeft(int x, int y, int height, int indexHeight, int arrayLastIndex){
int indexY = indexHeight - y;
package com.virtual_hex.gdx.engine.maps;
public class TwoDIndexCalculation {
public static int rowMajorYTopLeft(int x, int y, int width){
return (width * x) + y;
}
public static int rowMajorYBottomLeft(int x, int y, int height, int indexHeight, int arrayLastIndex){
int indexY = indexHeight - y;
//Overlays using pixel from base images and making a percent darker
public static Pixmap combineImages(final Pixmap basePixmap, final Pixmap overlayPixmap) {
final Pixmap newPixmap = new Pixmap(basePixmap.getWidth(), basePixmap.getHeight(), basePixmap.getFormat());
final int adjustedWidthIndex = basePixmap.getWidth();
final int adjustedHeightIndex = basePixmap.getHeight();
for (int row = 0; row < adjustedHeightIndex; row++) {
for (int column = 0; column < adjustedWidthIndex; column++) {
final int basePixel = basePixmap.getPixel(column, row);
package com.virtual_hex.gdx.engine.maps;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.viewport.Viewport;
/**
* Screen x,y - Screen coordinates
* World x,y - World coordinates
* World Pos x,y - Specific map point - (world x / (texture-width/height))
* Chunk x,y - Chunk coordinates
@Mr00Anderson
Mr00Anderson / ActorAsset.java
Created October 2, 2020 20:30
ScreenPlayExample
package com.virtual_hex.gdx.engine.scene2d.actions;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.virtual_hex.app.AppLauncher;
import com.virtual_hex.gdx.engine.Cleanup;
import com.virtual_hex.gdx.engine.app.GdxEngScreenManagerApp;
import com.virtual_hex.gdx.engine.assets.AssetList;
import com.virtual_hex.gdx.engine.screens.GdxEngAppScreen;
package com.virtual_hex.gdx.engine.scene2d;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
package com.virtual_hex.math;
import java.util.Random;
public class RandomUtils {
/**
* Returns a pseudo-random number between min and max, inclusive.
* The difference between min and max can be at most
* <code>Integer.MAX_VALUE - 1</code>.
package com.virtual_hex.math;
import java.util.Random;
public class RandomUtils {
/**
* Returns a pseudo-random number between min and max, inclusive.
* The difference between min and max can be at most
* <code>Integer.MAX_VALUE - 1</code>.