NOGDUS $1670.00 has been donated to NOGDUS!
September 20, 2017, 08:30:34 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Question about Pixie  (Read 4693 times)
0 Members and 1 Guest are viewing this topic.
Cycl0ne
Guest
« on: November 19, 2010, 06:09:13 PM »

Hi,

I have a small Question and due to teh missing "contact me" on the pixie page, i just got involved into this forum. I had been looking for a neat smart 2d framework that would be easily to port. Then I found Pixie and im absolute dasseled.
Ok now to my question. Do you mind if i use your pixie engine to port it to android mobile devices? I thought about a two pass conversion:
1st pass: just a simple ndk (native development kit) conversion with an jni interface to the actual dalvik java engine

2nd pass (and a lot of more work here): a complete integration into the dalvik with a mixed code project (java class framework with a native c++ part, as google does it with their complete api)

I wanted to write a game on the android system, but what im desperately missing are easy function for picture manipulation, and so on. (as a example, i tried to dim a tile with the size of 100x30 pixel in java, but due to the strict array handling in java, it took 200ms on the android device. thus lowering the fps of my game to 10fps.)

Another benefit (at least for phase 1) i could simply code and test my game on windows native to be later in the possible chance to just compile it on the arm cpu.

just some thoughts. So, do you mind if i port it to android? Oh, and how far is you port with linux? ;-) Perhaps we could share some code, due to the fact that android is a linux based system.
Logged
Richard Marks
Administrator
Offline Offline

Respect: 3425
« Reply #1 on: November 19, 2010, 08:25:13 PM »

I PMd Mattias (the creator of Pixie) so he can answer you.

As far as I know, there shouldn't be any issues (but its not up to me) with you porting Pixie to Android.

Wait for Mattias to respond, and Welcome to NOGDUS. Smiley
Logged

Mattias Gustavsson
Moderator
Offline Offline

Respect: 58
« Reply #2 on: November 20, 2010, 06:03:55 AM »

Hi CyclOne, and welcome!

I'm glad you like my Pixie engine - and it is all public domain, so you may use it however you like - so yes, you can indeed port it to android (or any other platform for that matter) :-)

I've barely started looking at the linux port, and that work is on hold indefinitely, so I'm afraid I can't help with providing a starting point. However, I'll be happy to answer and questions you might have about how things work. I would think that the easiest way to get started with porting, is to first port the PixieLite library, which is just the hardware/platform dependent bits, and once that's working, bring in the rest of Pixie to sit on top of it.

And hey, good luck :-)

/Mattias
Logged
Cycl0ne
Guest
« Reply #3 on: November 20, 2010, 10:56:07 AM »

Hi,

I read it thats its public domain. but i wanted to be polite and ask. I am going to start with the following files to feed them with meat before processing to the library:
Platform_NULL.cpp
Platform_NULL_FileSystem.cpp
Platform_NULL_FileSystem.h
Platform_NULL_FileSystem_Directory.cpp
Platform_NULL_FileSystem_Directory.h
Platform_NULL_FileSystem_File.cpp
Platform_NULL_FileSystem_File.h
Platform_NULL_Input.cpp
Platform_NULL_Input.h
Platform_NULL_Input_KeyboardDevice.cpp
Platform_NULL_Input_KeyboardDevice.h
Platform_NULL_Input_MouseDevice.cpp
Platform_NULL_Input_MouseDevice.h
Platform_NULL_OS.cpp
Platform_NULL_OS.h
Platform_NULL_Screen.cpp
Platform_NULL_Screen.h
Platform_NULL_Time.cpp
Platform_NULL_Time.h

exluded is the sound files because android wont let you get to the sound from ndk (at the moment not).
Logged
Richard Marks
Administrator
Offline Offline

Respect: 3425
« Reply #4 on: November 21, 2010, 02:33:18 AM »

..to feed them with meat..

LOL. Nicely put. Grin
Logged

Cycl0ne
Guest
« Reply #5 on: November 23, 2010, 11:53:51 AM »

Some update:
Code:
//*** Platform_Android_Time ***
#include "Platform_Android_Time.h"
//*** Constructor ***

Platform_Android_Time::Platform_Android_Time()
{
// Initialise Time
    struct timeval tv;
    gettimeofday(&tv, NULL);
    initTime_ = (float) tv.tv_sec*1000. + tv.tv_usec/1000.;
}

//*** GetTime ***

float Platform_Android_Time::GetTime()
{
    struct timeval tv;
    gettimeofday(&tv, NULL);
float curTime = (float) tv.tv_sec*1000. + tv.tv_usec/1000.;
deltaTime_ = curTime - initTime_;
return deltaTime_;
}

//*** GetSystemTime ***

Platform_Time::SystemTime Platform_Android_Time::GetSystemTime(bool utcTime)
{
SystemTime result;
result.day=0;
result.dayOfWeek=0;
result.hour=0;
result.minute=0;
result.month=0;
result.second=0;
result.year=0;
return result;
}

Code:
//*** Platform_Android_FileSystem_File.cpp ***

#include "Platform_Android_FileSystem_File.h"

//*** Constructor ***

Platform_Android_FileSystem_File::Platform_Android_FileSystem_File(const char* path)
{
if (!path)
{
Platform::GetPlatform_OS()->OutputDebugText("No path specified!\n");
}

if (path)
{
path_=strdup(path);
}
}

Platform_Android_FileSystem_File::~Platform_Android_FileSystem_File()
{
if (path_)
{
free(path_);
}

if (fileHandle_!=NULL)
{
fclose(fileHandle_);
}
}

//*** GetPath ***

const char* Platform_Android_FileSystem_File::GetPath()
{
return path_;
}


//*** Exists ***

bool Platform_Android_FileSystem_File::Exists()
{
if (!path_) return false;
if (FILE *file = fopen(path_, "r"))
{
fclose(file);
return true;
}
return false;
}


//*** Create ***

bool Platform_Android_FileSystem_File::Create()
{
if (fileHandle_!=NULL)
{
Platform::GetPlatform_OS()->OutputDebugText("File already open\n");
return false;
}
fileHandle_ = fopen(path_, "w+b");
return (fileHandle_!=NULL);
}


//*** Open ***

bool Platform_Android_FileSystem_File::Open()
{
if (fileHandle_!=NULL)
{
Platform::GetPlatform_OS()->OutputDebugText("File already open\n");
return false;
}
fileHandle_ = fopen(path_, "r+b");
return (fileHandle_!=NULL);
}


//*** Close ***

bool Platform_Android_FileSystem_File::Close()
{
if (fileHandle_==NULL)
{
Platform::GetPlatform_OS()->OutputDebugText("File not open\n");
return false;
}
fclose(fileHandle_);
fileHandle=NULL;
return true;
}


//*** Delete ***

void Platform_Android_FileSystem_File::Delete()
{
if (path_)
{
remove(path_);
}
}


//*** GetPosition ***

int Platform_Android_FileSystem_File::GetPosition()
{
if (fileHandle_==NULL)
{
Platform::GetPlatform_OS()->OutputDebugText("File not open\n");
return 0;
}
return ftell(fileHandle_);
}


//*** SetPosition ***

int Platform_Android_FileSystem_File::SetPosition(int position,SetPositionOrigin origin)
{
if (fileHandle_==NULL)
{
Platform::GetPlatform_OS()->OutputDebugText("File not open\n");
return 0;
}
return fseek(fileHandle_, position, origin);
}


//** Write methods */

#define WRITEMACRO() \
if (fileHandle_==NULL) \
{ \
Platform::GetPlatform_OS()->OutputDebugText("Tried to write to file that is not open for writing\n"); \
return 0; \
} \
\
unsigned long numberOfBytesWritten=0; /* Stores the number of bytes read */ \
/* Writes the data to the file */ \
numberOfBytesWritten = fwrite(value, sizeof(*value), count, fileHandle_); \
if (numberOfBytesWritten < count) \
{ \
Platform::GetPlatform_OS()->OutputDebugText("Write operation failed\n"); \
return 0; \
} \
\
/* Return number of elements written, rather than the number of bytes */ \
return numberOfBytesWritten; ///sizeof(*value); \

int Platform_Android_FileSystem_File::Write(const char* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const short* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const int* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const long* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const unsigned char* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const unsigned short* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const unsigned int* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const unsigned long* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const float* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const double* value, int count)
{
WRITEMACRO();
}

int Platform_Android_FileSystem_File::Write(const bool* value, int count)
{
WRITEMACRO();
}


//** Read methods */
#define READMACRO() \
if (fileHandle_==NULL) \
{ \
Platform::GetPlatform_OS()->OutputDebugText("Tried to read from file that is not open for reading\n"); \
return 0; \
} \
\
unsigned long numberOfBytesRead=0; /* Stores the number of bytes read */ \
/* Reads the data from the file */ \
numberOfBytesRead = fread(value, sizeof(*value), count, fileHandle_); \
if (numberOfBytesRead < count) \
{ \
Platform::GetPlatform_OS()->OutputDebugText("Read operation failed\n"); \
return 0; \
} \
\
/* Return number of elements read, rather than the number of bytes */ \
return numberOfBytesRead;


int Platform_Android_FileSystem_File::Read(char* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(short* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(int* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(long* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(unsigned char* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(unsigned short* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(unsigned int* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(unsigned long* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(float* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(double* value, int count)
{
READMACRO();
}

int Platform_Android_FileSystem_File::Read(bool* value, int count)
{
READMACRO();
}


should both work in normal linux convertions too.
Logged
Mattias Gustavsson
Moderator
Offline Offline

Respect: 58
« Reply #6 on: November 23, 2010, 04:01:00 PM »

very cool! that's great progress!  Grin
Logged
Cycl0ne
Guest
« Reply #7 on: April 08, 2011, 04:04:40 AM »

Hi,

just to update :-) Still alive. Im waiting for an android upgrade to 2.3 with native c-api for pixie to run. Otherweise under 2.2 i came into alot of problems with java native interface and c. Hopefully my new Android 2.3 Device will be available in 2-3 weeks.

At the moment im looking into pixie a bit further and try to understand everything. Too bad Mattias has left support, or are you still doing something with it? Ive seen some comments where it says: still has to be done ;-)

I got my hands on a VisualStudio 10 Professional. What I read in the installation guide, that VS10 is not supported. Anyone knows whats not supported? Where it hangs? Havent installed the version. Perhaps in the weekend i got some time (after doing some homework for my wife) to check to compile it.
Logged
Mattias Gustavsson
Moderator
Offline Offline

Respect: 58
« Reply #8 on: April 12, 2011, 12:55:19 PM »

That's good to hear - and thanks for the update Cheesy

And no, I have by no means stopped supporting Pixie - I've had a period of being busy with other things, but are really getting back into things now, and I have plans to make an updated version of Pixie sometime in the future (though it will be some time before I do).

Are you saying you have a problem using Pixie with Visual Studio 10? I'm not sure why that would be...
Logged
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
.: Theme by Richard Marks :.
Valid XHTML 1.0! Valid CSS!