General

Reply

Level 3

Level 3
Spykam25
Posts: 152
Registered: ‎24-02-2012
Message 1 of 34 (1,839 Views)

SuitePack 0.1

[ Edited ]

sp01.png

 

Hello Everyone!  I created a PlayStation Stuite Library called the SuitePack.  It allows you to do certain tasks easily.  I will be releasing new versions of the SuitePack that will allow you to do even more. Even though it doesn't have a lot of features now and may not be useful to some of you, it can help a lot.

 

Setup:

 

  1. Download SuitePack 0.1 from this link.
  2. Open an existing project and add "SuitePack.dll" to your project's references.

 

Usage:

 

GraphicsDevice

 

GraphicsDevice is a static class I wrote that allows access to the GraphicsDevice from anywhere in your project.

 

Members

 

  • Context - Graphics Context  |   Allows access to the original graphics context.
  • Width - int  |  Gets the width of the current device's screen.
  • Height - int  |  Gets the height of the current device's screen.
  • AspectRatio - float | Gets the aspect ratio of the current device's screen (Width / Height).
  • ColorFormat - PixelFormat
  • DepthFormat - PixelFormat

Methods

 

  • Initialize (DeviceType type) - Initialize the Graphics Device.  This should only be done once. Doing it more than once is like reseting it back to a new state.  If DeviceType.PSVita, the resolution is changed to 960 x 544.
  • Clear (UIColor color, bool clearDevice) - Sets the clear color. If clearDevice is true,  Context.Clear() will be called.
  • SwapBuffers() = Context.SwapBuffers();

 

Usage

 

  1. Remove every line of code in your main class that is related to GraphicsContext. 
  2. In the Initialize method, add the following line:                        GraphicsDevice.Initialize(DeviceType.PSVita or Other);
  3. Right-Click GraphicsDevice and click on Resolve > using SuitePack;
  4. In the Draw method, add the following lines:                                GraphicsDevice.Clear(UIColors.Black, true);                                              GraphicsDevice.SwapBuffers();

 

 

That's the main setup.  Everything else in the SuitePack is straight foward.

 

Make sure that if you decide to use GamePadHelper, TouchHelper, or MotionHelper, you set their data in your main class' Update() method:

 

 

//GamePadHelper

GamePadHelper.SetGamePadData(GamePad.GetData(0));

//TouchHelper

TouchHelper.SetTouchData(Touch.GetData(0));

//MotionHelper

MotionHelper.SetMotionData(Motion.GetData(0));

 

 

 

If you have any questions, suggestions, or problems, just reply and I will try to get back to you.  Also, let me know what you think and give this post a kudo.  Check back every now and then as I might have a new release, new parts of documentation, and more. Thanks!

 

 

Please use plain text.

Level 3

Level 3
Spykam25
Posts: 152
Registered: ‎24-02-2012
Message 2 of 34 (1,790 Views)

SuitePack 0.1 | The "Information" Class

[ Edited ]

 

The "Information" Class

 

The "Information" class allows you to get different information about the device.  While I am still working on this class, it is capable of knowing which device the application is being used on using "Information.Device".

 

Here's an Image.  I was having a problem adding it to the post.

 

Used "Console.WriteLine" to write Information.Device & Information.DeviceName to the console.

 

Members

 

  • Device - DeviceType  |  Get's the Device Type (PSVita or Other).
  • DeviceName - string  | Get's the Device Name.
Please use plain text.

Re: SuitePack 0.1 | The "Information" Class

Cool. Thanks for sharing.

Please use plain text.

Level 3

Level 3
Rogerdodger91
Posts: 235
Registered: ‎02-12-2011
Message 4 of 34 (1,654 Views)

Re: SuitePack 0.1 | The "Information" Class

Whats the advantage of telling what device you are using? On screen button placements is the only practical use i can see for it.
Please use plain text.

Level 3

Level 3
Spykam25
Posts: 152
Registered: ‎24-02-2012
Message 5 of 34 (1,545 Views)

Re: SuitePack 0.1 | The "Information" Class

[ Edited ]

Honestly, I don't know.  I added it because someone will need to use it one day.  Maybe they would want to use it for an application that allows the user to send messages to any vita near them that has the application installed on it (the app could get the name of each device and return them to the user) via bluetooth or perhaps, a developer wanted his application to be optimized for all devices and set up a switch statement:

 

switch (Information.Device)
{
   case PSVita:
       {
           //Use a 960 x 544 image for the background.
           background = new Texture2D("/Application/assets/backgroundVita.png");
           //Do more.

           break;
       }

   case XperiaPlay: case XperiaArc: case XperiaAcro:
       {
          //Use a 854 x 480 image for the background.
          background = new Texture2D("/Application/assets/backgroundXperia.png");
          //Do more.

          break;
       }

   case XperiaS: case XperiaIon:
       {
          //Use a 1280 x 720 image for the background.
          background = new Texture2D("/Application/assets/backgroundXperiaHD.png");
          //Do more.
          
          break;             
       }
}

 

Please use plain text.

Re: SuitePack 0.1 | The "Information" Class


Rogerdodger91 wrote:
Whats the advantage of telling what device you are using? On screen button placements is the only practical use i can see for it.


I have a similar check in my engine. I then adjust the graphical fidelity depending on device. I have different sets of models and shaders which each run on Xperia, Tablet or Vita respectively. I also have a full rifid body 3D physics system running in my engine and I can increase the precision and tick rate of the physics simulation on devices that I know perform better than others.

Martin Caine
Founder and Lead Programmer of Retroburn Game Studios

Twitter | LinkedIn | Facebook
Please use plain text.

Level 3

Level 3
Spykam25
Posts: 152
Registered: ‎24-02-2012
Message 7 of 34 (1,487 Views)

SuitePack 0.1 | Helpers

[ Edited ]

GamePadHelper

 

GamePadHelper makes it easier to access the gamepad throughout your project.  All you have to do is set the GamePadHelper's data in your main class' Update() method:

 

GamePadHelper.SetGamePadData(GamePad.GetData(0));

 

After you have done that, you can access the gamepad from anywhere in your project:

 

//Checks if the cross button is pressed.
if (GamePadHelper.ButtonIsDown(GamePadButtons.Cross))
{
    //Do something.
}

//Checks if the cross button is released.
if (GamePadHelper.ButtonIsUp(GamePadButtons.Cross))
{
    //Do something.
}

//Checks if the previous button is the cross button.
if (GamePadHelper.PreviousButtonIs(GamePadButtons.Cross))
{
    //Do something.
}

//Checks if the cross and triangle button are being pressed.
if (GamePadHelper.ButtonsAreDown(GamePadButtons.Cross, GamePadButtons.Triangle))
{
    //Do something.
}

 

 

TouchHelper

 

TouchHelper makes it easier to access the touchscreen throughout your project.  All you have to do is set the TouchHelper's data in your main class' Update() method:

 

TouchHelper.SetTouchData(Touch.GetData(0));

 

After you have done that, you can access the touchscreen from anywhere in your project:

 

//Checks if a touch is detected.
if (TouchHelper.TouchDetected())
{
   //Do something.
}

 

MotionHelper

 

MotionHelper makes it easier to access the accelerometer throughout your project.  All you have to do is set the MotionHelper's data in your main class' Update() method:

 

MotionHelper.SetMotionData(Motion.GetData(0));

 

After you have done that, you can access the accelerometer from anywhere in your project:

 

_____________________________________________________________________________---

 

You can also access each helper's data easily:

 

GamePadHelper.Data

TouchHelper.Data

MotionHelper.Data

 


Please use plain text.

Level 3

Level 3
Rogerdodger91
Posts: 235
Registered: ‎02-12-2011
Message 8 of 34 (1,434 Views)

Re: SuitePack 0.1 | The "Information" Class

Martin have you tested that on actual physical devices?
Please use plain text.
Beta Tester
AuRoN89
Posts: 658
Registered: ‎27-03-2007
Message 9 of 34 (1,346 Views)

Re: SuitePack 0.1 | The "Information" Class

[ Edited ]

i added the dll file to the reference's project, but it still doesn't recognize che commands :\

 

edit:

Fixed, i forgot to add using SuitPack... lol fail xD

Please use plain text.

Level 3

Level 3
Spykam25
Posts: 152
Registered: ‎24-02-2012
Message 10 of 34 (1,313 Views)

Re: SuitePack 0.1 | The "Information" Class

LOL! Thanks for downloading. Tell me if you have any problems, questions, or suggustions for SuitePack 0.2.

Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News