/// 開始 public override bool DoStart() { // Console.WriteLine(TexId + " " + tweetNumber); tweetNumber = StaticDataList.getRandom(0, 9); currentFont = new Font(FontAlias.System, 20, FontStyle.Regular); sprite = new DemoGame.Sprite(tweet.tweetlist[TexId, tweetNumber], 0xffffffff, currentFont, 0, 0); textureShaderProgram = createSimpleTextureShader(); scaleX = tweet.tweetlist[TexId, tweetNumber].Length / 6.0f; return(true); }
/// スプライトの追加 public static void AddSprite(string key, Sprite sprite) { if (spriteDict.ContainsKey(key) == false) { spriteDict.Add(key, sprite); } }
/// スプライトの追加 public static void AddSprite(Sprite sprite) { AddSprite("[nameless]:" + spriteNamelessCount, sprite); spriteNamelessCount++; }
/// スプライト描画 public static void DrawSprite(Sprite sprite, int offsetX = 0, int offsetY = 0, float alphaRate = 1.0f) { if(!sprite.Visible){ return; } var modelMatrix = sprite.CreateModelMatrix(offsetX, offsetY); var worldViewProj = projectionMatrix * viewMatrix * modelMatrix; textureShaderProgram.SetUniformValue(0, ref worldViewProj); int alphaRateId = textureShaderProgram.FindUniform("AlphaRate"); if (alphaRateId >= 0) { textureShaderProgram.SetUniformValue(alphaRateId, alphaRate); } graphics.SetShaderProgram(textureShaderProgram); graphics.SetVertexBuffer(0, sprite.Vertices); graphics.SetTexture(0, sprite.Texture); graphics.Enable(EnableMode.Blend); graphics.Disable(EnableMode.DepthTest); graphics.Disable(EnableMode.CullFace); graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha); graphics.DrawArrays(DrawMode.TriangleFan, 0, 4); }
public void changeText() { tweetNumber = (int)StaticDataList.getRandom(0,9); sprite = new DemoGame.Sprite(tweet.tweetlist[TexId,tweetNumber], 0xffffffff, currentFont, 0,0); scaleX *= tweet.tweetlist[TexId,tweetNumber].Length / 9.0f; }
/// 開始 public override bool DoStart() { // Console.WriteLine(TexId + " " + tweetNumber); tweetNumber = StaticDataList.getRandom(0,9); currentFont = new Font( FontAlias.System, 20, FontStyle.Regular ); sprite = new DemoGame.Sprite(tweet.tweetlist[TexId,tweetNumber], 0xffffffff, currentFont, 0,0); textureShaderProgram = createSimpleTextureShader(); scaleX = tweet.tweetlist[TexId,tweetNumber].Length/6.0f; return true; }
public void changeText() { tweetNumber = (int)StaticDataList.getRandom(0, 9); sprite = new DemoGame.Sprite(tweet.tweetlist[TexId, tweetNumber], 0xffffffff, currentFont, 0, 0); scaleX *= tweet.tweetlist[TexId, tweetNumber].Length / 9.0f; }