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

Pages: [1]
1
Window / User input problem
« on: May 20, 2011, 09:17:32 am »
Thanks for the help OniLink10, that solved the issue. I must have stared myself blind at the issue.

Sorry about the the whole thing regarding how much to attach, I completely misunderstood what you where reffering to. But at least, should I need more assistance in the future, I'll be aware of what to attach properly next time.

Again, Thanks a bunch for the help!

2
Window / User input problem
« on: May 19, 2011, 02:39:37 pm »
I hope this is sufficient:
Source Code

It's my "main gameloop" function, most of the functions called are just passing back and forth information after calculating the results of the inputs.
It's not really optimized yet (specially not the sfml window/input/gfx parts, still working on fully understand it all with class implementations - but thats a whole other story that i'll take my time with).

I've made a little:
---------------
This is the spot
---------------
comment for where i'd like to insert the "pause and wait for key to continue" event.

The couts are mainly for bug testing purposes and will be removed once my problems are solved :)

(The reason i've only included that gameloop function is because thats where the entire SFML part of the program is - only there).

3
Window / User input problem
« on: May 18, 2011, 11:50:30 pm »
Hey Everyone (and thanks for bearing over with my high amount of questions)

I have some code that i simply cannot get to work the way i intend it to, and i hope some of you might shead some light on how i could fix it.

Basically i have a setup close to this (though alot has been removed for simplicity's sake):

Code: [Select]

bool WaitForInput = false;
while(Window.IsOpened()){
  sf::Event Event;
  while(App.GetEvent(Event))
  {
  if(handler == special situation)
  bool WaitForInput = true;
  while(WaitForInput == true)
  {
   If(Event.Type == sf::Event::KeyPressed)
   {
    WaitForInput = false;
    cout << "Key has been pressed" << endl;
    }
   }
  }
}


So basically what i inteded with it was that if the loop enters a specific condition (the if sentance) - It should promt the user (not included in code) to press a key, and stay there until the user responds by hitting a key.
However all i've been able to achieve so far is that it gets stuck in the loop forever - despite me desperately smashing my keyboard buttons.

So is there a way to add a "wait for key input" kinda thing in the middle of the code?

(the structure of the code was kinda borrowed from this topic.


edit: Just altered it a bit.
Moved the While Get Event part down to where my primary key input part was, as it was running the rest of the code twice whenever it recieved a valid input. (which makes no sense at all).

Also thought of a 2nd question which could be related to the first one:

As my project is "turnbased", is there a way to stop it from rushing through the while loop like a madman? As it is now it makes my cpu go from "power-saving happy" to "I diddent know you where playing 3 instances of Crysis on the highest settings" mode.

So kinda make it rest until key input (which is basically the same as i wanted in question one - except in that case it should pause-mid code).

Thanks in advance for any help! :D

4
Graphics / Help with efficient image handling
« on: May 13, 2011, 02:08:15 pm »
Hello Everybody (Hi, dr. nick).

Im having an issue working with a few semi-large images.
I have 6 rooms for a small game i've made, in the size of 800x600.
Theres no movement or anything on the screens right now, so their primary function is to serve as a background. (By going through the maze i've programmed the images should change).

Now this works somewhat, but i have a few issues.

1. My program in its console version has a running time (with some debugging couts) of 0-10ms per calculation/move. If i add the images so
it loads them everytime, it ends up at 590ms. I tried making a sprite sheet and putting them all in there (however i cant really get it to "normal size" (128x128, 512x512) due the number of bgs ) - i end up with a whopping 1000+ ms per update. Thats not idea :/
Just tried it with the framerate counter, displaying 1 measly image gives me a framerate of 2fps.

2. I havent figured out how to do the offset yet, it seems i need to define a rectangle somewhere? :P wheres my ImageTex.offset command.
Atm i've just made the whole sf::Image Image thing and loaded the image in.
Figured out this one as well. Such helpfull documentation ^^

3. While not too bothersome, for some reason the window that is opend when the program starts - moves (the actual window) about 50 pixels after the first move. Thats kinda odd :P as i have no code that should influence the window position.

Edit:

4. Hm, noticed another thing. While the primary function of my window (atm.) was just to sit there and look pretty. It will shortly after being started display the "Program is not responding" on the window. Using the console i can still interact with the program - and doing so will refresh the window removing the "issue", it will however reappear shortly afterwards.

//Scratch this one-  i think i figured it out. Its due to the command console. Since they're both within the main game loop, and the loop "pauses" to wait for key input :P the window cant refresh and as such "dies" a little inside. Poor thing.[/b]

Thought of another question:
5. If i stuff all the graphics in a thread, will it then close the window when the thread reaches its end or will it be able to stay alive and be reused? (if so, how :P)

5
General / Minor issue with SFML
« on: May 13, 2011, 12:13:02 pm »
Yeah, thats what i thought.

:P Guess i'll have to reinstall Visual Studio and SFML to get rid of it. Ugh, that program has an install that takes decades.

Will report back if a reinstall worked once its done :)


Edit: A reinstall did it. I think the issue i was having was that i'd been up working on an assignment for 35 hours with no sleep, so when i clicked the tutorial for the VC++ section and headed to the download page - i must've thought "this is only for vc++" and just taken the top link (which is the MingW ver).

Silly me :)

Thanks for the help!

6
General / Minor issue with SFML
« on: May 13, 2011, 12:52:47 am »
Hello everyone,

I have a minor issue SFML.
I've installed SFML using the Visual Studio 2008 SDK from the tutorials section, and proceeded to trying to compile the clock example.
However, after getting passed the "cannot find sfml-system-d.dll" file which i had forgotten to copy to the folder, i recieved a second error.

This error states that the program cannot be started since libgcc_s_dw2-1.dll is missing. From what i've could find, thats related to some other area (BlocK?) and shouldent be an issue with me.

Any ideas on how to fix this?

Pages: [1]
anything