Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

amrazek111

Member Since 05 Jun 2011
Offline Last Active Today, 03:33 AM
-----

Posts I've Made

In Topic: Separating Windows folders

17 May 2013 - 09:27 AM

I was just wondering how Windows behaved during updates, etc. All I could find on Microsoft forms was the _advice_ not to do it. _advice_ is nice but it's not really an explanation.

I didn't want to respond until I'd had a reasonable amount of time to test things out, since I'd only recently moved my folders.  Everything has been working fine, with one exception: some updates (specifically, those related to internet explorer) failed with error 80070011.  It turns out Windows 7 has some entries in the registry that need to be altered if you move your program files with a junction.  I found this solution which solved those issues for me. 


In Topic: Accelerated C++ chapter 3 help needed.

22 April 2013 - 11:53 PM

That's because whatever invalid input cin tried to convert into x's type is still in the buffer.  What's wrong with simply ignoring the remainder of the invalid input with cin.ignore()?


In Topic: Accelerated C++ chapter 3 help needed.

22 April 2013 - 06:00 PM

It's a bit subtle.  http://www.parashift.com/c++-faq/istream-and-while.html

 

In a nutshell: your while loop continues until the user puts the stream into an error state, after which all attempts to extract data from it will fail until the error state is cleared.  After the loop, reset the stream's state with istream's clear() function (cin.clear() -- as cin is just an istream under the hood)

 

As an aside, you can still break things in the same way by providing invalid input for the first two cins.  For instance, typing anything that can't be cast to a double for the midterm or final grades will also put the stream into an error state and skip past the loop and your final cin.  It might be wise to check the stream's state after those to see if the user tried to input something invalid.


In Topic: Separating Windows folders

21 April 2013 - 09:49 PM

Have you tried symbolic links?  I moved my Program Files directories off of my 32GB SSD successfully using them. 

 

Edit: Using robocopy and the Windows 7 Repair command prompt*


In Topic: SDL multiple layer - why doesn't this work?

21 March 2013 - 06:28 PM

Is your image loaded successfully?  Right after img would be a good place to display SDL_GetError() if img turns out to be NULL.

 

Also: Don't assume you know the underlying pixel format.  For instance, on my computer your masks are wrong.  Just use the screen's format.

SDL_Surface* img = IMG_Load("blocks.png");



    if (!img) {

        std::cout << "Error: " << SDL_GetError() << std::endl;

        return -2;

    }

SDL_Surface* f1 = SDL_CreateRGBSurface(SDL_SWSURFACE,500,500,32,_screen->format->Rmask,

                                                                    _screen->format->Gmask,

                                                                    _screen->format->Bmask,

                                                                    _screen->format->Amask);


After that, blitting with the alpha transparency worked fine for me.


PARTNERS