Advertisement
xerpi

paripinpong

Apr 22nd, 2012
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4.  
  5. using Sce.Pss.Core;
  6. using Sce.Pss.Core.Environment;
  7. using Sce.Pss.Core.Graphics;
  8. using Sce.Pss.Core.Imaging;
  9. using Sce.Pss.Core.Input;
  10. using Sce.Pss.HighLevel.UI;
  11.  
  12.  
  13. namespace SuitePong
  14. {
  15.    
  16.     public class AppMain
  17.     {
  18.        
  19.         public static Scene scene;
  20.         public static ImageBox background;
  21.         public static ImageBox ball_img;
  22.         public static ImageBox racket_blue_img;
  23.         public static ImageBox racket_red_img;
  24.         public static GraphicsContext graphics;
  25.        
  26.         //Pong stuff!!
  27.             public static Ball ball;
  28.        
  29.         public static void Main (string[] args)
  30.         {
  31.             Initialize ();
  32.  
  33.             while (true) {
  34.                 SystemEvents.CheckEvents ();
  35.                 Update ();
  36.                 Render ();
  37.             }
  38.         }
  39.  
  40.         public static void Initialize ()
  41.         {
  42.             // Set up the graphics system
  43.             graphics = new GraphicsContext ();
  44.             scene = new Sce.Pss.HighLevel.UI.Scene();
  45.             UISystem.Initialize (graphics);
  46.            
  47.             background = new ImageBox();
  48.             ball_img = new ImageBox();
  49.             racket_blue_img = new ImageBox();
  50.             racket_red_img = new ImageBox();
  51.            
  52.             background.Image = new ImageAsset("/Application/background.png", true);
  53.                 background.X = 0;
  54.                 background.Y = 0;
  55.                 background.SetSize(960, 544);
  56.             ball_img.Image = new ImageAsset("/Application/ball.png", true);
  57.                 ball_img.SetSize(24, 24);
  58.             racket_blue_img.Image = new ImageAsset("/Application/racket_blue.png", true);
  59.                 racket_blue_img.SetSize(10, 100);          
  60.             racket_red_img.Image = new ImageAsset("/Application/racket_red.png", true);
  61.                 racket_red_img.SetSize(10, 100);   
  62.            
  63.             scene.RootWidget.AddChildLast(background);
  64.             scene.RootWidget.AddChildLast(ball_img);
  65.             //scene.RootWidget.AddChildLast(racket_red_img);
  66.             //scene.RootWidget.AddChildLast(racket_blue_img);
  67.            
  68.             UISystem.SetScene(scene, null);
  69.            
  70.             //Pong stuff!!
  71.                 ball = new Ball(20, 20, 100, 100);
  72.            
  73.         }
  74.  
  75.         public static void Update ()
  76.         {
  77.             // Query gamepad for current state
  78.             var gamePadData = GamePad.GetData (0);
  79.         }
  80.  
  81.         public static void Render ()
  82.         {
  83.             // Clear the screen
  84.             graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f);
  85.             graphics.Clear ();
  86.            
  87.             //Pong stuff!!
  88.                 ball.blit(ball_img);
  89.            
  90.             UISystem.Render ();
  91.             // Present the screen
  92.             graphics.SwapBuffers ();
  93.         }
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement