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

Pages: [1] 2 3
1
Feature requests / Primitives
« on: December 07, 2010, 07:56:08 pm »
Hm, maybe someone asked this before, but I wasn't able to find a post about it, so ... here we go:

I wonder if SFML will bring support for drawing simple stuff like lines, rectangles, ellipses, splines and paths.
The GDI+ API seems to be pretty powerful and a lot of people like it because of it's simplicity. However, it is not hardware accelerated and maybe SFML could fix this issue. Transfer the powerful GDI+ API to SFML and I would not see a better 2D library out there!

2
DotNet / Crash occur after closing window
« on: September 20, 2009, 04:21:21 pm »
Oh another bump to this...current SVN didn't solve the problem.
And the workaround doesn't do so too.... =(

So, any news to this?

3
Graphics / When Using SetFramerateLimit(60) it's actually 30-32?
« on: September 18, 2009, 01:05:06 pm »
I will do it this weekend (if not someone already did that then....=))

4
Graphics / When Using SetFramerateLimit(60) it's actually 30-32?
« on: September 18, 2009, 12:57:53 pm »
Quote from: "Laurent"

But what's the point of this code? There's nothing to make the main thread sleep, so your CPU will just be busy looping instead of being busy rendering more frames.


Well, the problem was that Windows was using 100% CPU to just draw frames. So the LetWindowsHangleEvents() thing lets windows clear the message stack....as I said, just a quick work around. The main problem is the QPC I guess.... (see above ;))

5
Graphics / When Using SetFramerateLimit(60) it's actually 30-32?
« on: September 18, 2009, 12:54:54 pm »
Oh I just checked your sources and found out you are doing some timing with QPC.... I didnt check if you get the frame time with QPC too, but if so, this might be the problem.
QPC is known to be buggy in many ways:
- If you have more then one CPU core the frequency might change depending on the core your thread is running on.
- The frequency can be dynamic if you are running this on a CPU that changes it's speed (for energy saving purposes, e.g Laptops and some low energy using desktop CPUs)
- some CPUs have dynamic clock skip feature used for thermal throttling
- If you are using it in virutalized environment, e.g. VMWare, Xen, VirtualBox etc you will get most likely not get real values.
...

Well, therefore most programmes do this:

check if the frequency from QPC is "stable" over time and if it fits to the values returned from getTickCount. If not, consider it as bugged and use getTickCount or timeGetTime().

Another way would be a nice callback timer....this one calls a function to increase a counter....:
Code: [Select]


// Some variables to put somewhere:

MMRESULT timer_id = 0;
TIMECAPS timer_caps;
unsigned int volatile GlobalInternalTimerValue = 0;

// Timer init:

if( timeGetDevCaps(&timer_caps,sizeof(TIMECAPS)) != TIMERR_NOERROR)
  return Error("Unable to retrieve timing capabilities");
if( timeBeginPeriod(timer_caps.wPeriodMin) != TIMERR_NOERROR )
  return Error("Unable to set timer resolution" );

timer_id = timeSetEvent(1,timer_caps.wPeriodMin,timer_func,0,TIME_PERIODIC);
if( timer_id == 0 )
  return Error("Unable to create timer");

// Timer callback:

void CALLBACK timer_func(unsigned int,unsigned int,DWORD,DWORD,DWORD)
{
  GlobalInternalTimerValue++;
}

// Timer release:

unsigned int hr = timeEndPeriod( timer_caps.wPeriodMin );
// make sure hr == TIMERR_NOERROR
hr = timeKillEvent( timer_id );
// make sure hr == TIMERR_NOERROR


6
Graphics / When Using SetFramerateLimit(60) it's actually 30-32?
« on: September 18, 2009, 12:34:55 pm »
All I do is looping until a specific time has passed...
I dont use the SFML functions so I guess it wont help you in any way. It's just something like:

Code: [Select]

...
while (main_game_loop) {
framestart = getMilliSecSinceMidnight();

PrepareAllSprites();
DoDisplay();

while (getMilliSecSinceMidnight()-framestart < 25) { // use at least 25 msec per Frame since I want 40 Frames Per Sec.
LetWindowsHandleEvents(); // I am using windows....
}
}
...


So it's actually just a delay added to the loop. Well the original code is way better done but still nothing really super clever. Just a little work around...
If you still want to see the original code I can post it this evening. currently I am at work so I can access it =(

7
SFML website / "Mark all as read" - button on forums
« on: September 18, 2009, 12:16:09 pm »
Ohhh yes, you are right. Thanks a lot. I totally didnt recognize it... xD

8
Graphics / When Using SetFramerateLimit(60) it's actually 30-32?
« on: September 18, 2009, 12:12:29 pm »
Yes, I got this problem too. I am using SFML 1.5 on WinXP SP3....some ATI GFX card, latest drivers.
I worked around this using my own timing functions but since other people have that problem too, maybe we can find out what the problem with it is?

9
DotNet / Rendering in a Canvas in .NET
« on: September 18, 2009, 11:58:05 am »
You can set a style to most controls:

Using VB.NET it would be done like this:

Code: [Select]
MyControl.SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint _
                                                    Or ControlStyles.Opaque, True)


Adding this line to in the constructor of your form, right there where all properties of your control get set, will cause the control to no draw anything by itself. All drawing will be done in a custom function (--> add an event handler to the .Paint event pointing to a function and add SFML.Display() there.).

Ok, a basic exmaple for your function handling MyControl.Paint() could be (pseudo code, translate it to your .net language):

Code: [Select]

function HandleMyControlPaint(Sender myctrl, PaintEventArgs args) {
    myMainSFMLObject.Display(); // Display SFML's content
    myctrl.Invalidate(); // Immediatly invalidate the control again. This will cause the control to redraw itself again asap. Since this just post a "redraw" message to the event queue you get the fastest performance you can get and other events are still processed. no need to have a sleep or something...
}


And a basic example for the form's initialisation (function InitializeComponent):

Code: [Select]

function InitializeComponent() {
    this.MyCtrl = new system.windows.forms.button(); // for example...a button
    this.MyCtrl.Text="hello";
    this.MyCtrl....blablabla.....//all initialisation will be done here. Usually this should be generated by your designer if you use one.
   
    MyCtrl.SetStyle(.....); // Add this line with the parameters above. This is where you tell the control to not draw anything by itself.
}


Ok, sorry for posting just stupid pseudo code but I guess you got the main idea. You add the setstyle to your control right after its creation and therefore you do all painting on your own and invalidate the control right after it got drawn.

Just google in case you still got trouble....there are plenty of examples out there in combination with D3D/DirectX.

10
SFML website / "Mark all as read" - button on forums
« on: September 11, 2009, 03:41:01 pm »
Hey there =)

Just a little request...or maybe suggestion w/e:

I saw a lot of forums have a button that allows you to mark all currently unread topics as read. I usually come online, and click "View posts since last visit". Then I read the posts I am interested in and they get marked as read. But since I dont read all, there are always some topics marked as unread...So, maybe you can find the option somewhere in the forums configuration and enable it.
It's for lazy people like me a pretty nice help. =)

-Fynn

11
SFML projects / Squeebs, a 2d comic mmorpg
« on: September 06, 2009, 09:24:24 pm »
the website still doesnt show any screenshts and stuff for me...
just the main site seems to be filled with content =(

12
Audio / How does Sound.Position work?
« on: June 26, 2009, 01:12:51 pm »
Ah using a mono sound fixed it. Thanks a lot =)

13
Audio / How does Sound.Position work?
« on: June 25, 2009, 06:01:50 pm »
I got an Sound.Object playing a stereo sound from a Soundbuffer.
Now I want to set the .Position property. But what scales are expected for the vector's elements? Is it something between 0..1.0? Or maybe something like 0..1000?
I tried to produce some kind of 2D-Sound: If a rocket flies by on the left side the sound should be much louder on the left side then on the right side. I made it like this:

Code: [Select]

With New Sound (daBuffer)
    .Position = New Vector3((rock_x-self_x)/app.width, (rock_y-self_y)/app.height, 0)
    .RelativeToListener = true
    .Play()
End With


So, rock_XY=Rocket, self_XY=listener. The .Position gets a new value relative to the listener and by setting .RelativeToListener that should be applied to the sound.
But sadly the volume on both speakers is the same...so no 2D-Sound =(
Am I doing wrong or isnt it supposed to support that?

PS: rock_XY and self_XY are screen coordinates, so vector3.X and .Y are between 0...1.

14
General discussions / SFML 2.0
« on: June 25, 2009, 03:17:06 pm »
Just a little remark cause I just found that:

The whole SFML2.0 graphics namespace seems to be fully compatible to SFML1.5 except that Sprite.Center is missing. I know SFML2.0 isn't released yet, so I bet it would have been implemented until then, but hust wanted to mention it anyways, so it wont be forgotten.

15
Audio / Delayed playing.
« on: June 25, 2009, 03:14:16 pm »
If i drop it one thread starts like 50msec earlier...so there is a something like a "BeeBeep" instead of a "Beep" so to say.

But it's ok, I guess it wasnt a SFML problem. I realized that the sound was delayed in a total different application I made. I double checked my code and couldnt find a problem with it, so I thought it was SFML's fault. I made the benchmark and it seems everything is fine. I think a third check on my code will reveal the bug. =)

Pages: [1] 2 3