Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - seoushi

Pages: [1]
1
General discussions / iPhone Port (in progress)
« on: August 25, 2011, 10:58:53 pm »
I haven't touched this in a really long time but for those that are interested (seems there is at least one) the tar ball is here http://seoushigames.com/dev/SFML-iPhone.tar.bz2

2
General discussions / iPhone Port (in progress)
« on: April 15, 2009, 10:25:53 pm »
sdl redefines main and has the event issues I describe. Threading might be an option however I'm not sure if apple allows it and it would be a pain to do.

3
General discussions / iPhone Port (in progress)
« on: April 15, 2009, 09:48:31 pm »
I think you guys are missing the point. Yes I can redefine main and have the user take over after the window is initialized however by doing that you end up taking over the main loop and that causes apple's event callbacks not to work properly.

4
General discussions / iPhone Port (in progress)
« on: April 15, 2009, 10:22:57 am »
I have looked into SDL 1.3 and it does the redefining main hack and also has issues with Events not being triggered. In other words they have the same issue.

5
General discussions / iPhone Port (in progress)
« on: April 15, 2009, 10:16:01 am »
Thats basically what my current code (earlier in this thread) does, the windowing code externs onSetup() and onUpdate() and you have to implement those functions, they basically become your int main.

I really don't think this will fly with SFML, the iPhone makes me angry enough that it takes over the main loop and thus control from my program. Having SFML do this would likely make some other of the developers angry as well. The only way I see it working is if this way of doing it is mandatory for portability but not mandatory in general.

Edit: I thought of another idea. Have the window be able to register callback functions, I somewhat hinted at this in my previous post.

Code: [Select]

sfml::Window win;
win.addXXXFunc(&someFunc);


A more object oriented approach to this would to have a listener class.

[code]
class WindowUpdateListener
{
public:

   WindowUpdateListener();
    virtual ~WindowUpdateListener();
    virtual void onUpdate() = 0;
};


sfml::Window win;
win.addListener(new MyDerivedListenerClass);

6
General / High memory usage of SFML applications
« on: April 15, 2009, 10:07:56 am »
How are you getting the memory usage of the application? Linux and even Mac OS X for that matter don't always tell you the truth when it come to how much a program is actually using in memory. I've found that most of the time Linux will allocate a lot more memory than is needed for a program so the program can access more memory faster when needed.

7
General discussions / iPhone Port (in progress)
« on: April 15, 2009, 09:56:36 am »
I've gotten a few emails about this port and it appears the thread is still active so I'll give an update.

As of right now I'm not working on the port. The differences between the way SFML currently is and how the iPhone works made me not want to develop it further. This does not mean that I won't work on it in the future it just means things need to be sorted out before I want to go any further.

The accelerometer and touch events have been mostly dealt with since it is now unofficially planed to support them sometime.
Having a window class isn't that big of a deal even though the iPhone only supports one window at a time. I would rather keep the same name and keep it cross-platform.

The biggest issue I have is that the iPhone likes to take over the main loop. If you block the iPhone's main loop events don't get triggered like touches and the accelerometer. The only good way to deal with this issue is have SFML define a "main" function that the user must implement for setting up the application, then you would have to register a callback function for updating the application. Another alternative would be to have the main function threaded however I see this causing all sorts of problems. Until we figure out how to deal with this issue I won't be developing this port.

In my mind SFML is meant for cross-platform development, code once and compile everywhere and it should just work. If an iPhone port comes into existence this would not be true, since the iPhone uses different means of input there would be a good sized chunk of code that needs to be rewritten in order to make a port of an application. I think that there are some things that port over quite well like system, audio, networking and the graphics packages but the windowing package just doesn't make that much sense to me because your code is going to be different no matter what you do. I feel that it's only reasonable to make some sort of analog to the window package and just keep the same sort of features between the packages.


The biggest reason for me not actively trying to look for a good solution is because I've already written a good engine for the iPhone that fits the hardware better.

8
General discussions / SFML 2.0
« on: April 15, 2009, 09:36:38 am »
About the gui discussion, it would fairly simple to port over guichan as it already has an opengl port but it will need a SFML for the event processing.

The framework for like the accelerometer and touches are somewhat done already on the iPhone code I've posted in the other thread so it shouldn't be too hard to clean it up and add it.

9
General discussions / iPhone Port (in progress)
« on: January 22, 2009, 11:10:36 pm »
The touch canceled event is when the iPhone for whatever reason decides to stop the touch event, I could combine touch ended and touch canceled as they are almost the same thing.

The accelerometer is sorta like a gyro, it tells how much the phone has accelerated in the certain direction when moved.

As for the framebuffer, that is the only way to get an opengl context on the iPhone. Basically you create a framebuffer and then do all the opengl es commands you want then render the opengl to a framebuffer and tell the UIView that a new framebuffer is up to render.


Also, I've looked more into the touch events and it turns out even SDL 1.3 has this issue because if you interrupt the main application loop bad things happen. I have a solution where basically in the int Main you register an Update callback function and the main loop from the main application calls it however it is a bit different from how a normal SFML application runs.

The iPhone uses OpenGL ES-CM 1.1, so the graphics package shouldn't be too bad to port over.

If you have a few moments, I'll like to talk over IM or IRC about some of these changes (Im PM'ed you my contact information).



edit:
I've uploaded a newer version which fixes the Touch Inputs however users are no longer in control of the main loop, unfortunately this is the only fix.

I've been thinking and since the iPhone device is so different from the computer I think that I shouldn't even use SFML-Window but rather make a new package called SFML-iPhone which would represent the iPhone better. Over half of the functions that are currently in SFML-Window don't even apply to the iPhone.

While I'm thinking about SFML-iPhone and if it really should be seperate I started working on SFML-Graphics. PostFX will not be able to be used (no shaders as far as I know) and font rendering will be a bit different since freetype is not accessible for the iPhone unless I was to include it statically (don't think the license allows this however). GLEW isn't usable on the iPhone (i tried). The rest of it should port over fine however. I already have it compiling however a lot of it is commented out so it won't work.

Anyways the link is in the same place. Hopefully I can make some design decisions by the end of the weekend and have a beta release.

10
General discussions / iPhone Port (in progress)
« on: January 22, 2009, 09:50:52 pm »
I went ahead and added some event types (Accelerometer and Touched) and wrote the implementation behind them. Here is some example code of it working.

Code: [Select]
/*
 *  test.cpp
 *  SFML-iPhone
 *
 *  Created by Sean Chapel on 1/20/09.
 *
 */



#include <SFML/Window.hpp>
#include <SFML/Window/UIKit/UserMain.h>



int main(int argc, char** argv)
{

    sf::Window App(sf::VideoMode(320,480,32), "title");
    sf::Clock Clock;



const GLfloat squareVertices[] =
{
-0.5f, -0.5f,
0.5f,  -0.5f,
-0.5f,  0.5f,
0.5f,   0.5f,
};

const GLubyte squareColors[] =
{
255, 255,   0, 255,
0,   255, 255, 255,
0,     0,   0,   0,
255,   0, 255, 255,
};


    while (App.IsOpened())
    {
App.SetActive(true);

        sf::Event Event;
while (App.GetEvent(Event))
{
if(Event.Type == sf::Event::Accelerometer)
{
printf("%f,%f,%f \n", Event.Acceleration.X, Event.Acceleration.Y, Event.Acceleration.Z);
}
else if(Event.Type == sf::Event::Touched)
{
switch (Event.Touch.Type)
{
case sf::Event::TouchEvent::Began:
printf("Started touch %d at %f,%f \n", Event.Touch.TouchId, Event.Touch.X, Event.Touch.Y);
break;
case sf::Event::TouchEvent::Ended:
printf("Ended touch %d at %f,%f \n", Event.Touch.TouchId, Event.Touch.X, Event.Touch.Y);
break;
case sf::Event::TouchEvent::Canceled:
printf("Canceled touch %d at %f,%f \n", Event.Touch.TouchId, Event.Touch.X, Event.Touch.Y);
break;
case sf::Event::TouchEvent::Moved:
printf("Moved touch %d at %f,%f \n", Event.Touch.TouchId, Event.Touch.X, Event.Touch.Y);
break;
default:
break;
}
}
}


glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);

glRotatef(3.0f, 0.0f, 0.0f, 1.0f);

glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

App.Display();
}

    return 0;
}



Files I've had to change are as follows :
Window/Input.h
Window/Input.cpp
Window/Event.hpp


I've added the following files under Window/UIKit :
EAGLView.h
EAGLView.mm
UIKitAppDelegate.h
UIKitAppDelegate.mm
VideoModeSupport.cpp
VideoModeSupport.hpp
WindowImplUIKit.mm
WindowImplUIKit.hpp
UserMain.h

As promised I am releasing the source code/project since the SFML-Window is mostly working. http://seoushi.com/dev/SFML-iPhone.tar.bz2

The archive contains a project to build a static lib and a simple test program.

The only bug I know of at the moment is touch move events sometimes don't seem to spawn until a touch is released, I'm unsure what is causing this perhaps it doesn't like the way I'm polling for events. I might have to make the poll events threaded.


Anyways I'm going to see if I can't fix that bug then start on the graphics package port.

@Laurent - if you could comment on my code that would be great. Basically I just want to know if I did something odd in my port that doesn't fit in well with SFML.

11
General discussions / iPhone Port (in progress)
« on: January 21, 2009, 11:43:51 pm »
As I've hinted in another thread I've been working on getting SFML on the iPhone but I need some feedback on design decisions due to the nature of the device.

So far the following has been ported over complete but largely untested
SFML-System
SFML-Audio (minus libsnd)
SFML-Network

I'm currently working on SFML-Window and it is partially working. You can create a window, draw with OpenGLES and swap the buffers, here is the sample code that works.

Code: [Select]
/*
 *  test.cpp
 *  SFML-iPhone
 *
 *  Created by Sean Chapel on 1/20/09.
 *
 */



#include <SFML/Window.hpp>
#include <SFML/Window/UIKit/UserMain.h>



int main(int argc, char** argv)
{

    sf::Window App(sf::VideoMode(320,480,32), "title");
    sf::Clock Clock;



const GLfloat squareVertices[] =
{
-0.5f, -0.5f,
0.5f,  -0.5f,
-0.5f,  0.5f,
0.5f,   0.5f,
};

const GLubyte squareColors[] =
{
255, 255,   0, 255,
0,   255, 255, 255,
0,     0,   0,   0,
255,   0, 255, 255,
};


    while (App.IsOpened())
    {
App.SetActive(true);

        sf::Event Event;
while (App.GetEvent(Event))
{
}

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);

glRotatef(3.0f, 0.0f, 0.0f, 1.0f);

glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

App.Display();
}

    return 0;
}


The only real difference is that I needed to include "SFML/Window/UIKit/UserMain.h". The reason for this is that inorder to run a UIWindow application it requires that the UIWindow handles the main loop, thus taking over control. I really hate that it does this so I used a hack like what SDL does and it redefines main to UserMain and when the UIWindow starts it calls UserMain, it works but it's not ideal.


So the next thing I want to get done is input. Touching the screen acts like a mouse, you have a press/release/drag and it has x,y coordinates however you can have multiple touches at once and SFML doesn't look like it support multiple mice. A solution would to use a joystick however it seems a bit odd.

The other thing the iPhone has is the accelerometer, which can act like a joysticks analog stick movement but it has no buttons.

Given the touch input and the  accelerometer, where do you think these two things fit the best? I would like to avoid creating new devices for portability reasons (not everyone has a mac to develop with and developing iPhone games on linux and window seems appealing to my company).

Right now my idea is to make joystick 1 the accelerometer and joysticks 2-? the multi-touch inputs. I'm not sure how many touches you can do at once tho, I initially thought it was only two but I've heard some people talk about handling more.

The last thing is that the iPhone doesn't have a keyboard in the normal sense. It has the onscreen one and it does work properly over OpenGLES however it doesn't mesh well with games. I don't plan to support the built-in keyboard, it's easy enough to make your own and there is a lot of other work to be done however if enough people want it I will consider it.


I will be releasing this code and hopefully it can be included in SFML someday but until I get the SFML-Window lib ported over properly I don't see a reason to release the code.


Any thoughts and suggestions would be great.

12
General discussions / C# and SFML for OS X (and iPhone)
« on: January 20, 2009, 08:48:45 pm »
C# doesn't run in the normal sense on the iPhone but it does work. Since you can't have a vm on the iPhone it won't pass for submission but it will work technically. If you use ahead of time compiling you can create binaries for the iPhone that will pass apple submission however AOT isn't quite up to par with the normal release (no generics among other things).

I know unity 3d uses mono with AOT for mixing C# and native code on the iPhone however I'm not sure of the difficulty of this process.

13
General discussions / C# and SFML for OS X (and iPhone)
« on: January 20, 2009, 01:28:41 am »
I was just going to ask about the iPhone myself. Has anyone started a port for it?

Here what I've done myself:

-I successfully compiled the SFML-System lib without any modifications.
-I got SFML-Audio working by removing references to libsnd (LGPL means no static linking and you can't dynamically link custom libs in iPhone Apps) so only ogg works which is perfectly fine for me.
-I'm hoping to port over SFML-Window soon, it uses UIKit instead of Cocoa but both are similar.
-SFML-Network should port over without any changes but I haven't tried it yet.
-SFML-Graphics might take a bit to port over depending on what the mac version used (I haven't looked yet).


The biggest issue is riding of all LGPL/GPL code (and other restrictive licenses) for the iPhone since you can not switch out libs in iPhone applications or dynamically link.

If/when I port over SFML-Window I'll release the changes and xCode project.

Also to set the record straight the iPhone uses C/Obj-C and C++, it can not do Java.

14
Graphics / odd fonts issue, not being positioned right.
« on: July 20, 2008, 07:58:40 pm »
Ok, SetCenter makes a little more sense now but I just assumed that it would center the text (or other drawable) arround the point given.

I just made a simplier test case and it seems to work fine, now I'm curious why my regular code doesn't work as I checked the varible memory before I drew it there and in my test case and it is the same.

I would post the orignal code but it's quite big for just showing off that drawing text doesn't work right in that case. I'll have to narrow it down and see if I can find something I'm doing wrong before I post it.

Thanks for the help.

15
Graphics / odd fonts issue, not being positioned right.
« on: July 20, 2008, 06:26:42 am »
I just started using the library and it's quite nice, much better alternative than sdl :).

Anyways the issue I'm having is that my text is not being drawn in the right position, it's down right odd imho.

if I use SetPosition(0.0f, 0.0f) it shows in the upper left corner (thats fine)
if I use SetPosition(1.0f, 1.0f) nothing shows (or any other number it seems)

if I use SetCenter(0.0f, 0,0f) it shows at the top left corner just like SetPosition, it doesn't center like you would think

if I use SetCenter with positive numbers it moves it backwards and with negitive numbers it moves it forwards (backwards of what sprites do and what you would expect)


So in other words SetPosition() just seemed wrong in general as it only works on the origin and SetCentered() moves backwards of what you would expect and doesn't actually center it (just uses the top left of that position).

Also Move() seems to have no effect.

Sprites seem to work fine so I figure this is a font specific issue.



Just some general information:

I am  including all of smfl in my project (no libs)
Compiler: gcc 4.3.1
OS: Debian (Sid)
Arch: x86_64
SMFL version: 1.3 (latest stable on site, not svn)


So is this just me having a werid issue or am I using fonts/text wrong?
Also is there an irc channel?

Pages: [1]