Search in sources :

Example 1 with ShaderInfo

use of ru.playsoftware.j2meloader.config.ShaderInfo in project J2ME-Loader by nikita36078.

the class MicroLoader method applyConfiguration.

void applyConfiguration() {
    try {
        // Apply configuration to the launching MIDlet
        if (params.showKeyboard) {
            ContextHolder.setVk(new VirtualKeyboard(params));
        } else {
            ContextHolder.setVk(null);
        }
        setProperties();
        final String[] propLines = params.systemProperties.split("\n");
        for (String line : propLines) {
            String[] prop = line.split(":[ ]*", 2);
            if (prop.length == 2) {
                System.setProperty(prop[0], prop[1]);
                MidletSystem.setProperty(prop[0], prop[1]);
            }
        }
        try {
            Charset.forName(System.getProperty("microedition.encoding"));
        } catch (Exception e) {
            System.setProperty("microedition.encoding", "ISO-8859-1");
            MidletSystem.setProperty("microedition.encoding", "ISO-8859-1");
        }
        int screenWidth = params.screenWidth;
        int screenHeight = params.screenHeight;
        Displayable.setVirtualSize(screenWidth, screenHeight);
        Canvas.setBackgroundColor(params.screenBackgroundColor);
        Canvas.setScale(params.screenGravity, params.screenScaleType, params.screenScaleRatio);
        Canvas.setFilterBitmap(params.screenFilter);
        EventQueue.setImmediate(params.immediateMode);
        Canvas.setGraphicsMode(params.graphicsMode, params.parallelRedrawScreen);
        ShaderInfo shader = params.shader;
        if (shader != null) {
            shader.dir = workDir + Config.SHADERS_DIR;
        }
        Canvas.setShaderFilter(shader);
        Canvas.setForceFullscreen(params.forceFullscreen);
        Canvas.setShowFps(params.showFps);
        Canvas.setLimitFps(params.fpsLimit);
        Font.applySettings(params);
        KeyMapper.setKeyMapping(params);
        Canvas.setHasTouchInput(params.touchInput);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ShaderInfo(ru.playsoftware.j2meloader.config.ShaderInfo) VirtualKeyboard(javax.microedition.lcdui.keyboard.VirtualKeyboard) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 VirtualKeyboard (javax.microedition.lcdui.keyboard.VirtualKeyboard)1 ShaderInfo (ru.playsoftware.j2meloader.config.ShaderInfo)1