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

Pages: [1] 2
1
Graphics / Drawing a circle with part of it missing?
« on: April 25, 2010, 06:19:51 am »
Basically, would a circle like the below image be possible to draw out of an SF shape?



What I want to do is have a sort of "clock" animation where the circle becomes more and more white as it winds down.

Possible?  Thanks.[/img]

2
Window / Setting refresh rate?
« on: April 23, 2010, 08:02:44 am »
I wondered if it's possible to set the refresh rate with a render window, particularly in fullscreen.

I've got a CRT and I see games do mixed things with fullscreen.  Some set the rate to be the same as the desktop while others set it to like 59.78...

I just was hoping there'd be an option to set it the same rate always.

3
Graphics / Screen tearing with my own time controller - double buffer
« on: April 15, 2010, 09:17:39 pm »
Hey there.

I've implemented my own time control system that is working pretty well, but naturally the FPS and vsync are not equal and thus it produces a screen tear artifact.  This is ONLY in fullscreen mode.

Is there an easy way to address this?  I've been reading about double buffering, but have no idea how to actually go about it.

Help/thoughts appreciated, thanks.

4
General / Window losing focus - stopping the App?
« on: April 14, 2010, 06:19:35 am »
Hey all.  I've got my speed problems resolved, but now I have another one I was hoping to get fixed up:

If you click away from the window, I want to have it so the application stops running.

It's also a similar case when I try to drag the window around.  It'll stay frozen and update when you let go of the mouse.

Are there easy ways to detect this?  Thanks.

5
General / Taking the time control approach - questions
« on: April 11, 2010, 05:43:33 am »
Okay, I've been trying to do this new approach rather than depending on FPS...  Here's a snippet of my player code.

Code: [Select]

#define PLAYER_SPEED 160.f
float MoveY = 0.f;
float MoveX = 0.f;
if (GetEventsControls.bDownKey) //Vert.
MoveY += PLAYER_SPEED;
else if (GetEventsControls.bUpKey)
MoveY -= PLAYER_SPEED;
if (GetEventsControls.bLeftKey) //Horiz.
MoveX -= PLAYER_SPEED;
else if (GetEventsControls.bRightKey)
MoveX += PLAYER_SPEED;
//Focus mode
if (GetEventsControls.bLshift)
{ MoveX /= 2;
MoveY /= 2;
}
MoveX = MoveX * App.GetFrameTime();
MoveY = MoveY * App.GetFrameTime();
game.playerHitX += (int)MoveX;
game.playerHitY += (int)MoveY;


Basically, with it right now, it SEEMS to be precise...  I have to multiply by 160 to get a result that actually moves...

The HitX and HitY is the center point of the player and it is drawn relative to that point.  The main problem, though, is I want this number to be an int always.

Is there anything better I can be doing with this or does this look acceptable?  Thanks!

6
Graphics / SetScale in 1.6 displaces the graphics
« on: April 08, 2010, 02:15:41 am »
So, I've got this small graphic and when I used setscaleY on it to make the thing taller.  In 1.5 it worked fine, but here, I need to set its Y position higher in order for it to be positioned correctly...  I am using a scale of 60.

The greater the scale value is, the lower down it goes.  Setting the center to 0,0 does nothing either.

Any thoughts or is this just a bug?

UPDATE:  It also does it with X coordinates too.

7
General / 50% CPU usage... thoughts on improvement
« on: April 01, 2010, 07:44:19 pm »
Hey all.  I'm using VCpp 2008 express and Windows XP Pro.

Well, I've added plenty of stuff to the game such as sounds and bullets.  I've had upwards of 300 bullets on the screen without slowdown, but when monitoring this in the task manager, it's always at 50% no matter where I am and no matter how little is actually going on...  I've looked at other games, and they never seem to go beyond 15% except when loading between things.  In debug mode, slowdown does happen.  Release mode is fine (for now).

Here's a breakdown of how I'm doing things:

I have singleton classes for the title screen and game.  These classes have their own sf::Image instances.  Most objects spawned from them have their own sf::Sprites.  I also have a singleton class for the sounds.  I only have 4 small sound effects thus far.

I could understand the game part maybe having some slowdown, but the title?  Is it normal for an SFML app?

8
Graphics / Passing sf::sprites
« on: March 30, 2010, 05:08:14 am »
Hey all.  This is something I was questioned about and didn't really pay it mind until now.

Basically, if I want to copy an sf::Sprite, I've been doing things like this...

Code: [Select]

GameObjs.push_back(new GameStageWindow(GFX_GameStageWindow, GFX_GameStageWindowText));  //There's 2 sf::Sprites already declared and this function takes and passes these sprite to a ctor for GameStageWindow"

//The ctor looks like this:
GameStageWindow::GameStageWindow(sf::Sprite passedSprite, sf::Sprite passedSprite2)
{ windowSprite = passedSprite;
windowBorderTopSprite = passedSprite;
windowBorderBotSprite = passedSprite;
windowTextSprite = passedSprite2;
//etc...


Basically what I'm wondering is if what I'm doing is bad.  Objects will need their own sf::sprite instances, but I just am not sure if this implementation is a good idea.  Thanks.

9
General / Release build slower than debug...
« on: March 28, 2010, 06:51:56 am »
Well, this one's definitely different.  The debug build of my game runs at the correct 65 fps.  The release one will either run at 50 or 32.  If I remove the framerate cap, it naturally flies, so no way it's a memory issue...

I naturally tried commenting out things, but nothing helped.

All the game even does is move the player around.  I could post the code for while the game is running unless someone has a good idea what it could be.

UPDATE:  I actually re-implemented my old idea of having a time check at the end, rather than regulating the framerate to be 60 and this fixes the problem...  I don't know if this is the best fix, but for now I'll take it.

10
General / Time handling and FPS q's
« on: March 27, 2010, 08:31:24 pm »
Hey all.  I've begun the game and it obviously goes too fast without time controls, so I've done this at the end of the loop:

Code: [Select]

bool bWait = true;
while (bWait)
{ float Time = Clock.GetElapsedTime();
if (Time >= 0.0166)
bWait = false;
}
cmnFunc.CommonFunctionClass::DisplayFPS(Clock);
Clock.Reset();
App.Display();


Basically, the 0.0166 is around 60fps, and when I do send it to the DisplayFPS function, it does indeed show 60fps in the lower right.

I'm wondering if what I'm doing is a proper way of doing it?

I did see that one can supposedly lock the FPS rate, though that seemed to really bog down the App when doing it, but maybe I'm not doing something right in the implementation...?

Any advice appreciated, thanks.   8)

11
Graphics / Can you "send to back" with graphics?
« on: March 27, 2010, 03:52:31 am »
Basically the topic says all.  I wondered if there was any easy way to send any graphic to the back or if I just have to resort to drawing them in the correct order?

Thanks.

12
General / Getting my game to work on other systems...
« on: March 22, 2010, 06:38:51 am »
Hey all.  I made a prelim build of my game, which basically just has the title screen and a rough HUD for the "Start new game".  The Exit option also works.

http://sivak.nintendoage.com/Shmuppy.zip - Here's the zip with the files.

From reports, nobody seems to have been able to get it to load.  Something about side-by-side config incorrect is what one person told me?

Here's what I did:
-Compiled in VC++ 2008 express
-This is the debug mode version (does this have anything to do with it???)
-It obviously runs on my system, which is WinXP Pro SP3.

I don't know if I just simply need to include more files or what.

I'm still a rookie for distributing stuff made in C++.  Any help appreciated, thanks.

13
SFML projects / My SFML project - shoot 'em up game
« on: March 21, 2010, 04:46:05 am »
Well, I saw this and figured I'd share.

I've made some games in the past, but those were done in assembly.  I've decided to move up in the world and try my luck with C++ and SFML.

I'm intending to make my own shoot 'em up game, currently dubbed "Shmuppy".  I'll think of a title later.

I want it to be manic where there's lots of bullets all over the place (like 500+).  Thus far, I've gotten a few screen transitions to work, so I'm pretty pleased with that.  It's a lot farther than I've ever gotten with anything in C++.  Doing the actual game itself will certainly be interesting.

SFML has made things relatively simple thus far.  Hope it stays this way.

14
Graphics / Using one image and taking sectors?
« on: March 21, 2010, 04:28:28 am »
Hey all.  I wondered if it was possible to do something like have a portion of an image be used as a sprite?

Say I had a 50x50 pixel image with 4 25x25 pixel frames on it.  Could I take each of these frames using just the one image and make 4 sprites of it or does it HAVE to be a separate image file for each?

Thanks.

15
General / Handling game logic and such...
« on: March 18, 2010, 05:05:17 am »
Okay.  I've gotten my program to compile and I can see the 3 PNG files I made up for the title screen thus far.  It's laid out right, etc. etc.

The big problem though is how this is handled.  Using the tutorials, I have this variable:

Code: [Select]

sf::RenderWindow App(sf::VideoMode(640, 480, 32), "Shmuppy");  // the render window


...and it is global.  I don't know if this is bad or not, but it works.  The way I'm intending to do it is have App be used for drawing wherever...

Anyway though...  what I've basically done is made up 2 functions.  main and titleScreen.  I have a variable for the game state, which calls the respective function from main as well as one called navigateMode, which is like the "state within the game state".  This is the approach I've used for my ASM programs.

Anyway, the big problem I have is with the whole title screen.  It's basically doing state 0 all the time, which involves loading the 3 PNGs each frame, making them into sprites, and then drawing said sprites.  Obviously, it should NOT have to load these every frame, but I have no idea where to go from here which would involve loading these separately...

This is the program thus far:
http://pastebin.ca/1844303

I keep wanting to take the approach of having a lot of global variables, but I know that's not the C++ way.   8)

Pages: [1] 2