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

Pages: [1] 2 3 ... 5
1
Graphics / Re: Only render the contents of a view
« on: June 06, 2014, 09:17:54 am »
Hmm...that seems like it should work but I'm not getting the results I was hoping for. I think it might have to do with the fact that I'm offsetting the view in order to center it, which causes the viewport to be offset from that.

2
Graphics / Only render the contents of a view
« on: June 06, 2014, 07:50:16 am »
Yeah, this is another thread about clipping. :P I searched as best as I could but I can't seem to find a solution. I'm not very good at math so I don't doubt what I'm trying to do is really simple, but it's eluded me so far.

Basically, when I resize the window, I want to resize the view so as to fit in the window with proportional scaling, letterboxing when necessary, and center it in the window. That much is done, as you can see in the code below.

What I need to do now is make it so that nothing beyond the extents of the view rect is rendered. I can't figure out how to get the appropriate values for my Viewport.

FP.Width and FP.Height are the dimensions of the screen when it is created.

public void Resize(int width, int height)
{
        _sfmlWindow.Size = new Vector2u((uint) width, (uint) height);
       
        var targetWidth = (float) width;
        var targetHeight = (float) height;
       
        var scale = Math.Min(targetWidth / (float) FP.Width, targetHeight / (float) FP.Height);
       
        var toWidth = width / scale;
        var toHeight = height / scale;
        var x = (toWidth - FP.Width) * -0.5f;
        var y = (toHeight - FP.Height) * -0.5f;
       
        var viewRect = new FloatRect(x, y, toWidth, toHeight);
        var view = new View(viewRect);
  _sfmlWindow.SetView(view);
}
 

3
Feature requests / Re: Joystick information
« on: November 19, 2013, 03:10:11 pm »
Eek, sorry. I did search the forums first but I forgot about the issue tracker.  :-[

4
Feature requests / Joystick information
« on: November 18, 2013, 11:21:51 pm »
I'm working on a game that needs to support a few different types of gamepads all with different button configurations; button 0 (A) on the Xbox controller corresponds to X on the SNES controller and it's in a completely different place. I'm sure I don't need to go into too much detail on this matter as it's pretty well known that joysticks are utter chaos.

Is there a possibility that we'll see a function to get a string name or other sort of description for a given joystick ID? It would be really nice to be able to load set up buttons based on a named configuration file à la SDL2.

5
Window / Re: Unable to process specific inputs simultaneously
« on: July 26, 2013, 11:56:08 pm »
Very interesting! It's a good thing to be able to look out for in the future.

6
Window / Re: Unable to process specific inputs simultaneously
« on: July 26, 2013, 10:52:05 pm »
Bummer. Looks like a redesign of my game's controls is in order. Thanks for the fast reply!

7
Window / Unable to process specific inputs simultaneously
« on: July 26, 2013, 10:34:49 pm »
I'm having some trouble with getting input from some specific keys, and I can't think why. Using C#, but I don't think that part matters.

This works as expected (Up arrow, Spacebar, Right arrow):
Console.WriteLine(Keyboard.IsKeyPressed(Keyboard.Key.Up));
Console.WriteLine(Keyboard.IsKeyPressed(Keyboard.Key.Space));
Console.WriteLine(Keyboard.IsKeyPressed(Keyboard.Key.Right));
Console.WriteLine("---------------");
 

The output when all three keys are held is:
True
True
True
---------------
 

However, if I change the test to use the left arrow instead of right:

Console.WriteLine(Keyboard.IsKeyPressed(Keyboard.Key.Up));
Console.WriteLine(Keyboard.IsKeyPressed(Keyboard.Key.Space));
Console.WriteLine(Keyboard.IsKeyPressed(Keyboard.Key.Left));
Console.WriteLine("---------------");
 

The output when all three keys are held is:
False
True
True
---------------
 

It's as though the spacebar isn't registered at all. Is this just a limitation of my keyboard or the way input is handled by the OS?

8
DotNet / Re: Sound recycling on .NET
« on: July 03, 2013, 05:21:32 pm »
Thanks, I didn't know about the Dispose method.

9
DotNet / Re: Sound recycling on .NET
« on: July 03, 2013, 04:07:36 pm »
I can't manually delete objects in C#, can I? To be honest I'm only using it because it's what my team agreed on; I don't have a lot of experience with it myself.

10
DotNet / Sound recycling on .NET
« on: July 03, 2013, 03:44:49 pm »
When I use SFML with C++, I delete sound objects after they finish so as to not hit the limit of 256 sounds. How might I go about this in .NET? Is there a better way that I should be managing this?

11
Graphics / Re: SFML Text Artifacts
« on: June 19, 2013, 09:53:57 pm »
I'll open the issue if nobody else is going to. I didn't want to jump on it because I'm not the one who found it in the first place.

12
Graphics / Re: SFML Text Artifacts
« on: June 18, 2013, 10:56:22 pm »
Interesting...I wonder if that's necessary any more? Ever since the new graphics API was introduced, underlining is done by adding vertices to the vertex array. That block of code dates back to 2009 (scroll all the way down).

13
Graphics / Re: SFML Text Artifacts
« on: June 18, 2013, 04:35:09 pm »
I was referring to the actual texture used as a source for the font, not the render texture.  ;)

Noticing how the pixel shows up on both 't's in your example, I'm guessing it's a matter of how the source texture is created.

14
Graphics / Re: SFML Text Artifacts
« on: June 18, 2013, 03:00:40 am »
I can confirm this. It also happens when I set the scale of a Text object.

Is there a way to set smoothing on the texture used to render the text? I have a feeling that might help things.

15
DotNet / Re: Utility functions missing from Shape?
« on: May 07, 2013, 03:57:26 pm »
Wow, there are tutorials for 2.0 now! They look awesome! I've been getting along on the documentation alone for a while now. Thanks! <3

Pages: [1] 2 3 ... 5