public void Render() { if(alpha<.05) alpha=.05f; if(alpha>1) alpha=1; player.Move(Input2.GamePad0.AnalogLeft.X,Input2.GamePad0.AnalogLeft.Y,Input2.GamePad0.AnalogRight); Director.Instance.Update(); scene.RemoveAllChildren(true); TextureInfo ti1 = new TextureInfo(); if(player.shottype==0) ti1.Texture = backGround; else ti1.Texture = backGround1; SpriteUV sprite1 = new SpriteUV(); sprite1.TextureInfo = ti1; sprite1.Quad.S = ti1.TextureSizef;//.Multiply(.8f); sprite1.CenterSprite(); sprite1.Position = scene.Camera.CalcBounds().Center; sprite1.Color.A =alpha; scene.AddChild(sprite1); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; foreach (ShotClass item in shots){ if(item.On && item.type==0) item.Render( ballTexture, scene); if(item.On && item.type==1) item.Render( ballTexture1, scene); } foreach( EnemyClass enemy in enemies){ if(enemy.isOn()){ enemy.Update(); enemy.Render(scene); } } player.Render(scene,width,height); for( int i =0; i < dead.Count-1; i++){ if(dead[i].count >= 11){ dead[i].On=false; } if(dead[i].On) dead[i].Render(scene); } // Image img = new Image(ImageMode.Rgba, new ImageSize(width,height), // new ImageColor(255,0,0,0)); // img.DrawText("Hello World", // new ImageColor(255,0,0,255), // new Font(FontAlias.System,170,FontStyle.Regular), // new ImagePosition(0,150)); // // Texture2D texture = new Texture2D(width,height,false, // PixelFormat.Rgba); // texture.SetPixels(0,img.ToBuffer()); // img.Dispose(); // // Image img1 = new Image(ImageMode.Rgba, new ImageSize(width/5,height/10), // new ImageColor(255,0,0,0)); // img1.DrawText(scene.Camera.CalcBounds().Center.ToString(), // new ImageColor(0,0,255,255), // new Font(FontAlias.System,20,FontStyle.Regular), // new ImagePosition(0,0)); // // Texture2D texture1 = new Texture2D(width/5,height/10,false, // PixelFormat.Rgba); // texture1.SetPixels(0,img1.ToBuffer()); // img1.Dispose(); // // // TextureInfo ti1 = new TextureInfo(); // ti1.Texture = texture1; // // SpriteUV sprite1 = new SpriteUV(); // sprite1.TextureInfo = ti1; // // sprite1.Quad.S = ti1.TextureSizef; // sprite1.CenterSprite(); // sprite1.Position = new Vector2(100,100);// scene.Camera.CalcBounds().Center; // // scene.AddChild(sprite1); // // // TextureInfo ti = new TextureInfo(); // ti.Texture = texture; // // SpriteUV sprite = new SpriteUV(); // sprite.TextureInfo = ti; // // sprite.Quad.S = ti.TextureSizef; // sprite.CenterSprite(); // sprite.Position = new Vector2(100,100); // //scene.AddChild(sprite); if(altimer.Milliseconds() > 800){ alpha-=.1f; altimer.Reset(); } counter++; if(timer1.Milliseconds() >= 1000){ timer1.Reset(); FPS=counter; counter=0; img = new Image(ImageMode.Rgba, new ImageSize(width/2,height/10), new ImageColor(255,255,0,0)); img.DrawText("Score: "+score.ToString()+"\nHighscore: "+highscore.ToString()+ " " + (FPS).ToString(), new ImageColor(255,0,0,255), new Font(FontAlias.System,20,FontStyle.Bold), new ImagePosition(0,0)); texturet = new Texture2D(width/2,height/10,false, PixelFormat.Rgba); texturet.SetPixels(0,img.ToBuffer()); img.Dispose(); } TextureInfo ti = new TextureInfo(); ti.Texture = texturet; SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; sprite.Quad.S = ti.TextureSizef; //sprite.CenterSprite(); sprite.Position = uppercorner; scene.AddChild(sprite); Director.Instance.Render(); Director.Instance.GL.Context.SwapBuffers(); Director.Instance.PostSwap(); }
/// <summary> /// Draws the sprite. and Add the scene. /// 文字列(のsprite)を作成するメソッド /// </summary> /// <returns> /// The sprite. /// </returns> /// <param name='drawStr'> /// Draw string. /// </param> /// <param name='positionX'> /// Position x. /// </param> /// <param name='positionY'> /// Position y. /// </param> /// <param name='fontSize'> /// Font size. /// </param> /// <param name='fontColor'> /// Font color. /// </param> public static SpriteUV DrawSprite(String drawStr,float positionX, float positionY, int fontSize,ImageColor fontColor) { //Director.Initialize(); //重要なんで最初にinitializeしようね。GameEngine2Dのために必要(たぶんほかにも) //Scene //Sce.Pss.HighLevel.GameEngine2DのScene() //scene.Camera.SetViewFromViewport(); //CameraをDisplayで使う たぶん画面サイズ -> 3DCGソフトでいうところのカメラ。それの移してる範囲=画面サイズ positionX = Const.DISPLAY_WIDTH - Const.DISPLAY_WIDTH*(Const.GRID_NUM_X-positionX)/Const.GRID_NUM_X; positionY = Const.DISPLAY_HEIGHT - Const.DISPLAY_HEIGHT*(Const.GRID_NUM_Y-positionY)/Const.GRID_NUM_Y; //the Director's OpenGL context たぶん画面サイズの幅 //var width = (int)Const.getVITA_DISPLAY_WIDTH(); //var height = (int)Const.getVITA_DISPLAY_HEIGHT(); //Font font = new Font(FontAlias.System, fontSize, FontStyle.Regular); Font font = new Font(Const.DEFAULT_FONT, fontSize, FontStyle.Regular); //日本語使う var width = font.GetTextWidth(drawStr); var height = font.GetTextWidth("oo"); //Console.WriteLine(width + " : " + height); //Image classはimageデータを保つよ~。 PNG or JPGなど //今回はblankのnew Image でも、これ作らないと img.DrawTextが使えない Image img = new Image(ImageMode.Rgba, new ImageSize(width,height), //固定で。たぶん描画範囲 new ImageColor(255,0,0,0));//blankなので変更しても意味なし //ここで文字を作ってる img.DrawText(drawStr, fontColor, font, new ImagePosition(0, 0)); //画面の位置 //textureを作る Texture2D texture = new Texture2D(width, height, false, PixelFormat.Rgba); //Texture2D を使うためにimageからpixelデータに変換(img.ToBuffer()) //それをtexture.SetPixelsでtextureにPixcelデータを貼り付け texture.SetPixels(0, img.ToBuffer()); //で一覧のimgの処理を実行 img.Dispose(); //新しいTexture作るときはTextureInfoも作らないとね TextureInfo ti = new TextureInfo(); ti.Texture = texture; //スプライト(イメージパターン)を作る。まぁ、テクスチャだし SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; //テクスチャーの貼り付けられた長方形(quad.S)を作成。サイズはImage img = new Imageのとこ。たぶん sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); //sprite.Position = scene.Camera.CalcBounds().Center; positionX = positionX + sprite.Quad.S.X/2; positionY = Const.DISPLAY_HEIGHT- positionY - sprite.Quad.S.Y; sprite.Position = new Vector2(positionX,positionY); return sprite; }
/*private static GraphicsContext graphics; public static void Main (string[] args) { Initialize (); while (true) { SystemEvents.CheckEvents (); Update (); Render (); } } public static void Initialize () { // Set up the graphics system graphics = new GraphicsContext (); } public static void Update () { // Query gamepad for current state var gamePadData = GamePad.GetData (0); } public static void Render () { // Clear the screen graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f); graphics.Clear (); // Present the screen graphics.SwapBuffers (); }*/ public static void Main(string[] args) { //JP: initialize GameEngine2D singletion that handles loop Director.Initialize(); //JP: New 2D scene (graph) container (and camera alignment to orthogonal view Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); //JP: Get width and height to local variables (optimization) var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; //JP: Create new image Image img = new Image(ImageMode.Rgba, new ImageSize(width,height), new ImageColor(255,0,0,0)); img.DrawText("Dream-Gin", new ImageColor(255,0,0,255), new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150)); //JP: Create hax0r frame buffer and add our img to it's buffer (and consequently kill img content) Texture2D texture = new Texture2D(width,height,false, PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer()); img.Dispose(); //JP: Texture info needed for SpriteUV TextureInfo ti = new TextureInfo(); ti.Texture = texture; //JP: Add ti to SpriteUV SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; //JP: resize sprite and center sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); sprite.Position = scene.Camera.CalcBounds().Center; //JP: Add to Scene scene.AddChild(sprite); //JP: execute loop shit Director.Instance.RunWithScene(scene, true); bool gameOver = false; while(!gameOver) { Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.Update(); if(Input2.GamePad.GetData(0).Left.Release) { sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90)); } if(Input2.GamePad0.Right.Release) { sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90)); } if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up) { sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f,sprite.Quad.S.Y += 10.0f); sprite.CenterSprite(); } if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down) { sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f,sprite.Quad.S.Y -= 10.0f); sprite.CenterSprite(); } if(Input2.GamePad0.Circle.Press == true) gameOver = true; Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.Render(); Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.GL.Context.SwapBuffers(); Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.PostSwap(); } Director.Terminate(); }
/// <summary> /// ボスのHP表示を更新する /// </summary> /// <param name='hp'> /// Hp. /// </param> /// <param name='maxhp'> /// Maxhp. /// </param> public static void UpdateBossHp(int hp,int maxhp){ Scenes.sceneOnGame.RemoveChild(bossHpSprite,true); float rate = (float)hp / maxhp; var image = new Image(ImageMode.Rgba,new ImageSize((int)(600*rate),5),new ImageColor(255,0,0,255)); var texture = new Texture2D((int)(600*rate),5,false, PixelFormat.Rgba); texture.SetPixels(0, image.ToBuffer()); image.Dispose(); var textureInfo = new TextureInfo(texture); bossHpSprite = new SpriteUV(){TextureInfo = textureInfo}; bossHpSprite.Quad.S = textureInfo.TextureSizef; bossHpSprite.CenterSprite(new Vector2(0,0)); bossHpSprite.Position = new Vector2(200,470); Scenes.sceneOnGame.AddChild(bossHpSprite); }
public void Render( Texture2D texture, Scene scene) { TextureInfo ti1 = new TextureInfo(); //if(flip) ti1.Texture = texture; // else // ti1.Texture = texture1; SpriteUV sprite1 = new SpriteUV(); sprite1.TextureInfo = ti1; if(type==0) sprite1.Quad.S = ti1.TextureSizef.Multiply(.3f); if(type==1) sprite1.Quad.S = ti1.TextureSizef.Multiply(.05f); sprite1.CenterSprite(); sprite1.Position = position;// scene.Camera.CalcBounds().Center; sprite1.Rotate(-rotation);//*Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Pi/180); scene.AddChild(sprite1); }
/// <summary> /// コンストラクタ /// </summary> public Symbol(SpriteUV sprite, SymbolType type) { sprite.Scale = new Sce.PlayStation.Core.Vector2(1.0f); sprite.Quad.S = sprite.TextureInfo.TextureSizef; sprite.CenterSprite(); Image = sprite; Type = type; }
public MainScene() { this.ScheduleUpdate (); SceneCamera = (Camera2D)Camera; SceneCamera.SetViewFromHeightAndCenter (_screenSize.Y, _screenSize / 2.0f); //_background = new Layer (SceneCamera, 0.1f, 0.1f); //_main = new Layer (SceneCamera); _main = new Node (); /* _physics = new PhysicsScene(); _physics.InitScene(); */ _playerCreature = new PlayerCreature (); _playerCreature.sprite.Position = Camera.CalcBounds ().Center; // _player.PositionAll = SceneCamera.CalcBounds().Center; /* _block = new PhysicalSpriteUV(new TextureInfo("/Application/assets/floor.png"), _physics); _block.PositionAll = new Vector2(SceneCamera.CalcBounds().Center.X + 10, SceneCamera.CalcBounds().Center.Y - 100); _physics.sceneBodies[_block.BodyIndex].SetBodyStatic(); _physics.restitutionCoeff = 0.9f; _physics.sceneMax = new Vector2(10000, 10000); _physics.sceneMin = new Vector2(-10000, -10000); */ //AddChild (new SpriteUV(new TextureInfo("/Application/king_water_drop.png"))); //_main.AddChild (_player); var background = new SpriteUV (new TextureInfo ("/Application/assets/background.png")); background.Quad.S = background.TextureInfo.TextureSizef; background.CenterSprite (); //_physics.Gravity = new Vector2(0.0f, -98f); background.Position = SceneCamera.CalcBounds ().Center; //_background.AddChild(background); //AddChild(_background); //AddChild(_block); AddChild (_main); _main.AddChild (background); _main.AddChild (_playerCreature.sprite); _enemies = new ArrayList (); // enemy sprite test code var fish0 = new FishEnemy (new Vector2 (30.0f, 30.0f), _playerCreature); var fish1 = new FishEnemy (new Vector2 (15.0f, 15.0f), _playerCreature); var fish2 = new FishEnemy (new Vector2 (100.0f, 70.0f), _playerCreature); _enemies.Add (fish0); _enemies.Add (fish1); _enemies.Add (fish2); // _main.AddChild (FishEnemy.spriteList); }
/// <summary> /// スコアを更新する /// </summary> /// <param name='inc'> /// 指定された分だけ増加させる /// </param> public static void UpdateScore(int inc){ Scenes.sceneOnGame.RemoveChild(scoreSprite,true); Global.score += inc; var texture = Convert.CreateTextureFromText("SCORE "+Global.score,new Font(FontAlias.System, 20, FontStyle.Bold),0xffffffff); var textureInfo = new TextureInfo(texture); scoreSprite = new SpriteUV(){TextureInfo = textureInfo}; scoreSprite.Quad.S = textureInfo.TextureSizef; scoreSprite.CenterSprite(); scoreSprite.Position = new Vector2(700,520); Scenes.sceneOnGame.AddChild(scoreSprite); }
public static void Main(string[] args) { Director.Initialize(); //Initialize (); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; /* Color Matrix Values * Unfortunately C# doesn't allow the regular #define usage, * See: The #define directive cannot be used to declare constant values * as is typically done in C and C++. Constants in C# are best defined as static members of a * class or struct. If you have several such constants, consider creating a separate "Constants" * class to hold them. * */ const int RED = 255; const int BLUE = 0; const int GREEN = 0; const int ALPHA = 0; Image img = new Image(ImageMode.Rgba, new ImageSize(width, height), new ImageColor(RED,GREEN,BLUE,ALPHA)); img.DrawText("Hello World", new ImageColor(RED,GREEN,BLUE,ALPHA+255), new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150)); Texture2D texture = new Texture2D(width,height,false,PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer()); img.Dispose(); TextureInfo ti = new TextureInfo(); ti.Texture = texture; SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); sprite.Position = scene.Camera.CalcBounds().Center; scene.AddChild(sprite); Director.Instance.RunWithScene(scene); }
public ClearScene() { var texture = new Texture2D("Application/Assets/images/end_image.png", false); var textureInfo = new TextureInfo(texture); this.RegisterDisposeOnExit (textureInfo); var sprite = new SpriteUV(){ TextureInfo = textureInfo}; sprite.Quad.S = new Vector2(30,18); sprite.CenterSprite(new Vector2(0.5f,0.5f)); AddChild(sprite); ScheduleUpdate(2); }
public void Render(Scene scene) { if(timer.Milliseconds() > 25){ count++; timer.Reset(); } TextureInfo ti1 = new TextureInfo(); if(count > 11) count=11; ti1.Texture = list[count]; SpriteUV sprite1 = new SpriteUV(); sprite1.TextureInfo = ti1; sprite1.Quad.S = ti1.TextureSizef.Multiply(0.7f); sprite1.CenterSprite(); sprite1.Position = position;// scene.Camera.CalcBounds().Center; scene.AddChild(sprite1); }
/// <summary> /// 初期化処理 /// </summary> public void Initialize() { // リールより後ろにある画像をロード _reelBg = new SpriteUV(new TextureInfo("/Application/resources/SlotReelBg.png")); _reelBg.Scale = new Vector2(1.0f); _reelBg.Quad.S = _reelBg.TextureInfo.TextureSizef; _reelBg.CenterSprite(); _reelBg.Position = new Vector2(_root.Camera.CalcBounds().Size.X * 0.5f, _root.Camera.CalcBounds().Size.Y * 0.5f); // リールより前にある画像をロード _reelFg = new SpriteUV(new TextureInfo("/Application/resources/SlotReelFg.png")); _reelFg.Scale = new Vector2(1.0f); _reelFg.Quad.S = _reelBg.TextureInfo.TextureSizef; _reelFg.CenterSprite(); _reelFg.Position = new Vector2(_root.Camera.CalcBounds().Size.X * 0.5f, _root.Camera.CalcBounds().Size.Y * 0.5f); // 各リールを表示するためのノードを作成する _nodeLeft = new Node(); _nodeCenter = new Node(); _nodeRight = new Node(); // 各シンボルは辞書に保存しておく _symbolDic = new Dictionary<Symbol.SymbolType, Symbol>(); _symbolDic.Add(Symbol.SymbolType.Bar, new Symbol("/Application/resources/Bar.png",Symbol.SymbolType.Bar)); _symbolDic.Add(Symbol.SymbolType.Bell, new Symbol("/Application/resources/Bell.png",Symbol.SymbolType.Bell)); _symbolDic.Add(Symbol.SymbolType.BlueSeven, new Symbol("/Application/resources/BlueSeven.png",Symbol.SymbolType.BlueSeven)); _symbolDic.Add(Symbol.SymbolType.Cherry, new Symbol("/Application/resources/Cherry.png",Symbol.SymbolType.Cherry)); _symbolDic.Add(Symbol.SymbolType.Orange, new Symbol("/Application/resources/Orange.png",Symbol.SymbolType.Orange)); _symbolDic.Add(Symbol.SymbolType.RedSeven, new Symbol("/Application/resources/RedSeven.png",Symbol.SymbolType.RedSeven)); _symbolDic.Add(Symbol.SymbolType.Reply, new Symbol("/Application/resources/Reply.png",Symbol.SymbolType.Reply)); _symbolDic.Add(Symbol.SymbolType.Watermelon, new Symbol("/Application/resources/Watermelon.png",Symbol.SymbolType.Watermelon)); // 図柄コンテナクラスを作成。引数は図柄のWidthとHeight _symbolsLeft = new SymbolCollection(128, 128); _symbolsCenter = new SymbolCollection(128, 128); _symbolsRight = new SymbolCollection(128, 128); #if true // 左側リールの図柄設定 _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); // 中央リールの図柄設定 _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); // 右側リールの図柄設定 _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.BlueSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bell]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Watermelon]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); #else // 左側リールの図柄設定 _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsLeft.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); // 中央リールの図柄設定 _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsCenter.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); // 右側リールの図柄設定 _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Reply]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Cherry]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.Bar]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); _symbolsRight.AddSymbol(_symbolDic[Symbol.SymbolType.RedSeven]); #endif // リールインスタンス作成 _reelLeft = new Reel(_symbolsLeft); _reelCenter = new Reel(_symbolsCenter); _reelRight = new Reel(_symbolsRight); // 停止イベントハンドラ設定 _reelLeft.Stopped += OnStopped; _reelCenter.Stopped += OnStopped; _reelRight.Stopped += OnStopped; // リールリストに各リールを設定 ReelList.Add(_reelLeft); ReelList.Add(_reelCenter); ReelList.Add(_reelRight); // 表示位置設定 // 左側のリール _nodeLeft.Position = new Vector2( _root.Camera.CalcBounds().Size.X * 0.5f - _symbolsLeft.Width - 32, _root.Camera.CalcBounds().Size.Y * 0.5f); // 中央のリール _nodeCenter.Position = new Vector2( _root.Camera.CalcBounds().Size.X * 0.5f, _root.Camera.CalcBounds().Size.Y * 0.5f); // 右側のリール _nodeRight.Position = new Vector2( _root.Camera.CalcBounds().Size.X * 0.5f + _symbolsLeft.Width + 32, _root.Camera.CalcBounds().Size.Y * 0.5f); // 図柄を各リールの子ノードとして追加する foreach(var symbol in _symbolsLeft) { _nodeLeft.AddChild(symbol.Image); } foreach(var symbol in _symbolsCenter) { _nodeCenter.AddChild(symbol.Image); } foreach(var symbol in _symbolsRight) { _nodeRight.AddChild(symbol.Image); } // ReelViewの子ノードとして追加 AddChild(_reelBg); AddChild(_reelFg, 100); // 前面に表示するため、優先順位を上げる AddChild(_nodeLeft); AddChild(_nodeCenter); AddChild(_nodeRight); }
/// <summary> /// 自機の残機を更新する /// </summary> /// <param name='d'> /// 変化量 /// </param> public static void UpdateCharacterStack(int d) { if((Global.characterStack + d >= 0) && (Global.characterStack + d <= 4)){ Global.characterStack += d; Scenes.sceneOnGame.RemoveChild(stackSprite,true); stackSprite = new SpriteUV(){TextureInfo = CharacterStackTextureInfo[Global.characterStack]}; stackSprite.Quad.S = CharacterStackTextureInfo[Global.characterStack].TextureSizef; stackSprite.CenterSprite(); stackSprite.Position = new Vector2(850,520); Scenes.sceneOnGame.AddChild(stackSprite); } }
/// <summary> /// スプライト作成 /// </summary> /// <param name='fileName'>ファイル名</param> /// <param name='pos'>ポジション</param> /// <returns>スプライト</returns> public SpriteUV CreateSprite(string fileName, Vector2 pos) { SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = new TextureInfo(new Texture2D(fileName, false)); sprite.Quad.S = sprite.TextureInfo.TextureSizef; sprite.CenterSprite(); sprite.Position = pos; scene.AddChild(sprite); return sprite; }
public void Render(Scene scene) { TextureInfo ti1 = new TextureInfo(); ti1.Texture = texture; SpriteUV sprite1 = new SpriteUV(); sprite1.TextureInfo = ti1; sprite1.Quad.S = ti1.TextureSizef.Multiply(multipier); sprite1.CenterSprite(); sprite1.Position = position;// scene.Camera.CalcBounds().Center; sprite1.Rotate(-rotationAngle);//*Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Pi/180); scene.AddChild(sprite1); }
/// <summary> /// Draws the sprite. and Add the sprite on scene. /// 画像のspriteを作成して返すメソッド /// </summary> /// <returns> /// The sprite. /// </returns> /// <param name='strPicture'> /// String picture. e.g.)"hoge.jpg" /// </param> /// <param name='positionX'> /// Position x. /// </param> /// <param name='positionY'> /// Position y. /// </param> /// <param name='sizeX'> /// Size x. if(sizeX = 0) -> sizeX is real width of picture /// </param> /// <param name='sizeY'> /// Size y. if(sizeY = 0) -> sizeY is real hight of picture /// </param> public static SpriteUV DrawSprite(String strPicture, float positionX, float positionY, float sizeX, float sizeY) { //Director.Initialize(); //重要なんで最初にinitializeしようね。GameEngine2Dのために必要(たぶんほかにも) //Scene //Sce.Pss.HighLevel.GameEngine2DのScene() //scene.Camera.SetViewFromViewport(); //CameraをDisplayで使う たぶん画面サイズ -> 3DCGソフトでいうところのカメラ。それの移してる範囲=画面サイズ positionX = Const.DISPLAY_WIDTH - Const.DISPLAY_WIDTH*(Const.GRID_NUM_X-positionX)/Const.GRID_NUM_X; positionY = Const.DISPLAY_HEIGHT - Const.DISPLAY_HEIGHT*positionY/Const.GRID_NUM_Y; //Texture作成 Texture2D texture = new Texture2D("/Application/resources/" + strPicture, false); //新しいTexture作るときはTextureInfoも作らないとね TextureInfo ti = new TextureInfo(); ti.Texture = texture; //スプライト(イメージパターン)を作る。まぁ、テクスチャだし SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; //テクスチャーの貼り付けられた長方形(quad.S)を作成。サイズはImage img = new Imageのとこ。たぶん if(sizeX == 0 || sizeY ==0){ sprite.Quad.S = ti.TextureSizef; //画像のオリジナルサイズサイズ }else{ sprite.Quad.S = new Vector2(sizeX,sizeY); } sprite.CenterSprite(); sprite.Position = new Vector2(0,0); //sprite.Position = new Vector2(positionX+sprite.Quad.S.X/2,positionY-sprite.Quad.S.Y/2); //オブジェクトの位置 sprite.Quad.T.X = positionX; sprite.Quad.T.Y = positionY - sprite.Quad.S.Y; return sprite; }
/// <summary> /// スキルポイントの表示を更新 /// </summary> /// <param name='skillPoint'> /// skillPointだけ増加させる。マイナスの値も可 /// </param> public static void UpdateSkillPoint(int skillPoint){ if((Global.skillPoint + skillPoint >= 0) && (Global.skillPoint + skillPoint <= 3)){ Global.skillPoint += skillPoint; Scenes.sceneOnGame.RemoveChild(skillPointSprite,true); var baseImage = new Image("Application/resourses/SPgause.png"); var starImage = new Image("Application/resourses/star.png"); baseImage.Decode(); starImage.Decode(); for(int i = 0; i < Global.skillPoint; i++){ baseImage.DrawImage(starImage,new ImagePosition(40*(i+1),0)); } var texture = Convert.CreateTextureFromImage(baseImage); var textureInfo = new TextureInfo(texture); skillPointSprite = new SpriteUV(){TextureInfo = textureInfo}; skillPointSprite.Quad.S = textureInfo.TextureSizef; skillPointSprite.CenterSprite(new Vector2(0,0)); skillPointSprite.Position = new Vector2(0,490); Scenes.sceneOnGame.AddChild(skillPointSprite); } }
/// <summary> /// ゲームを開始するメソッド /// </summary> /// <param name='stageId'> /// 開始するステージID /// </param> public static void StartGame(StageID stageId) { Scenes.sceneOnGame.Cleanup(); // 背景テクスチャをロード backGroundTexture = new Texture2D("Application/resourses/background1.jpg", false); backGroundTextureInfo = new Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo(backGroundTexture); // 自機テクスチャをロード myShipTexture = new Texture2D("Application/resourses/myCharacter.gif", false); myShipTextureInfo = new Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo(myShipTexture); // スプライト作成 backGroundSprite = new SpriteUV(){TextureInfo = backGroundTextureInfo}; backGroundSprite.Quad.S = backGroundTextureInfo.TextureSizef; myShipSprite = new SpriteUV(){TextureInfo = myShipTextureInfo}; myShipSprite.Quad.S = myShipTextureInfo.TextureSizef; myShipSprite.Scale = new Vector2(0.8f,0.8f); // スプライトの中心をテクスチャの中心に設定 backGroundSprite.CenterSprite(); myShipSprite.CenterSprite(); // スプライトの表示位置をカメラの中央に配置 backGroundSprite.Position = Scenes.sceneOnGame.Camera.CalcBounds().Center; myShipSprite.Position = new Vector2(100,272); // シーンの子要素としてスプライトを追加 Scenes.sceneOnGame.AddChild(backGroundSprite); Scenes.sceneOnGame.AddChild(myShipSprite); Enemy.InitEnemy(); MyBullet.InitMyBullet(); EnemyBullet.InitEnemyBullet(); Item.InitItem(); Rayer.InitRayer(); // 乱数発生インスタンスを生成 random = new Random(); // 削除待ちキュー作成 myBulletDeleteQueue = new ArrayList(); enemyBulletDeleteQueue = new ArrayList(); enemyDeleteQueue = new ArrayList(); itemDeleteQueue = new ArrayList(); Global.characterStack = 4; Global.characterActive = true; Global.score = 0; Global.skillPoint = 0; Global.isClear = false; Global.isGameOver = false; Rayer.UpdateScore(0); Rayer.UpdateCharacterStack(0); Rayer.UpdateSkillPoint(0); time = 0; tickCount = 0; playingStageId = stageId; SkillTimeCount = 0.0f; defaultSkillInTime = false; Stage.StartStage1(); Director.Instance.Update (); Scenes.sceneOnGame.RegisterDisposeOnExitRecursive(); Scheduler.Instance.Schedule(Scenes.sceneOnGame,Tick,0.01f,false); }
public void Render(Scene scene, int width, int height) { Image img1 = new Image(ImageMode.Rgba, new ImageSize(width/5,height/10), new ImageColor(255,0,0,0)); img1.DrawText(RotationAngle.ToString()+" "+currentAngle.ToString(), new ImageColor(0,0,255,255), new Font(FontAlias.System,20,FontStyle.Regular), new ImagePosition(0,0)); Texture2D texture1 = new Texture2D(width/5,height/10,false, PixelFormat.Rgba); texture1.SetPixels(0,img1.ToBuffer()); img1.Dispose(); TextureInfo ti1 = new TextureInfo(); // if(timer.Milliseconds()>100){ // flip = !flip; // timer.Reset(); // } //if(flip) { ti1.Texture = shipTexture; //flip= !flip; // } // else { // ti1.Texture = shipTexture1; //flip = !flip; // } // else // ti1.Texture = texture1; SpriteUV sprite1 = new SpriteUV(); sprite1.TextureInfo = ti1; sprite1.Quad.S = ti1.TextureSizef.Multiply(.3f); sprite1.CenterSprite(); sprite1.Position = position;// scene.Camera.CalcBounds().Center; sprite1.Rotate(-RotationAngle);//*Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Pi/180); scene.AddChild(sprite1); }
private SpriteUV CreateSpriteUV(String path, Boolean centerToSprite, Vector2 center) { if (String.IsNullOrWhiteSpace(path)) throw new ArgumentException(); if (!TextureAssetsByUsers.ContainsKey(path)) throw new ArgumentException("Unknown texture asset: " + path); TextureInfo ti = GetTextureInfo(path);//TextureAssetsByUsers[path].TextureInfo; SpriteUV s = new SpriteUV(ti); s.Quad.S = ti.TextureSizef; if (centerToSprite) s.CenterSprite(); else s.CenterSprite(center); return s; }
/// <summary> /// スキル使用時エフェクト /// </summary> /// <param name='mySpritePosition'> /// 自機スプライトの位置 /// </param> public static void SkillUseEffect(Vector2 mySpritePosition) { var image1 = new Image("/Application/resourses/Bullet01_64x64.png"); image1 = image1.Crop(new ImageRect(0,0,64,64)); var image2 = new Image("/Application/resourses/effect1.png"); image2 = image2.Resize(new ImageSize(960,180)); var waveTexture = Convert.CreateTextureFromImage(image1); image2.Decode(); var bgTexture = Convert.CreateTextureFromImage(image2); image1.Dispose(); image2.Dispose(); var skillName = ""; switch(Global.setSkill){ case SkillID.Default : skillName = "The WORLD"; break; case SkillID.Skill1 : skillName = "Refrection"; break; case SkillID.Skill2 : skillName = ""; break; case SkillID.Skill3 : skillName = ""; break; } var textTexture = Convert.CreateTextureFromText(skillName,new Font(FontAlias.System,120,FontStyle.Bold | FontStyle.Italic),0xFFFFFF00) ; waveTextureInfo = new TextureInfo(waveTexture); textTextureInfo = new TextureInfo(textTexture); bgTextureInfo = new TextureInfo(bgTexture); waveSprite = new SpriteUV(){TextureInfo = waveTextureInfo}; textSprite = new SpriteUV(){TextureInfo = textTextureInfo}; bgSprite = new SpriteUV(){TextureInfo = bgTextureInfo}; waveSprite.Quad.S = waveTextureInfo.TextureSizef; textSprite.Quad.S = textTextureInfo.TextureSizef; bgSprite.Quad.S = bgTextureInfo.TextureSizef; waveSprite.CenterSprite(); textSprite.CenterSprite(); bgSprite.CenterSprite(); waveSprite.Position = mySpritePosition; textSprite.Position = new Vector2(1500,272); bgSprite.Position = new Vector2(1500,272); Scenes.sceneOnGame.AddChild(waveSprite); Scenes.sceneOnGame.AddChild(bgSprite); Scenes.sceneOnGame.AddChild(textSprite); var seq0 = new Sequence(); seq0.Add(new MoveTo(new Vector2(480,272),1)); seq0.Add(new DelayTime(1.0f)); seq0.Add(new MoveTo(new Vector2(-500,272),1)); var seq1 = new Sequence(); seq1.Add(new MoveTo(new Vector2(480,272),1)); seq1.Add(new DelayTime(1.0f)); seq1.Add(new MoveTo(new Vector2(-500,272),1)); var seq2 = new Sequence(); seq2.Add(new DelayTime(3.5f)); seq2.Add(new CallFunc(()=>{Sounds.PlaySkill2();})); seq2.Add(new ScaleTo(new Vector2(40,40),3)); Sounds.PlaySkill1(); bgSprite.RunAction(seq0); textSprite.RunAction(seq1); waveSprite.RunAction(seq2); }
public static void Main(string[] args) { Director.Initialize(); //Initialize (); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; /* Color Matrix Values * Unfortunately C# doesn't allow the regular #define usage, * See: The #define directive cannot be used to declare constant values * as is typically done in C and C++. Constants in C# are best defined as static members of a * class or struct. If you have several such constants, consider creating a separate "Constants" * class to hold them. * */ const int RED = 255; const int BLUE = 0; const int GREEN = 0; const int ALPHA = 0; Image img = new Image(ImageMode.Rgba, new ImageSize(width, height), new ImageColor(RED,GREEN,BLUE,ALPHA)); img.DrawText("Hello World", new ImageColor(RED,GREEN,BLUE,ALPHA+255), new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150)); Texture2D texture = new Texture2D(width,height,false,PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer()); img.Dispose(); TextureInfo ti = new TextureInfo(); ti.Texture = texture; SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); sprite.Position = scene.Camera.CalcBounds().Center; scene.AddChild(sprite); /* Important: The second argument 'true' defines that the Scene processing would be done manually, * So in this case, we would like to do the following ourselves: * Update(); -- Tells us to move to the next frame. * Render(); -- Draws the next frame. * SwapBuffers(); -- Swaps what the Render() drew in the previous frame. {Hence happens after the render} * PostSwap(); -- Tells us that we've finished with SwapBuffer(); * */ Director.Instance.RunWithScene(scene, true); bool gameOver = false; while(!gameOver) { Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.Update(); // Rotate Left: Preferred Method to Rotate, although not so smooth. /* if(Input2.GamePad.GetData(0).Left.Release) { sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(1)); } */ /* * AWWx1 to do rotation per interrupt. if(Input2.GamePad0.Left.Release) { sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90)); } */ // AWWx2 to do rotation per interrupt, with bitwise comparison. // Interesting Fact, doing a bitwise comparison does a continous rendering. So doing it 1 degree at a time smoothens it out. // Smoothness = 1/InputDegree. if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Left) == GamePadButtons.Left) { sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(1.0f)); } // Rotate Right // Notice that this is NOT continous as compared to the Left Rotate. if(Input2.GamePad.GetData(0).Right.Release) { sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90)); } // Scale Up by a factor of 1/10th. if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up) { sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f, sprite.Quad.S.Y += 10.0f); sprite.CenterSprite(); } // Scale Down by a factor of 1/10th. if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down) { sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f, sprite.Quad.S.Y -= 10.0f); sprite.CenterSprite(); } // Exit if Circle is Pressed. if(Input2.GamePad0.Circle.Press == true) { gameOver = true; } Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.Render(); Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.GL.Context.SwapBuffers(); Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.PostSwap(); } Director.Terminate(); }