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 - solgar

Pages: 1 [2] 3
16
General discussions / Java
« on: December 11, 2009, 05:36:43 pm »
Quote from: "Laurent"
You should update your working copy, sf::String2D is now sf::Text ;)


I'm working on revision 1283. When I will finish implementing all functionality I will update everything to head revision. But thanks for pointing that :).

17
General discussions / Java
« on: December 10, 2009, 12:26:58 am »
Weekly changes report:
- sf::Font implemented
- sf::String2D implemented
- sf::Shader implemented
- sf::RenderWindow fully implemented
- fixed few bugs

18
General discussions / Java
« on: December 06, 2009, 03:09:31 pm »
Static method sf::Image::GetValidTextureSize is unimplemented in SFML.Net. Why? There is no Glyph class implemented in SFML.Net. Why?

Code: [Select]
View view = new RenderWindow(new VideoMode(240, 320), "calling move will cause crash :(").getDefaultView();
System.gc();
view.move(20, 20);

Consider above code. Will this work in SFML.Net? When destroying render window its view is destroyed also and Java/.Net object is invalid, because it holds pointer to non existing object. When RenderWindow is destroyed in .Net CSFML sfRenderWindow_Destroy is called and this function destroys default view. Am i right? In case above solution is to set default view field holding native pointer to 0 and checking this value in every call. What do you think about it?

19
General discussions / Java
« on: December 05, 2009, 10:49:21 pm »
Quote from: "Laurent"
Some functions are in the public interface of the C++ class, but are for internal use; thus I don't implement them in the bindings. GetTexCoords is one of them.

There is no annotation about that. It would be nice to have this annotation in documentation because i dont know which of public methods are for internal use and I implement all public functions. Can you tell me which public functions in all classes are for internal use?

20
General discussions / Java
« on: December 05, 2009, 10:07:06 pm »
Quote from: "Laurent"
const-correctness is not a concept that exists in C#, so there's no way of reproducing the C++ behaviour. If it's the same for Java, then you can't help much.

I saw a workaround for C#, but I'm not sure if it's worth it. After all, why should we emulate something that doesn't exist in the language itself?


Maybe you are right. I thought that it will be better to recreate C++ functionality than adapt functionality to Java. For the same reason i didnt liked Sprite having Image instance in Java. So what about other getters? If I'm right in SFML.Net Vectors and Colors (because they cannot be const) are copied and copy is returned. Am i right?

Other thing. C++ sf::Image have GetTexCoords() method which returns non const object and C# implementation does not have this method. Why is that?

21
General discussions / Java
« on: December 05, 2009, 08:10:38 pm »
C++ Sprite.GetImage() returns const pointer to Image. How in SFML.Net is resolved returning "const" objects? Image object returned from Sprite.getImage() in C# can be modified? I dont know how to resolve this in jSFML. In case small objects like sf::Color or sf::Vector are returned new objects with same field values as returned native const object but what to do with big ones like sf::Image or huge sound objects?

22
General discussions / Java
« on: December 05, 2009, 07:42:25 pm »
Java binding code:
Code: [Select]
Image img = new Image();
img.loadFromFile("bgr.png");
Sprite spr = new Sprite(img);
img = null;
System.gc();


In case above Java Sprite holds pointer to native Sprite which holds native pointer to non existing native Image and result of Java call (for example) window.draw(spr) is undefined. Java Sprite doesnt hold Java Image object instance, so in code above "img" after GC call will be deleted and coresponding native object also. Calling window.draw(spr) can draw just white rectangle instead of image or even crush. I dont like idea of Sprite holding Image instance in Java, but in many cases my approach to objects handling can couse troubles. How similar code would work in C# binding? I have tried to read cs files in C# binding folder, but i have never seen before any C# code and it is hard for me to understand it.

23
General discussions / Hidden SFML functionality
« on: December 03, 2009, 07:01:30 pm »
Hi. I just discovered hidden SFML functionality. I dont know what is going on but i will investigate this ;). .

24
General discussions / Java
« on: December 02, 2009, 11:19:55 pm »
Weekly changes report:
- sf::RenderWindow implemented 92%
- sf::Image implemented
- sf::Sprite implemented

25
General discussions / Java
« on: November 27, 2009, 04:15:32 pm »
Quote from: "Hiura"
Quote from: "Nexus"
Here were some people being confused because they didn't know that Circle() is a static function
As you have to write :: …

It still looks like constructor of some other type in sf::Shape namespace.  It is not really an issue but i thought that "Create" prefix won't hurt.

Quote from: "Hiura"
Quote from: "Laurent"
I don't know, it sounds more intuitive to me. It looks more like a constructor than a regular function.
I agree with you.

And because this looks like constructor it makes confusion. When I first saw this I wasn't sure whats happening. I thought that Circle is some class inheriting from Shape in sf::Shape namespace and its constructor is called. But I'm not used to C++ syntax and maybe that caused this feeling.

26
General discussions / Java
« on: November 26, 2009, 01:04:16 pm »
Quote from: "Laurent"
1. Why did you renamed Shape::Circle to Shape.CreateCircle? If it's not for a technical reason, I think you should keep the C++ API's names in order not to confuse people (don't forget that the only documentation available is the C++ one).

I think that "Create" prefix is handy. If you type "Shape.C" and press ctrl+space you will see list of all predefined shapes and I am thinking of adding few additional shapes like pentagon, hexagon and octagon.

Quote from: "Laurent"
2. I don't know how events are usually handled in Java, but if there's a "standard" way of doing it, do not hesitate to use it. For example, this is how SFML.Net handles events:
Code: [Select]
window.Closed     += new EventHandler(OnClosed);
window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
window.Resized    += new EventHandler<SizeEventArgs>(OnResized);

Same for anything else that might have a more standard syntax than in the C++ API.

I do not know C# and have no idea what this code supposed to do and where it supposed to be used. My goal is to have syntax as much similar to C++ as it can be. Only method names (except static ones) and variable names will have small first letter.

Quote from: "Laurent"
By the way, did you have any issue with the GC? In SFML.Net, the graphics objects are destroyed in the GC thread, after the main thread has ended; I had to write a workaround to make it work properly.

I don't have any issue with GC at this moment. Why this GC thread is issue? Does this really matter when those objects are destroyed? If it does please tell me why.

// edit
About documentation. I have in plans to write Javadoc for jSFML so everything will be documented.

27
General discussions / Java
« on: November 26, 2009, 01:06:59 am »
Weekly changes report:
- sf::Window is fully implemented (all events implemented)
- sf::Drawable implemented
- sf::Shape implemented
- sf::RenderWindow in progress (40%)

In next few days I will finish work on sf::RenderWindow and I will start working on sf::Image and sf::Sprite classes.

Sample code:
Code: [Select]
import SFML.System.*;
import SFML.Window.*;
import SFML.Graphics.*;

public class jSFML
{

    static
    {
        System.loadLibrary("jSFML");
    }

    public static void main(String[] args)
    {
        RenderWindow wnd = new RenderWindow(new VideoMode(800, 600), "jSFML", Style.Close|Style.Resize|Style.Titlebar, new ContextSettings());
        Shape shape = Shape.CreateCircle(new Vector2f(400, 300), 250, new Color(255,0,0), 8, new Color(0, 255, 0));
        Color background = new Color(0, 0, 0);
        while(wnd.isOpened())
        {
            Event event = new Event();
            while(wnd.getEvent(event))
            {
                if( (event.type == EventType.KeyPressed && event.key.code == KeyCode.Escape) || (event.type == EventType.Closed) )
                    wnd.close();
                else if (event.type == EventType.KeyPressed && event.key.code == KeyCode.Space)
                    System.out.println("fps: " + 1/wnd.getFrameTime());
            }
            if( wnd.getInput().isKeyDown(KeyCode.Return) )
            {
                background.r = Randomizer.randomI(0, 255);
                background.g = Randomizer.randomI(0, 255);
                background.b = Randomizer.randomI(0, 255);
            }
            wnd.clear(background);
            wnd.draw(shape);
            wnd.display();
        }
    }
}

28
Feature requests / Shape compile method
« on: November 25, 2009, 09:47:19 pm »
Quote from: "Laurent"
And can't you just do something like this, instead of rewriting everything?
Code: [Select]
xxx Rectangle(...)
{
    sf::Shape* shape = new sf::Shape(sf::Shape::Rectangle(..));
    ...
}


Of course I can. Stupid me. Thanks. :D

29
Feature requests / Shape compile method
« on: November 25, 2009, 09:24:16 pm »
Quote from: "Laurent"
Hum, does it really matter? Is it done only one time anyway, it's not like if it was compiled before every Draw().

Ok, you are right.

Quote from: "Laurent"
Sorry, I don't understand. Can you tell me more about this issue?

It is more difference than issue. Predefined shapes (like line or circle) in Java will be uncompiled - C++ predefined shapes are compiled during creation. They will be uncompiled because I have to rewrite these static methods (sf::Shape::Circle() and others) as jSFML native function because these methods return objects not created by "new" and because of that those objects cannot be deleted using "delete" - and native object is "deleted" when corresponding Java object is freed by GC. To rewrite those static methods i need to rewrite ComputeNormal() and Compile() because these are private and i cannot access them. I can rewrite ComputeNormal() but Compile() uses private myPoints which I cannot access. So i thought that it would be nice to have access to this method. But as you said compiling is not a performance killing task. Just a thought ;).

30
Feature requests / Shape compile method
« on: November 25, 2009, 12:18:56 am »
Laurent, have you ever consider Shape::Compile() method to be public instead of private? I think, that Shape Compile() method should be public rather than private. If someone create his own shape it can be compiled only at render time. I think that user should have possibility to compile shape by himself. Plus in Java binding when I create predefined shapes I have to rewrite these static methods because those return object instead of pointer and these Shapes are not compiled (I cannot rewrite compile method because this method operate on private myPoints) - so there is difference between Java and C++ Shapes. I know that this is minor issue, but what do you think about it?

Pages: 1 [2] 3