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.


Topics - phear-

Pages: [1]
1
Window / Dual Monitor
« on: September 22, 2009, 04:20:46 am »
Does SFML support dual monitor displays? I'm not sure as to how I would create a sf::renderwindow for a dual monitor setup. Any helps/links/tips would be great, thank you :)

2
Graphics / Game question
« on: September 06, 2009, 04:53:51 pm »
How do people handle backgrounds in games? I'm making an RTS and I need to work on getting the map into the game. Is it possible to make a sprite like 3000x3000 and have the image (thats 300x300) be repeated like tiles inside of it? Right now im doing everything manually and I can't figure out how else i'm going to do it...

Code: [Select]

/////////////////////////////////////////////////
/// Place sprite positions (background)
Background[0].SetPosition(0.f, 0.f);
Background[1].SetPosition(300.f, 0.f);
Background[2].SetPosition(600.f, 0.f);
Background[3].SetPosition(900.f, 0.f);
Background[4].SetPosition(0.f, 300.f);
Background[5].SetPosition(0.f, 600.f);
Background[6].SetPosition(0.f, 900.f);
Background[7].SetPosition(300.f, 300.f);
Background[8].SetPosition(600.f, 600.f);
Background[9].SetPosition(900.f, 900.f);
Background[10].SetPosition(600.f, 300.f);
Background[11].SetPosition(900.f, 300.f);
Background[12].SetPosition(900.f, 600.f);
Background[13].SetPosition(300.f, 600.f);
Background[14].SetPosition(300.f, 900.f);
Background[15].SetPosition(600.f, 900.f);
/////////////////////////////////////////////////


Any helps/tips/suggestions would be great :)

3
Graphics / Moving sprites problem
« on: August 31, 2009, 03:03:04 am »
Alright so I finally got my unit movement algorithm right and my units move and stop perfectly. Now my problem lies in the fact that when my units move horizontally they move a LOT faster than in any other direction.
Partial source is here:
http://blog.gtproductions.org/unitmovement.txt

Any ideas?

4
General / Tutorial question
« on: August 30, 2009, 03:56:14 am »
In the 1.5 tutorials named "Displaying a sprite" they say to use a clock to make movement the same across different computers. In the tutorial they use GetElapsedTime()... my question is shouldnt they be calling the Reset() function after every cycle, otherwise it will always speed up because the timer is never being reset. Just wondering about that because I couldnt get a lot of my unit movement correct and then I put a call to Reset() and everything works =O

Edit: I just noticed they had a call to reset in the other tutorial that went over time. Whoever made the tutorial on "Displaying a sprite" forgot to add a call to Reset()

5
Feature requests / Normalization of Vectors
« on: August 01, 2009, 05:24:35 pm »
It would be cool if we could have a member function within sf::Vector2f that takes a Vector2 parameter and normalizes the member data x/y and the paramaters x/y. Here's what i'm using, it can be adapted to sf::Vector2f pretty easily.

Vector2.h
Code: [Select]

namespace gtp
{
struct Vector2
{
Vector2();
Vector2(float x, float y);
Vector2& operator=(const Vector2& param);
float x;
float y;
};

Vector2 normalize(Vector2 Target, Vector2 Current);
}


Vector2.cpp
Code: [Select]

namespace gtp
{
Vector2 gtp::normalize(Vector2 Target, Vector2 Current)
{
Vector2 _Normal;
float SlopeX = Target.x - Current.x;
float SlopeY = Target.y - Current.y;
if ((SlopeY == 1) || (SlopeY == -1))
{
_Normal.y = SlopeY;
_Normal.x = SlopeX;
}
else
{
_Normal.y = (SlopeY / SlopeY);
_Normal.x = (SlopeX / SlopeY);
}
return _Normal;
}
}


Normalization is basically finding the delta between 2 coords and making it a unit of one (for unit moving).

6
General / [Newbie Question] Getting global mouse coords
« on: July 17, 2009, 01:10:52 am »
I'm new to SFML (only about 12 hours in atm haha) and im getting stuck at finding the global mouse coords. I'm in the process of making an RTS and atm im trying to get the map to move around. This is what i'm using right now:

Code: [Select]

//Direction 1 (Quadrant 1 - North West)
if ((Event.MouseMove.X > 50) && (Event.MouseMove.Y < ((int)App.GetHeight() + 50)))
{
GameView.Move(-1.f * ElapsedTime, -1.f);
}


The Event.MouseMove.X is giving me the mouse position within the view. I've tried a few different methods and still cant seem to find it.

Thanks for any help :)

Pages: [1]
anything