MrP

Members
  • Content count

    143
  • Joined

  • Last visited

Community Reputation

565 Good

About MrP

  • Rank
    GDNet+
  1. The alBufferDataStaticProc function does not make a copy of the data and instead leaves the application with the responsibility of managing the associated memory. With this being the case, freeing the data while it is still in use would not be desirable :)
  2. Why destructor is not called ?

    You're trying to retrieve the CBullet object pointer from the fixture's userdata but you're storing it as the body's userdata - I think this may be the problem?
  3. The access violation is occurring when you are adding your features to the mapStorage vector in Map.h.   The feature location coordinates you produce have a lower limit of (1, 1) and an upper limit of (MapSize.X - 1, MapSize.Y - 1) which is perfectly valid, however when the Y coordinate is at the upper limit of this range and you attempt to access the tile below (e.g. line 260) the resulting index will be outside of the legal range of the vector which produces an access violation.
  4. You've enabled depth testing but you appear to only be clearing the colour buffer and not the depth buffer. It's possible that your first frame is rendering successfully but then each successive frame is failing because the depth test is failing.
  5. You're passing your Array object to the PrintArray function by value rather than by reference. As a result the parameter is a copy of the passed in argument (and therefore its m_array member points to the same address), so when the destructor is invoked at the end of the function the memory pointed to by both instances is deleted.
  6. Been a hellish week

    You can get Real-Time Collision Detection cheaper from CompMan.co.uk. You could certainly manage without buying the book as I'm sure the information is out there on the internet, it's really the author who makes it such a worthwhile purchase. Ericson is able to communicate ideas effectively without falling in to the trap of sounding condescending, or worse, rambling at such an elevated level that the reader is left behind. One thing that should be made clear is that the scope of the book is limited to collision detection only and as such it doesn't cover physics at all. This isn't a criticism as it isn't to the detriment of the book, but the two are so intrinsically linked that it seemed important to mention incase you had expected otherwise.
  7. Weekly Sitrep

    Some of us have done some investigation in regards to the 'secret project' :). It's a great idea and one that's been a long time coming. Proof of our suspicions can be found by simply doing an Amazon search for 'A GameDev.net Collection'.
  8. My GUI system has a virtual screen size of 640x480. At aspect ratios other than 4:3 (16:9 or 16:10 etc.) the horizontal bounds of the virtual screen are extended left and right, with the 640x480 area remaining in the middle of the screen. For example, at a resolution of 1280x800 the virtual screen size is calculated as follows: Aspect ratio = 16:10 Virtual width = aspect ratio * 480 = 768 left = -((768 - 640) / 2) = -(128 / 2) = -64 right = 640 + ((768 - 640) / 2) = 640 + (128 / 2) = 704 Final virtual screen bounds: left: -64 right: 704 top: 0 bottom: 480 Controls can be docked to the sides of the screen allowing for full screen backgrounds (dock to the left and right), or to keep HUD elements in the corners of the screen. If a control is docked its position is used to offset it from the side of the screen to which it is docked.
  9. Blurred Sprite?

    Glad I could help. I will just add two more pieces of information. The first, is that you can access the device associated with the Sprite object by using the Device member of the Direct3D.Sprite class. spr.Device.SamplerState[0].MipFilter = TextureFilter.None; spr.Device.SamplerState[0].MinFilter = TextureFilter.None; spr.Device.SamplerState[0].MagFilter = TextureFilter.None; spr.Device.SamplerState[0].MaxAnisotropy = int.MaxValue; spr.Device.SamplerState[0].MipMapLevelOfDetailBias = 0; spr.Device.SamplerState[0].SrgbTexture = true; Second, you may wish to reconsider how you are using the Direct3D.Sprite class. It appears that your cSprite class is used to represent an on-screen sprite, and therefore should not have an instance of the Direct3D.Sprite class. The reason for this is that the Direct3D Sprite class batches the draw calls between the begin() and end()/flush() methods in an attempt to achieve optimal performance. I would consider something like this, where you pass the Direct3D.Sprite object to your cSprite.onPaint method: d3dSprite.begin(SpriteFlags.AlphaBlend); foreach(cSprite sprite in spriteList) sprite.onPaint(d3dSprite); // ignoring position for the sake of the example d3dSprite.end();
  10. Blurred Sprite?

    You're on the right lines with your sampler state settings, but you need to set them after your spr.Begin(...) call.
  11. Right...from what I can tell you have a map of int/bool pairs (the blockform variable) in the fallingblock class. When attempting to draw a falling block you are iterating through blockform, seeing if the value stored in the map at that particular key is equal to 'X'. This is wrong, as you are comparing a bool to a char. I believe in this situation the value is being converted to a char for the comparison, which will only ever yield a value of 0 or 1 regardless. Changing comparison from 'X' to true may fix your problem. Apologies if this is completely wrong, I'm very tired and that's a lot of messy code [wink]
  12. calendar calculator help

    Quote:Original post by slymr Quote: if ((0 == theYear%400) || (0 == theYear%4 && theYear%100)) should be: if ( 0 == theYear%4 ) Because "theYear%400" will be true if the other two are correct and a leap year is every 4 years not every 100. http://www.gamedev.net/community/forums/post.asp?method=reply&topic_id=430966&Quote=2 Reply to Topic - GameDev.Net Discussion Forums As a side note, the Year%100 will return false if it is divisble by 0 because you do not have an "==" operator. No. In the Gregorian calendar there is a leap year every four years, apart from every 100 years when there isn't one, with the exception of every 400 years when there is. Therefore that particular piece of code is actually correct, and having Year%100 evalute to 0 is desired behaviour in this case.
  13. Anoying bug

    Your "eye" position that you use to create the view matrix is too close to the origin. At the moment you are actually inside the model! [smile] Changing Line 113 in D3D.cpp to D3DXVECTOR3 vEyePt( 0.0f, 30.0f,-75.0f ); for example, will at least let you see some of your model.
  14. SDL sprite engine error

    What you need is pointers. At the moment SpriteList is a vector of CSprite objects . When you add a new CSprite object to SpriteList it doesn't add that actual object but a copy of it. Therefore changes made using gaurd won't affect the CSprite object in the vector, and vice versa. I'm guessing that you have not yet studied pointers, so your CSprite::X() and CSprite::Y() functions probably don't do what you think they do either. Look in to pointers and a solution should become clear [grin]
  15. SDL sprite engine error

    for (int i = 0; 1 < SpriteList.size(); i++) The 1 should be i. As it stands your for loop will not run at all when it contains one (or less) sprites. When it contains more than one sprite it enters an infinite loop and then you start trying to access data beyond the boundary of the vector, which would explain why your program is bombing.