-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added and implemented window resize events
- Loading branch information
1 parent
1e40b38
commit 30c6e69
Showing
16 changed files
with
221 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/example/opengl3renderer/events/WindowResizeEvent.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.opengl3renderer.events; | ||
|
||
public class WindowResizeEvent extends Event{ | ||
float x; | ||
float y; | ||
public WindowResizeEvent(float x, float y){ | ||
super(Type.WINDOW_RESIZE); | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
public float getX() { | ||
return x; | ||
} | ||
|
||
public float getY() { | ||
return y; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/example/opengl3renderer/ui/object2d/BasicMaterial2D.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.opengl3renderer.ui.object2d; | ||
|
||
import android.content.Context; | ||
|
||
import com.example.opengl3renderer.math.Vec4; | ||
|
||
public class BasicMaterial2D extends Material2D{ | ||
BasicObject2DShader shader; | ||
Vec4 color; | ||
|
||
public BasicMaterial2D(Context context) { | ||
this(context, new Vec4()); | ||
} | ||
|
||
public BasicMaterial2D(Context context, Vec4 color){ | ||
shader = new BasicObject2DShader(context); | ||
this.color = color; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/com/example/opengl3renderer/ui/object2d/BasicObject2DShader.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.opengl3renderer.ui.object2d; | ||
|
||
import android.content.Context; | ||
|
||
import com.example.opengl3renderer.math.Vec4; | ||
import com.example.opengl3renderer.renderer.Uniform; | ||
|
||
public class BasicObject2DShader extends Object2DShader{ | ||
Uniform color; | ||
public BasicObject2DShader(Context context){ | ||
super(context, "assets/ui/BasicShader.vs", "assets/ui/BasicShader.fs"); | ||
color = new Uniform("uColor", shaderProgramId); | ||
} | ||
|
||
public void setColor(Vec4 color){ | ||
this.color.setObject(color); | ||
this.color.sendToShader(); | ||
} | ||
} |
This file contains 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
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/example/opengl3renderer/ui/object2d/arrow/ArrowHead.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.example.opengl3renderer.ui.object2d.arrow; | ||
|
||
import android.content.Context; | ||
|
||
import com.example.opengl3renderer.math.Mat4; | ||
import com.example.opengl3renderer.math.Vec2; | ||
import com.example.opengl3renderer.ui.object2d.BasicMaterial2D; | ||
import com.example.opengl3renderer.ui.object2d.Object2D; | ||
import com.example.opengl3renderer.ui.object2d.Rectangle; | ||
|
||
public class ArrowHead extends Object2D { | ||
BasicMaterial2D material; | ||
float angle; | ||
float length; | ||
float thickness; | ||
Mat4[] models; | ||
|
||
public ArrowHead(Context context){ | ||
this(context, new Vec2(), (float) Math.PI/6, 0.1f, 0.02f); | ||
} | ||
|
||
public ArrowHead(Context context, Vec2 position, float angle, float length, float thickness){ | ||
super(new Rectangle(), new BasicMaterial2D(context)); | ||
this.material = new BasicMaterial2D(context); | ||
this.position = position; | ||
this.angle = angle; | ||
this.length = length; | ||
this.thickness = thickness; | ||
models = new Mat4[2]; | ||
} | ||
|
||
@Override | ||
public boolean isInside(float x, float y) { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.