Porting our projects to Windows 8.1 Desktop/Tablet and Phone

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby megasoft78 » Tue Nov 18, 2014 1:41 pm

I finally have my libgdx game running on Windows Phone 8.1 (I tested on Nokia Lumia 5200).
I haven't test it in deep but I'll do it while implementing my next game. :)
I attached the files I changed to make it work. I'm using version 1.4.1.
I'm still having an issue because I'm packing 4 bytes (RGBA) into a single float but because I didn't find a better way I'm actually using just 6 bits for each component.
This restrict the range of available colors but in my case it's not a big issue.
Anyway if anyone know a better way to pack 4 bytes into a float without lose too much precision please give me a tip! :)

Here's what I'm using to pack and unpack RGBA:
Code: Select all
   static float PRECISION = 64.0f;
   
   public static float colorToFloat(Color color) {
       float value = 0;

       value += Math.floor(color.r * (PRECISION - 1)) * PRECISION * PRECISION * PRECISION;
       value += Math.floor(color.g * (PRECISION - 1)) * PRECISION * PRECISION;
       value += Math.floor(color.b * (PRECISION - 1)) * PRECISION;
       value += Math.floor(color.a * (PRECISION - 1));
      
       return value;
   }
   
   public static Color floatToColor(float v) {
      float value = v;
      
      Color color = new Color();
      
       color.a = (value % PRECISION) / (PRECISION - 1);
       value = (float) Math.floor(value / PRECISION);

       color.b = (value % PRECISION) / (PRECISION - 1);
       value = (float) Math.floor(value / PRECISION);

       color.g = (value % PRECISION) / (PRECISION - 1);
       value = (float) Math.floor(value / PRECISION);

       color.r = value / (PRECISION - 1);
      
       return color;
   }


In theory I should be able to pack 3 bytes into significand and the remaining one into the exponent but I don't really know how to do it.
Attachments
WP81.zip
(20.92 KiB) Downloaded 444 times
megasoft78
 
Posts: 9
Joined: Fri May 18, 2012 4:28 pm

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby alexander_m » Tue Nov 18, 2014 3:36 pm

Maybe Float.intBitsToFloat(int) can be used instead?
alexander_m
 
Posts: 38
Joined: Fri Apr 04, 2014 6:00 am

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby megasoft78 » Tue Nov 18, 2014 3:47 pm

alexander_m wrote:Maybe Float.intBitsToFloat(int) can be used instead?

Hi,
that's what libgdx already using but I don't know how to unpack from the vertex shader.
At the moment libgdx is using that method to pack it and get in the vertex shader as vec4 automatically. Unfortunatelly Windows Phone 8.1 doesn't support vec4 as attribute.
Only float can be used and I need a way to manually unpack from float to vec4.
megasoft78
 
Posts: 9
Joined: Fri May 18, 2012 4:28 pm

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby dzungpv » Sun Dec 28, 2014 8:34 am

megasoft78 wrote:Hi everyone,
I actually spent some time on irc with <@Xoppa>, <maximtwo> and <@Tomski> to try make my simple game working on Windows Phone 8.1.
Thank to <@Xoppa> I was able to run the default project on Windows Phone 8.1.
I had to change SpriteBatch and include into my project.
I tried to run my game but it's partially working.
Images are working but text not. It's strange because actually I'm using BitmapFont.
Anyway if anyone want to look at the changes I attached the modified version of SpriteBatch.
I'm using latest version of libgdx (1.4.1).

I hope we'll get to the point to make this perfectly working on Windows Phone 8.1. :)


Good news! Are you publish your app to windows store?

You mean you can port this game? https://play.google.com/store/apps/deta ... eenpuzzlex
dzungpv
 
Posts: 11
Joined: Sun Nov 30, 2014 5:02 pm

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby BlaBlaBla » Tue Jan 27, 2015 8:59 pm

Maybe can port LibGDX game to Windows Phone using Juniversal? http://www.badlogicgames.com/forum/viewtopic.php?f=17&t=18171
BlaBlaBla
 
Posts: 2
Joined: Tue Jan 27, 2015 8:14 pm

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby xeoshow » Sun Feb 01, 2015 9:06 am

Looks great! Hope there is some official integration for libgdx...
xeoshow
 
Posts: 305
Joined: Mon Mar 18, 2013 1:12 am

Re: Porting our projects to Windows 8.1 Desktop/Tablet and P

Postby prss » Sat Mar 26, 2016 6:12 pm

megasoft78 wrote:Hi everyone,
I actually spent some time on irc with <@Xoppa>, <maximtwo> and <@Tomski> to try make my simple game working on Windows Phone 8.1.
Thank to <@Xoppa> I was able to run the default project on Windows Phone 8.1.
I had to change SpriteBatch and include into my project.
I tried to run my game but it's partially working.
Images are working but text not. It's strange because actually I'm using BitmapFont.
Anyway if anyone want to look at the changes I attached the modified version of SpriteBatch.
I'm using latest version of libgdx (1.4.1).

I hope we'll get to the point to make this perfectly working on Windows Phone 8.1. :)

Hi, you can send me your html project for i use as example because my war file dont open as Windows 8.1 app.
prss
 
Posts: 2
Joined: Wed Nov 25, 2015 11:31 am

Previous

Return to Libgdx Contributions

Who is online

Users browsing this forum: No registered users and 0 guests