Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using Sce.Pss.Core;
- using Sce.Pss.Core.Environment;
- using Sce.Pss.Core.Graphics;
- using Sce.Pss.Core.Imaging;
- using Sce.Pss.Core.Input;
- using Sce.Pss.HighLevel.UI;
- namespace SuitePong
- {
- public class AppMain
- {
- public static Scene scene;
- public static ImageBox background;
- public static ImageBox ball_img;
- public static ImageBox racket_blue_img;
- public static ImageBox racket_red_img;
- public static GraphicsContext graphics;
- //Pong stuff!!
- public static Ball ball;
- 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 ();
- scene = new Sce.Pss.HighLevel.UI.Scene();
- UISystem.Initialize (graphics);
- background = new ImageBox();
- ball_img = new ImageBox();
- racket_blue_img = new ImageBox();
- racket_red_img = new ImageBox();
- background.Image = new ImageAsset("/Application/background.png", true);
- background.X = 0;
- background.Y = 0;
- background.SetSize(960, 544);
- ball_img.Image = new ImageAsset("/Application/ball.png", true);
- ball_img.SetSize(24, 24);
- racket_blue_img.Image = new ImageAsset("/Application/racket_blue.png", true);
- racket_blue_img.SetSize(10, 100);
- racket_red_img.Image = new ImageAsset("/Application/racket_red.png", true);
- racket_red_img.SetSize(10, 100);
- scene.RootWidget.AddChildLast(background);
- scene.RootWidget.AddChildLast(ball_img);
- //scene.RootWidget.AddChildLast(racket_red_img);
- //scene.RootWidget.AddChildLast(racket_blue_img);
- UISystem.SetScene(scene, null);
- //Pong stuff!!
- ball = new Ball(20, 20, 100, 100);
- }
- 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 ();
- //Pong stuff!!
- ball.blit(ball_img);
- UISystem.Render ();
- // Present the screen
- graphics.SwapBuffers ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement