Пример #1
0
    public BBPsmGame()
    {
        _psmGame=this;

        _gc=new GraphicsContext();

        for( int i=0;i<32;++i ) _touchId[i]=-1;
    }
Пример #2
0
    public BBPsmGame()
    {
        _psmGame = this;

        _gc = new GraphicsContext();

        for (int i = 0; i < 32; ++i)
        {
            _touchId[i] = -1;
        }
    }
Пример #3
0
    public virtual bool LoadSample__UNSAFE__(gxtkSample sample, String path)
    {
        Sound sound = BBPsmGame.PsmGame().LoadSound(path);

        if (sound == null)
        {
            return(false);
        }
        sample.SetSound(sound);
        return(true);
    }
Пример #4
0
    public virtual bool LoadSurface__UNSAFE__(gxtkSurface surface, String path)
    {
        Texture2D texture = BBPsmGame.PsmGame().LoadTexture2D(path);

        if (texture == null)
        {
            return(false);
        }
        surface.SetTexture(texture);
        return(true);
    }
Пример #5
0
    public gxtkGraphics()
    {
        _gc = BBPsmGame.PsmGame().GetGraphicsContext();

        ImageRect r = _gc.GetViewport();

        _width  = r.Width;
        _height = r.Height;

        //Shaders....
        //
        _simpleShader  = new ShaderProgram("/Application/shaders/Simple.cgx");
        _textureShader = new ShaderProgram("/Application/shaders/Texture.cgx");

        float[] ortho = new float[] {
            2.0f / (float)_width, 0.0f, 0.0f, 0.0f,
            0.0f, -2.0f / (float)_height, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            -1.0f, 1.0f, 0.0f, 1.0f
        };

        _simpleShader.SetUniformValue(_simpleShader.FindUniform("WorldViewProj"), ortho);
        _textureShader.SetUniformValue(_textureShader.FindUniform("WorldViewProj"), ortho);
        _texUnit = _textureShader.GetUniformTexture(_textureShader.FindUniform("Texture0"));

        //Vertex buffers...
        //
        _vertBuf = new VertexBuffer(MAX_VERTS, VertexFormat.Float2, VertexFormat.UByte4N);

        _quadBuf = new VertexBuffer(MAX_VERTS, MAX_QUADS * 6, VertexFormat.Float2, VertexFormat.UByte4N, VertexFormat.Float2);
        ushort[] idxs = new ushort[MAX_QUADS * 6];
        for (int i = 0; i < MAX_QUADS; ++i)
        {
            idxs[i * 6 + 0] = (ushort)(i * 4);
            idxs[i * 6 + 1] = (ushort)(i * 4 + 1);
            idxs[i * 6 + 2] = (ushort)(i * 4 + 2);
            idxs[i * 6 + 3] = (ushort)(i * 4);
            idxs[i * 6 + 4] = (ushort)(i * 4 + 2);
            idxs[i * 6 + 5] = (ushort)(i * 4 + 3);
        }
        _quadBuf.SetIndices(idxs);
    }
Пример #6
0
    public virtual int PlayMusic(String path, int flags)
    {
        StopMusic();

        _music = BBPsmGame.PsmGame().LoadBgm(path);
        if (_music == null)
        {
            return(-1);
        }

        _musicPlayer = _music.CreatePlayer();
        if (_musicPlayer == null)
        {
            _music = null;
            return(-1);
        }

        _musicPlayer.Loop   = (flags & 1) != 0;
        _musicPlayer.Volume = _musicVolume;
        _musicPlayer.Play();

        return(-1);
    }