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

CAPE

Member Since 26 Jan 2007
Offline Last Active Mar 11 2013 03:54 AM
-----

Posts I've Made

In Topic: Pointers invalid between C++ and C#.

26 January 2013 - 01:35 PM

Oh shit, there my education went out the window. You think you are learnig something, then just: "MINDBLOWN. You dont know anyting. Study harder, douchbag.", or something like that.

 

Well, seems like it will be back to the drawing board. But, as it is an editor, i guess I can have it not som optimized, i guess... (shiver through my body).

 

But dudes, thanks for the quick reply. Very helpful.


In Topic: Loading and caching resources

23 November 2012 - 06:32 AM

I don't know how you store your texture pointers, but with an string identifier, i guessing map<string, TexturPtr>. This will need to be extended to support additional data to use as the identifier.

Here u can implement a functor to create your own comparison function. Its easy to create, you can variate between different types, and is manageble. The problem that occurs is that that you will need to implement a key-struct for each type and combination. But as you currently need to create a load function for each resource type, this I guess will be a minor problem.

struct TextureKey
{
   string name;   //texture name
   int sizeX, sizeY; //texture size
   bool operator<(const TextureKey &a, const TextureKey &b)
   {
	  return std::strcmp(a.name, b.name) < 0 &amp;&amp; a.sizeX == b.sizeX &amp;&amp; a.sizeY == b.sizeY;
   }
};

...

map<TextureKey, TexturePtr> mTexturePtrs;

(Have not tried the above code, but it looks right :) )

PARTNERS