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

Pages: 1 2 [3] 4
31
Graphics / Re: Double Buffering
« on: May 19, 2013, 06:19:57 pm »
SFML forum,

 Some graphics libraries will automatically save the pixels behind a
 sprite before it's moved and automatically replace those pixels after
 the sprite is moved.

 I will do some timing but I'm almost convinced the SFML method is as
 fast as anything else.

 Thanks for all the replies.

Jerryd

32
Graphics / Re: Double Buffering
« on: May 19, 2013, 05:24:08 pm »
SFML forum,

 My point is that I work in the off-screen or back buffer as it's
 often called and then call Screen.display().  This may flip or
 just change the pointers but in either case the back buffer now
 has data that's 1 frame behind.  Now I have no choice but to
 redraw the entire back buffer which takes time.  If the back
 buffer was left in tact I could just reposition whatever moved
 and and do the one way copy.

 But if clearing and completely redrawing the entire back buffer
 is faster than coping one buffer to another I can understand
 why it's done that way.

 Does anyone have anyone know these execution times.

Jerryd

33
Graphics / Re: Double Buffering
« on: May 19, 2013, 07:05:07 am »
OniLinkPlus,

 Flipping has to copy to and from both bitmaps,  seems like that
 would take longer than just a simple one way copy.

 If it flips and there was a sprite move I have to completely
 rewrite the off-screen buffer.

 With a simple copy I only need to move the sprite,  the pixels
 behind the old sprite position are automatically restored, and
 then just copy to the on-screen buffer.

Jerryd

34
Graphics / Double Buffering
« on: May 19, 2013, 05:55:32 am »
SFML forum,

 I have converted to 2.0,  not too bad.

 I have a question about the Screen.display() command, Screen being
 obtained by RenderWindow.

 With double buffering I call one buffer the off-screen buffer
 and the other one the on-screen buffer.

 It looks like when you do a Screen.display() these 2 buffers
 are flipped.  Is that correct?

 Other graphics libraries I have used just copy the off-screen
 buffer into the on-screen buffer and retain what was in the
 off-screen buffer.

 Is there a way to do this with SFML.

Jerryd

35
Graphics / Re: Problem with setTextureRect SFML 2.0
« on: May 13, 2013, 04:09:00 am »
Jebbs,
 Thanks that worked.

Jerryd

36
Graphics / Problem with setTextureRect SFML 2.0
« on: May 13, 2013, 03:04:20 am »
SFML forum,

 Switching over to SFML 2.0 from 1.6.

 The first project is a conversion of one that is working in 1.6.

 Not to bad so far but I'm have a problem with setTextureRect.

 In 1.6 I used:
   switch(num[index])
   {
      case 1:   Numbers.SetSubRect(sf::IntRect(0,0,63,63));   break;
      case 2:   Numbers.SetSubRect(sf::IntRect(64,0,127,63)); break;
      case 3:   Numbers.SetSubRect(sf::IntRect(128,0,191,63)); break;
      case 4: Numbers.SetSubRect(sf::IntRect(192,0,255,63)); break;
   }

 In 2.0 I use:
   switch(index)
   {
      case 1:   Numbers.setTextureRect(sf::IntRect(0,0,63,63));   break;
      case 2:   Numbers.setTextureRect(sf::IntRect(64,0,127,63)); break;
      case 3:   Numbers.setTextureRect(sf::IntRect(128,0,191,63)); break;
      case 4: Numbers.setTextureRect(sf::IntRect(192,0,255,63)); break;
   }

 Here's how I created the sprite in 2.0:
   sf::Texture MyNumbers;
   MyNumbers.loadFromFile("Numbers2.png");
   sf::Sprite Numbers;

 The problem is when index is 1 I get:
  1                          this is correct

 When it's 2 I get:
  2 3                       should be just  2

 When it's 3 I get:
  3 4                      should be just 3

 When it's 4 I get:
  4  ######          should be just 4

 The #s represent some garbage on the screen?
 
 The Numbers2.png file is attached.

Jerryd


[attachment deleted by admin]

37
Graphics / Re: Passing an SFML handle to a function
« on: May 09, 2013, 02:03:46 am »
SFML forum,

 Maybe I can wrap this up for now.

 I am a long time programmer but don't have much C++ experience.
 Based on zsbzsb's comments, I've spent the last couple of days
 at the local book stores looking for the right book.

 Incidently, I realize I didn't look close enough at his post.  He did
 have the answer.

 My goal here is to learn OOP graphics programming because I'm
 helping a 13 year old who whats to get into game programming.

 He's already written games with Lego, DarkBasic and Game Maker
 but it looks like the pros all use C++.

 I intend to switch to SFML 2.0 as soon as I have some more
 experience with 1.6.
 
 This forum has helped a lot and I'm sure I'll be back with more
 questions.

 Any suggestions on the "right book"?

Jerryd

38
Graphics / Re: Passing an SFML handle to a function
« on: May 08, 2013, 05:36:59 am »
Grimshaw,
 
 Thank you very much.  That all works, makes sense and I understand it.

 Jebbs,  I've had those kind of days.

I have one other type problem that can wait for another day.

Jerryd

39
Graphics / Re: Passing an SFML handle to a function
« on: May 08, 2013, 04:29:39 am »
Jebbs,

 Thanks for the reply.  You've helped me before.

 Good question.
 Screen must be an instance of an sf class so I should be able
 to say, Screen *pointer;

 but the compiler won't accept that?

jerryd

40
Graphics / Re: Passing an SFML handle to a function
« on: May 08, 2013, 03:28:15 am »
zsbzsb,

 If I have a multidimentional array defined such as:
 int frame[20][20];

 I make pointer to it using:
 int *pointer = &frame[0][0];

 This works but the compiler won't accept:
 int *pointer = &Screen;

jerryd

41
Graphics / Re: Passing an SFML handle to a function
« on: May 08, 2013, 02:22:24 am »
zsbzsb,

 Since "Screen" isn't global I want to pass "Screen" to a function
 and then access members of "Screen" using ->.

Jerryd

42
Graphics / Re: Passing an SFML handle to a function
« on: May 08, 2013, 01:28:35 am »
SFML forum,
 I know how to make and pass regular pointers, I just don't know how
 to make a pointer to "Screen"

 Any hint would get me started.

jerryd

43
Graphics / Passing an SFML handle to a function
« on: May 07, 2013, 10:25:00 pm »
SFML forum,
  SFML 1.6  Visual C++ 2010

 I have some working SFML programs and need to find out how
 to pass a handle to a function.
int main()
{
        sf::RenderWindow Screen(sf::VideoMode(640, 480, 16), "SFML Window");
-
???? function(Screen);
-
        return EXIT_SUCCESS;
} // end of main


???? function(sf::???)
{
        -
        want to do some "Screen" commands in this function
        -
        -
return ???
} // end function(sf:???)
 

 How do I do this?

jerryd

44
Audio / Re: sfml-audio-d.lib causes openal32.dll error
« on: May 05, 2013, 06:02:44 pm »
SFML forum,
 Thanks for the replies.

 Here are the only 2 lines in my program about sound.
        sf::SoundBuffer Beep;
   if (!Beep.LoadFromFile("beep-1.wav")) return EXIT_FAILURE;

 I put "openal32.dll" and libsndfile-1.dll" in the folder
 with the .exe file and made a lot of progress.  Now I can
 compile without errors and when I run I get a different
 Microsoft error saying:

 Unhandled exception at 0x78061174 (msvcp100.dll) in MatchMeSFML.exe:
 0xC0000005: Access violation reading location 0x00133000.

 If I comment out those 2 lines the error goes away and the
 programs runs fine.

 Can't find any information about this message on the net.

UPDATE:
 I've concluded that the line that causes the Microsoft error is:
 if (!Beep1.LoadFromFile("beep-1.wav"))

 I can play this .wav file in a media player so I think it's OK.


Jerryd

45
Audio / sfml-audio-d.lib causes openal32.dll error
« on: May 05, 2013, 07:34:48 am »
SFML forum,
 SFML1.6   Visual C++ 2010

 I'm putting sounds in a working program for the first time.

 My code compiles OK if I put sfml-audio-d.dll in
 Linker > Input > Additional Dependencies.

 But then when I run it I get the error:
 This application has failed to start because openal32.dll was not found.

 I have tried #include <path to the openal.dll file>
 but then I get a whole screen full of errors when compiling.
 I also get a Microsoft Package Server error window saying
 "Micorsoft(R) Visual C++ Package Server has encounted a problem
 and needs to close".

 I have other programs running OK but without any sound code.

 I have read a few web sites about openal32.dll but couldn't
 find a solution for this.

 Any Suggestions?

jerryd


Pages: 1 2 [3] 4