Skip to content
Snippets Groups Projects
Commit bbfc8e8e authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

#32 Added a not very good dark mode.

parent c87cf334
No related branches found
No related tags found
1 merge request!26Resolve "Options-functionality"
...@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.GL20; ...@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.gameware.game.states.GameStateManager; import com.gameware.game.states.GameStateManager;
import com.gameware.game.states.LoginState; import com.gameware.game.states.LoginState;
import com.gameware.game.states.MenuState;
public class GameWare extends ApplicationAdapter { public class GameWare extends ApplicationAdapter {
private SpriteBatch batch; private SpriteBatch batch;
...@@ -19,6 +20,7 @@ public class GameWare extends ApplicationAdapter { ...@@ -19,6 +20,7 @@ public class GameWare extends ApplicationAdapter {
private static Music music; private static Music music;
private static Boolean musicOn = false; private static Boolean musicOn = false;
private static Boolean soundEffects = true; private static Boolean soundEffects = true;
private static Boolean darkMode = false;
private static GameWare instance = null; private static GameWare instance = null;
//Singleton (lazy initialization) //Singleton (lazy initialization)
...@@ -44,11 +46,19 @@ public class GameWare extends ApplicationAdapter { ...@@ -44,11 +46,19 @@ public class GameWare extends ApplicationAdapter {
@Override @Override
public void render () { public void render () {
if (darkMode){
Gdx.gl.glClearColor(50/255f, 50/255f, 50/255f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
gsm.update(Gdx.graphics.getDeltaTime());
gsm.render(batch);
}
else{
Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
gsm.update(Gdx.graphics.getDeltaTime()); gsm.update(Gdx.graphics.getDeltaTime());
gsm.render(batch); gsm.render(batch);
} }
}
public static void toggleMusic(){ public static void toggleMusic(){
if(musicOn){music.pause();} if(musicOn){music.pause();}
...@@ -67,6 +77,7 @@ public class GameWare extends ApplicationAdapter { ...@@ -67,6 +77,7 @@ public class GameWare extends ApplicationAdapter {
public static void toggleDarkMode(){ public static void toggleDarkMode(){
//Should change the skin. Either what skin is chosen when initiating a state, or done within the glassy ui json file. //Should change the skin. Either what skin is chosen when initiating a state, or done within the glassy ui json file.
//Probably have to move the skin initalization to the state abstract class. //Probably have to move the skin initalization to the state abstract class.
darkMode = !darkMode;
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment