package org.gbcpainter.test;
import org.gbcpainter.env.GameSettings;
import org.gbcpainter.env.GraphicsEnv;
import org.gbcpainter.loaders.textures.ResolutionTextureLoader;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* @author Lorenzo Pellegrini
*/
public class InitializeEnv {
public static JFrame initialize( int width, int height, @NotNull String texturesPath ) throws Exception {
JFrame mainFrame = new JFrame( "TEST" );
mainFrame.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
mainFrame.setSize( width, height );
mainFrame.setVisible( true );
try {
GameSettings.loadInstance();
} catch ( IllegalStateException ignored ){}
GameSettings.getInstance().updateData( GameSettings.STRING_SETTINGS_TYPE.TEXTURES_PATH, texturesPath );
GraphicsEnv.getInstance().setGraphicsConfiguration( mainFrame.getGraphicsConfiguration() );
GraphicsEnv.getInstance().setWindowSize( width, height );
GraphicsEnv.getInstance().setTextureLoader( new ResolutionTextureLoader() );
return mainFrame;
}
}