This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
event = new MousePressEvent() { | |
@Override | |
public void call(int key, int action) { | |
if(action == GLFW.GLFW_PRESS && key == GLFW.GLFW_MOUSE_BUTTON_LEFT) { | |
for(ItemRenderHolder holder:items) { | |
holder.setOldSlot(); | |
if(MathUtils.isClose(range, (float) Input.getMouseX(), holder.pos.x)) { | |
if(MathUtils.isClose(range, (float) (win.getYSize() - Input.getMouseY()), holder.pos.y)) | |
holder.isHolding = true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//hello world, Java style: | |
import System; | |
public class Main { | |
public static void main(str[] args) { | |
System.stdout.println("hello world"); | |
} | |
} | |
//hello world, Python style: | |
println("hello world") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Example N0-- | |
//hello world using SUPRA | |
@Settings.EnableScriptingCompilation //enables scripting compilation, like in python | |
print("hello world!"); //if scripting compilation is enabled, syntax like this is valid. | |
--Example N1-- | |
//simple print to print the second arg. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inheritance: | |
extend by using ":", can be multiple parents | |
@MainMethod: | |
marks main method | |
var: can hold any value | |
for: | |
can be like this: for(1..10) will repeat 1 to 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package opencraft.util; | |
import opencraft.data.*; | |
import opencraft.engine.Window; | |
import opencraft.engine.renderers.GUIRenderer; | |
import opencraft.input.Input; | |
import org.joml.Vector2f; | |
import org.joml.Vector2i; | |
import org.joml.Vector3f; | |
import org.lwjgl.glfw.GLFW; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adding: 1.12.2/ (stored 0%) | |
adding: AdvancedRocketry-1.12.2-1.6.0-190-universal.jar (deflated 3%) | |
adding: Arcane Essentials-0.9.2.jar (deflated 5%) | |
adding: autonetworklib-1.12.2-1.0.36.jar (deflated 24%) | |
adding: AutoRegLib-1.3-32.jar (deflated 9%) | |
adding: BiblioCraft[v2.4.5][MC1.12.2].jar (deflated 7%) | |
adding: Biome_Bundle-1.12.2-v6.1.jar (deflated 25%) | |
adding: blockcraftery-1.12.2-1.3.1.jar (deflated 17%) | |
adding: chiselsandbits-14.33.jar (deflated 11%) | |
adding: CodeChickenLib-1.12.2-3.2.3.358-universal.jar (deflated 9%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(int x = 0; x < World.maxX; x++) | |
for(int y = 0; y < World.maxY; y++) | |
for(int z = 0; y < World.maxZ; z++) { | |
ChunkMesh msh = world.chunks[x][y][z].opMesh; | |
Vertex[] vrts = new Vertex[msh.getVerts().size()]; | |
vrts = msh.getVerts().toArray(vrts); | |
ArrayList<Float> verts = new ArrayList<>(vrts.length*3); | |
for(Vertex vrt:vrts) { | |
verts.add(vrt.getPos().x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OUTERLOOP: | |
for(int x = 0; x < World.maxX; x++) { | |
for (int y = 0; y < World.maxY; y++) { | |
for (int z = 0; z < World.maxZ; z++) { | |
ChunkMesh msh = world.chunks[x][y][z].opMesh; | |
if(msh.getVerts().size() <= 0) { | |
break OUTERLOOP; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package opencraft.engine.renderers; | |
import opencraft.data.GUIMesh; | |
import opencraft.data.Vertex; | |
import opencraft.engine.Window; | |
import opencraft.engine.shaders.QuadShader; | |
import opencraft.util.MatrixUtil; | |
import org.joml.Matrix4f; | |
import org.joml.Vector2f; | |
import org.joml.Vector3f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
projectionMatrix = new Matrix4f().ortho(0, win.getH(), 0 , win.getW(), Z_NEAR, Z_FAR); | |
setUniform("project", projectionMatrix); | |
private void setUniform(String name, Matrix4f matrix) { | |
FloatBuffer matrixB = MemoryUtil.memAllocFloat(16); | |
matrix.get(matrixB); | |
glUniformMatrix4fv(glGetUniformLocation(PID, name), false, matrixB); | |
} |