Jump to content
  • Advertisement

too_many_stars

Member
  • Content Count

    179
  • Joined

  • Last visited

Community Reputation

338 Neutral

About too_many_stars

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Art
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. too_many_stars

    Sprite Sheet Clipping Programs

    I have not looked too hard, but I usually just find sprites sheets in png format with no accompanying xml or txt file. That's why I thought the best way forward would be an algorithmic approach since it's such a hassle to rip out the rectangles, convert them to uv (if necessary) and render them. Do you know of any sources that provide clip rectangles with the image files consistently? Thank you again, Mike
  2. Hello Everyone, I was just wondering if there's a program out there that's able to take an arbitrary sprite sheet (perhaps not dived evenly) and generate a text file of clipped rectangles for each individual sprite. If not, does anyone know what's the best way to take an arbitrary sprite sheet and rip out the clipped rectangle without having to do it manually? Thanks so much, Mike
  3. too_many_stars

    C++, comparing type <T> to integer

    Yes it's just a quick piece of pseudo code, you are correct and your code example is what I meant.
  4. Good Morning Everyone, I have a simple question. Is it possible to compare a generic template< class T > to an integer? For example... template < class T > void foo(){ int value = 2; if( T == 2 ){//this is the comperator i am wondering about do something... } } Thanks so much again, Mike
  5. too_many_stars

    Limited life time object from a function

    I think you guys are right. I was just wondering if anyone has seen a working example like this since the book only shows an interface (ie *.h file). Not only that, but as CrazyCdn mentioned, it's a general purpose book not geared towards specific implementation so the example could be contrived.
  6. too_many_stars

    Limited life time object from a function

    There's no code for it in the book, the blurb says "The debug drawing API in Naughty Dog's Uncharted: Drake's Fortune engine looks something like this." I thought about the hash example. I am just not sure how efficient it would be before ever draw call to check if the object is in the map. Especially if there are hundreds or thousands of objects to debug. You are right, I did stumble through the question. My apologies. A better way to phrase it might be "How does one create a single timed object per function call in an infinite loop." Mike
  7. too_many_stars

    Limited life time object from a function

    Thanks for the reply Hodgman. I do understand that part of it. What I don't understand is this. Say I want render a line for 1000ms so the following happens on the main game loop... Frame 1: g_debugDrawMgr.AddLine(/*line params*/, 1000.0f); So on frame 1 a line object with 1000ms duration is added to (probably a vector) some batch and rendered. After 1000ms, this line object is destroyed. The game loop continues... Frame 2: g_debugDrawMgr.AddLine(/*line params*/, 1000.0f); On the second frame, another line object with 1000ms duration is added to the same container, and rendered. After 1000ms, this second line object is destroyed. As long as the game loop is running, each call to the function g_debugDrawMgr.AddLine will keeping pushing line objects without pause. So my question is this. How does the function g_debugDrawMgr.AddLine create a line object just once per function call with a duration without constantly creating more objects per draw call. Mike
  8. Good Afternoon Everyone, I am reading over "Game Engine Architecture" by Jason Gregory and my question involves the Debug example on page 377. In the book, there's a class like so... class DebugDrawManager{ void AddLine( /*normal line params*/, float duration); }; g_DebugDrawMgr; //global access to debug draw manager And the example is used thus void Vehicle::Update(){ g_debugDrawMgr.AddLine(/*line params*/, 1000.0f /*duration now is 1000 ms*/); } My question is, since a game runs in an infinite while loop, how is it possible to draw a line, say with a duration of 1000 ms, and then upon the next frame, in the same update function, not push_back another instance of another line with a duration of 1000ms. In another piece of code, we might have something like this void Person::Update(){ g_debugDrawMgr.AddLine(/*line params*/, 50000.0f /*duration now is 50000 ms*/); } We have the same problem. Some kind of line struct is getting pushed every update step with a life duration of 5000ms. Does anyone know how such a function works under the hood? Thanks again, Mike
  9. too_many_stars

    Managing pointers upon object destruction in C++

    After reading the article, I would be interested in learning more about handles. The actual nuts and bolts. I can't find any tutorials or examples. Could you point me to something introductory even if it's a book or article? Mike
  10. Thanks FRex. As soon as I turned on the hidden folders through control panel I am able to see the .vs folder including it's massive size. I will look into some of the tools you suggested. Mike
  11. too_many_stars

    Managing pointers upon object destruction in C++

    @pcmaster - I was reading about the weak_ptr option yesterday but a number of sources wrote that's not available for unique_ptr only the shared_ptr. Is my understanding incorrect?
  12. Good Evening, I have a question that's been a constant source of frustration and I need to learn to deal with it. Say I have a warrior with a memory (AI) module that polls with world through it's vision and it 'remember's' through a pointer (pointing to a troll) that a troll was detected 2000ms ago. Now, say I have a wizard that collided with the same troll, and the wizard now has a pointer to the troll 'remembering' the last thing it collided with. Somewhere down the road, there's a delete call on the troll object. Now I have the memory module and the wizard with pointers to a deleted object. Let's multiply this over hundreds or thousands of objects and it becomes insanely complex with a multitude of objects and various pointers pointing to objects that may or may not be deleted. So my questions is this. Is there a design pattern (hopefully not too obtrusive), algorithm, or a way upon object destruction to notify every other object that's pointing to the destroyed object that it's been deleted so i can NULL the pointers? Thanks in advance for your time and answers. Mike
  13. too_many_stars

    std::shared_ptr to this pointer question

    Thanks so much for the response. I was just redesigning my spatial grid class and came to wonder if this was allowed in the C++ language. In my implementation I do pass a raw pointer to an ICollidable * pCollidable object which solves the problem above. This is purely for my edification since the C++ language is so complicated. Thank you again, Mike
  14. Hello Everyone, I have a quick question regarding the contrived program below. class Person { public: Person(const std::string & n, int a) : name(n), age(a) {} void DoSomething() { /* Problem here. "this" pointer is not the same as std::shared_ptr<Person>. How can this pointer refer to itsel through the std::shared_ptr<Person> ? */ ThisIsDoingSomething(this); } private: std::string name; int age; }; void ThisIsDoingSomething(std::shared_ptr<Person> pPerson) { std::cout << "here" << std::endl; } int main() { auto pMike = std::shared_ptr<Person>(new Person("Mike", 40)); pMike->DoSomething(); char hold; std::cin >> hold; return 0; } Given a function that passes a std::shared_ptr<T> parameter (in my case ThisIsDoingSomething) Is it possible for a class to refer to it self through the std::shared_ptr by somehow using "this" pointer? Sorry for the word salad but I am not sure how to explain it better. Thanks again, Mike
  15. Thanks for the response guys. That makes sense. I never had anything similar happen on VS2012 but then again that version did not have IntelliSense (as far as I know). Mike
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!