Skip to content

Commit

Permalink
Update to latest, various cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
buthed010203 committed Jun 10, 2022
1 parent 5d4e272 commit 1233bd8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion arc-core/src/arc/graphics/Mesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Mesh(boolean useVertexArray, boolean isStatic, int maxVertices, int maxIn
indices = new IndexArray(maxIndices);
}else if(Core.gl30 != null){
vertices = new VertexBufferObjectWithVAO(isStatic, maxVertices, this);
indices = new IndexBufferObjectSubData(isStatic, maxIndices);
indices = new IndexBufferObject(isStatic, maxIndices);
}else{
vertices = new VertexBufferObject(isStatic, maxVertices, this);
indices = new IndexBufferObject(isStatic, maxIndices);
Expand Down
10 changes: 5 additions & 5 deletions arc-core/src/arc/graphics/g2d/Fill.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,16 @@ public static void poly(float x, float y, int sides, float radius, float rotatio
quad(x, y, x + px, y + py, x + px2, y + py2, x + px3, y + py3);
}

int mod = sides % 2;
int mod = sides & 1; // % 2

if(mod == 0 || sides < 4) return;

int i = sides - 1;

float px = Angles.trnsx(space * i + rotation, radius);
float py = Angles.trnsy(space * i + rotation, radius);
float px2 = Angles.trnsx(space * (i + 1) + rotation, radius);
float py2 = Angles.trnsy(space * (i + 1) + rotation, radius);
float px = Angles.trnsx(space * (sides - 1) + rotation, radius);
float py = Angles.trnsy(space * (sides - 1) + rotation, radius);
float px2 = Angles.trnsx(space * sides + rotation, radius);
float py2 = Angles.trnsy(space * sides + rotation, radius);
tri(x, y, x + px, y + py, x + px2, y + py2);
}
}
Expand Down
3 changes: 1 addition & 2 deletions arc-core/src/arc/graphics/g2d/SortedSpriteBatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void draw(TextureRegion region, float x, float y, float originX, float
final DrawRequest req = requests[numRequests];
req.x = x;
req.y = y;
requestZ[numRequests] = req.z = z;
requestZ[numRequests++] = req.z = z;
req.originX = originX;
req.originY = originY;
req.width = width;
Expand All @@ -88,7 +88,6 @@ protected void draw(TextureRegion region, float x, float y, float originX, float
req.blending = blending;
req.texture = null;
req.run = null;
++numRequests;
}else{
super.draw(region, x, y, originX, originY, width, height, rotation);
}
Expand Down
4 changes: 2 additions & 2 deletions arc-core/src/arc/graphics/g2d/SpriteBatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class SpriteBatch extends Batch{
int maxSpritesInBatch = 0;

/**
* Constructs a new SpriteBatch with a size of 4096, one buffer, and the default shader.
* Constructs a new SpriteBatch with a size of 8191, one buffer, and the default shader.
* @see #SpriteBatch(int, Shader)
*/
public SpriteBatch(){
this(4096, null);
this(8191, null);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions arc-core/src/arc/util/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public static long timeSinceNanos(long prevTime){
return nanos() - prevTime;
}

public static float millisSinceNanos(long prevTime){
return (nanos() - prevTime) / (float)nanosPerMilli;
}

/**
* Get the time in millis passed since a previous time
* @param prevTime - must be milliseconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private void init(){
check(() -> SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE));
}

check(() -> SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1));
check(() -> SDL_GL_SetAttribute(SDL_GL_RED_SIZE, config.r));
check(() -> SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, config.g));
check(() -> SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, config.b));
Expand Down
6 changes: 4 additions & 2 deletions backends/backend-sdl/src/arc/backend/sdl/jni/SDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ public class SDL{
SDL_GL_DOUBLEBUFFER = 5,
SDL_GL_DEPTH_SIZE = 6,
SDL_GL_STENCIL_SIZE = 7,
SDL_GL_CONTEXT_MAJOR_VERSION = 17,
SDL_GL_CONTEXT_MINOR_VERSION = 18,
SDL_GL_MULTISAMPLEBUFFERS = 13,
SDL_GL_MULTISAMPLESAMPLES = 14,
SDL_GL_ACCELERATED_VISUAL = 15,
SDL_GL_RETAINED_BACKING = 16,
SDL_GL_CONTEXT_MAJOR_VERSION = 17,
SDL_GL_CONTEXT_MINOR_VERSION = 18,
SDL_GL_CONTEXT_PROFILE_CORE = 1,
SDL_GL_CONTEXT_PROFILE_MASK = 21,
SDL_GL_CONTEXT_FLAGS = 20
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ libraries.jnigen = [

allprojects{
apply plugin: 'maven-publish'
group = 'com.github.Anuken'
group = 'com.github.mindustry-antigrief'
version = '1.0'

buildscript{
Expand Down
5 changes: 2 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rootProject.name = "arc"
include ":arc-core"

include ":extensions"
Expand All @@ -11,7 +12,7 @@ include ":extensions:g3d"
include ":extensions:box2d"
include ":extensions:tiled"
include ":extensions:discord"
include ":extensions:profiler"
include ":extensions:profiling"

include ":backends"
include ":backends:backend-android"
Expand All @@ -30,5 +31,3 @@ include ":natives:natives-box2d-desktop"
include ":natives:natives-box2d-android"
include ":natives:natives-box2d-ios"
include ":natives:natives-freetype-ios"

rootProject.name = "arc"

0 comments on commit 1233bd8

Please sign in to comment.