1
0
Fork 0
This repository has been archived on 2024-04-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Global-Gam-Jam-2017/src/globalgamejam/render/DisplayManager.java
2017-01-20 22:34:01 +01:00

47 lines
1.2 KiB
Java

package globalgamejam.render;
import static org.lwjgl.opengl.GL11.*;
import globalgamejam.*;
import globalgamejam.math.*;
/**
* Class created by MrDev023 (Florian RICHER) on 14/01/2017
*/
public class DisplayManager {
public static Matrix4f projection = new Matrix4f();
public static void clear(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
public static void preRender2D(){
projection.loadIdentity();
// projection.Ortho2D(-Main.WIDTH/2.0f, Main.WIDTH/2.0f, -Main.HEIGHT/2.0f, Main.HEIGHT/2.0f, -1, 1);
projection.Ortho2D(0, Main.WIDTH, 0, Main.HEIGHT, -1, 1);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
public static void preRenderGUI(){
projection.loadIdentity();
//Permet de centrer la camera au centre de l'ecran
projection.Ortho2D(0, Main.WIDTH, Main.HEIGHT, 0, -1, 1);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
public static void render2D(){
Main.game.render2D();
}
public static void renderGUI(){
Main.game.renderGUI();
}
}