Ejemplo n.º 1
0
        public Tortoise2d(string windowTitle, int windowWidth, int windowHeight, int unitsOnX, int unitsOnY, int renderSize, int stateSize)
        {
            Console.WriteLine(author);
            WWidth = windowWidth;
            WHeight = windowHeight;
            WTitle = windowTitle;
            this.X = 100;
            this.Y = 100;
            References.game = this;

            Title = WTitle;
            ClientSize = new System.Drawing.Size(WWidth, WHeight);
            Debug.PrintEngine("Window: W:" + ClientSize.Width + ",H:" + ClientSize.Height);
            //this.WindowState = WindowState.Fullscreen;

            this.renderSize = renderSize;
            this.stateSize = stateSize;

            grid = new Grid(unitsOnX, unitsOnY, WWidth, WHeight);
            CX = unitsOnX;
            CY = unitsOnY;
            textures = new TextureManager();
            renderer = new Renderer(this, WWidth, WHeight + 44, renderSize, 1000, textures, grid);
            layers = new LayerManager(10);
            input = new PCInput(this);
            states = new GameStateManager(this, stateSize);
            camera = new Camera(this, 0, 0);
            sound = new SoundManager(1000);
            fps = new FPS();

            matrix = new Math.Matrix2();
            matrix.SetAll(0);
            random = new Random();

            References.renderer = renderer;
            References.input = input;
            References.textures = textures;
            References.layers = layers;
            References.states = states;
            References.grid = grid;
            References.camera = camera;
            References.sound = sound;
            References.matrix = matrix;
            References.random = random;
            References.fps = fps;

            Debug.DEBUG = true;
            Debug.ENGINE_DEBUG = true;
        }
Ejemplo n.º 2
0
        public Renderer(Tortoise2d gg, int w, int h, int sprites, int maxlights, TextureManager t, Grid g)
        {
            game = gg;
            tm = t;
            width = w;
            height = h;

            _1920scale = (float)w / 1920;
            _1080scale = (float)h / 1080;
            //if not replace your stone-age-gpu for a decent one!
            Shader.GetSupported();

            shader_plain = new Shader(Shader.RShaderFF("shaders/vertex_plain.glsl"), Shader.RShaderFF("shaders/frag_plain.glsl"));
            shader_w_light = new Shader(Shader.RShaderFF("shaders/vertex_plain.glsl"), Shader.RShaderFF("shaders/frag_with_light.glsl"));
            shader_o_light = new Shader(Shader.RShaderFF("shaders/vertex_plain.glsl"), Shader.RShaderFF("shaders/frag_only_light.glsl"));
            shader_merge = new Shader(Shader.RShaderFF("shaders/vertex_plain.glsl"), Shader.RShaderFF("shaders/frag_merge.glsl"));
            shader_merge_effect = new Shader(Shader.RShaderFF("shaders/vertex_plain.glsl"), Shader.RShaderFF("shaders/frag_merge_effect.glsl"));
            core = new RendererCore(sprites);
            fbo = new Fbo(width, height);
            this.grid = g;
        }