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

Pages: [1]
1
General discussions / Re: A new logo for SFML
« on: April 26, 2013, 12:32:51 pm »

This one was perfect!

I love it.

I think it would be even better if the pentagon was on top of the text:

 {}
SFML

2
General discussions / Re: Distributing a game on Linux
« on: August 13, 2012, 01:13:34 pm »
Most distributions only provides packages for stable releases, so SFML 2.0 RC won't be in the repos. But!

Linux uses the ELF format for executables, and this particular format supports the embedding of shared object search paths. These paths can be relative or absolute.
The linker can take any number of this paths separately using the -R% parameter, where the % is the path. But if you use g++ as the linker / final step, then it's a little different as you have to tell g++ that you have a linker specific parameter. You do this using the -Wl,$ parameter where the $ are linker parameters separated by comas.
This way you can distribute your game alongside the needed dynamic libs just like in Windows.

Here is an example:

g++ -Wl,-R. -o mygame main.cpp

This will make mygame search for libs in the same directory where it is placed. You can check this with the ldd command.

3
General discussions / Does SFML work with modern OpenGL?
« on: February 03, 2012, 06:45:26 pm »
A flag to create forward compatible context would be very good in SFML 2.0. Even if the graphics module don't support it. SFML already gives window and context creation, basic and very easy audio playback, and cross platform input. Allowing to chose core profile would greatly increase the current usefulness of SFML even if the graphics module is disabled.
Changing the source code, and recompiling it is not a good solution for the developers, especialy on systems where SFML will be (in the future) downloaded by a package manager already compiled.

I propose a solution for context setting modification:
Code: [Select]

enum ContextProfile
{
  CompatibilityProfile, //Default.
  ForwardCompatibleProfile,
};

Using it would require setting it in the ContextSettings instance.
Code: [Select]

ContextSettings cs(0, 0, 0, 3, 2, ForwardCompatibleProfile);

4
General discussions / Switched times to Uint32 milliseconds in SFML 2
« on: December 19, 2011, 05:40:58 pm »
Well micro is still a thousand times better then milis! :D

5
General discussions / Switched times to Uint32 milliseconds in SFML 2
« on: December 18, 2011, 06:03:22 pm »
Quickly wrote a test in java to see how good is the time precision using nanoseconds:
Code: [Select]

final int C = 10;
long[] res = new long[C];
int i = 0;
long tp = System.nanoTime();
while (i < C)
{
    long tn = System.nanoTime();
    if (tn != tp)
    {
        long d = tn - tp;
        tp = tn;
        res[i] = tn;
        i++;
    }
}

for (i = 0; i < C; i++)
    System.out.println(Integer.toString(i) + " = " + res[i]);


This is the result:
Code: [Select]

0 = 181327039326786
1 = 181327039328598
2 = 181327039329503
3 = 181327039330409
4 = 181327039331315
5 = 181327039332221
6 = 181327039332674
7 = 181327039333580
8 = 181327039334485
9 = 181327039335391


It seems that my ordinary laptop can produce far better (although not true nanotime) precision than milliseconds. It is hard to say no to this (personally).

6
General discussions / Switched times to Uint32 milliseconds in SFML 2
« on: December 18, 2011, 05:44:56 pm »
Quote from: "Laurent"

- provide double seconds, but then some people will complain about the lack of exact timestamps, as well as the need to cast to float every calculation involving time (everything gets promoted to double when one of the operands is a double, but SFML uses float everywhere else)

Casting a floating point type to an another one works by loading the data into one of the FPU registers then unloading it into the target type, this takes a little time yes. But if you do calculations they are loaded in those registers anyway and they are stored in the internal format of the FPU (As I know in Intel processor these registers use 80 bit extended precision) so the most drawback of doubles comes from the double memory usage.

I would personally use unsigned 64 bit integer with nanoseconds so SFML can use the best available timer on the platform. It can be simply converted to milliseconds or the desired floating point value if the programmer want something else.

A TimeSpan class could be made that internally use nanoseconds and provides methods to retrieve it in various other formats. The programmer doesn't even need to carry this class around, they just extract the needed value and propagate that in they code.
Code: [Select]

TimeSpan ts = foo.EllapsedTime();
double deltaTime = ts.AsDoubleSecunds();
update(deltaTime);
render(deltaTime);

7
DotNet / SFML.Net with Mono
« on: May 28, 2011, 10:32:31 am »
- Native windows DLLs dont work with mono under linux.
- Linux by default does not search libs next to the executable. (There is an environment variable for that to tell it where to find them.)
- ...
- Recompile may necessary, but linux still needs to find those libs.

I suggest recompiling of SFML.Net with mono compilers. Put the needed libs (C and maybe C++ .so files) next to the exe and set the library search path (envirement variable, see bellow the link.) to contain the directory of the libs. And for release and distribution of you application, you will need to make a script that does this automatically for the user.

http://www.eyrie.org/~eagle/notes/rpath.html

8
DotNet / Setting window icon and heap corruption.
« on: December 03, 2010, 01:09:49 am »
Interesting! Nothing bad happens if this line does not run:
Code: [Select]

using (Bitmap icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location).ToBitmap())

I replaced that line with this:
Code: [Select]

using (Bitmap icon = new Bitmap(32, 32))

Looks like ExtractAssociatedIcon has some problems.

9
DotNet / Setting window icon and heap corruption.
« on: December 03, 2010, 12:49:38 am »
I'm trying to set the icon of my window to match the one that is visible in file explorer. And doing it was a success, but when I closed the window (and after it disappears) i got an error window that my application is stopped working (I was debugging it). Here is my code:
Code: [Select]

using (Bitmap icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location).ToBitmap())
{
    unsafe
    {
        BitmapData data = icon.LockBits(new Rectangle(0, 0, icon.Width, icon.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
        byte* ptr = (byte*)data.Scan0;
        int size = data.Width * data.Height * 4;
        byte[] pixels = new byte[size];
        for (int i = 0; i < size; i++)
        {
            pixels[i] = ptr[i];
        }
        //Swap chanels.
        for (int i = 0; i < size / 4; i++)
        {
            byte t = pixels[i * 4 + 0];
            pixels[i * 4 + 0] = pixels[i * 4 + 2];
            pixels[i * 4 + 2] = t;
        }
        SetIcon((uint)icon.Width, (uint)icon.Height, pixels);
        icon.UnlockBits(data);
    }
}

If I comment out that whole code block, everything is fine. It happens even if the SetIcon line is commented out.

Here is the error report in that window:
Code: [Select]

Problem signature:
  Problem Event Name: APPCRASH
  Application Name: AppName.vshost.exe
  Application Version: 10.0.30319.1
  Application Timestamp: 4ba2084b
  Fault Module Name: StackHash_d340
  Fault Module Version: 6.1.7600.16385
  Fault Module Timestamp: 4a5bdb3b
  Exception Code: c0000374
  Exception Offset: 000cdcbb
  OS Version: 6.1.7600.2.0.0.256.1
  Locale ID: 1038
  Additional Information 1: d340
  Additional Information 2: d340cfbcf5d2a1596ea02401d3971e0b
  Additional Information 3: f1b1
  Additional Information 4: f1b10f8b730cb6e83e0c8b6ce5c965b2


I would be happy even if the only thing you can help me is show a way to load it from a png file using C#. To do so I misses a method that is available in C++ if I remember well.

10
Graphics / Multi-texturing
« on: October 13, 2010, 04:20:05 pm »
I'm not so good with OpenGL stuff so I googled it, then used the forums search, but I did not found any multi-texturing regarding SFML.

What I want to achieve: Render the scene into a RenderImage, then render the light map (dynamic, as light could move, and light-cones even rotate) into an other render image. Then using a shader that combines the two and draws it to the render window.

What I'm asking: How should i set up the second texture so the fragment shader can use it. I know this solution has problems with old hardware, but is there anything else I should pay attention when implementing it? Especially regarding SFML.

Thank you for helping me out.

Pages: [1]