Files
wagic/projects/mtg/include/MTGCard.h
wrenczes@gmail.com ba07ca2334 Improvement on my last change for reducing the formatted text caching: chopped it out altogether. I ran some profiling to see how much time on the psp it took to process the formatting on the description text (ie word wrapping it into several lines to fit on a card), and it ends up taking an average of 0.14 ms per card. For context, 60 fps is 16 ms. So clearly the formatting time is not the bottleneck here, and we gain no real performance caching the text, but lose memory due to pooling. So I cut it out entirely of the base class and we format on the fly during renders.
I also profiled this after the fact, as we have an open bug on poor drawing performance on psp when in text mode - it turns out that in the AlternateRender() function, my numbers look like this: 10.2 seconds were spent in JBLFont::DrawString(); 0.5 seconds were spent in my new helper FormatText() call, so we know where the perf hit is now.

I compared before & after on the psp with this mod, and the difference really isn't perceptible.  (It's still juddery, but no worse than before.)  I'll look at the DrawString() call next to see if we can make it any faster, although at first glance it looks like a pain.
2011-04-23 09:54:19 +00:00

55 lines
941 B
C++

#ifndef _MTGCARD_H_
#define _MTGCARD_H_
#define MTGCARD_NAME_SIZE 16
#define MTG_IMAGE_WIDTH 200
#define MTG_IMAGE_HEIGHT 285
#define MTG_MINIIMAGE_WIDTH 45
#define MTG_MINIIMAGE_HEIGHT 64
#include <string>
#include <vector>
#include <map>
#include "ObjectAnalytics.h"
class CardPrimitive;
using namespace std;
class MTGCard
#ifdef TRACK_OBJECT_USAGE
: public InstanceCounter<MTGCard>
#endif
{
protected:
friend class MTGSetInfo;
int mtgid;
char rarity;
char image_name[MTGCARD_NAME_SIZE];
int init();
public:
int setId;
CardPrimitive * data;
MTGCard();
MTGCard(int set_id);
MTGCard(MTGCard * source);
virtual ~MTGCard();
void setMTGId(int id);
void setRarity(char _rarity);
//void setImageName( char * value);
void setPrimitive(CardPrimitive * cp);
int getMTGId() const;
int getId() const;
char getRarity() const;
char * getImageName();
};
#endif