Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GDI leak on 9x only? Pin
RobJones11-Feb-03 4:18
RobJones11-Feb-03 4:18 
GeneralRe: GDI leak on 9x only? Pin
jhwurmbach11-Feb-03 4:46
jhwurmbach11-Feb-03 4:46 
GeneralThanks Pin
RobJones11-Feb-03 5:22
RobJones11-Feb-03 5:22 
GeneralRe: Thanks Pin
Roger Allen11-Feb-03 6:18
Roger Allen11-Feb-03 6:18 
GeneralLearned something new Was: Thanks Pin
jhwurmbach12-Feb-03 21:19
jhwurmbach12-Feb-03 21:19 
GeneralUsing STL in a DLL Pin
Gian11-Feb-03 2:48
Gian11-Feb-03 2:48 
GeneralRe: Using STL in a DLL Pin
pete mcquain11-Feb-03 7:41
pete mcquain11-Feb-03 7:41 
GeneralRe: Using STL in a DLL Pin
Gian11-Feb-03 22:20
Gian11-Feb-03 22:20 
my dll header is

#ifndef LFONTRENDERER_H
#define LFONTRENDERER_H
//--------------------------------------------------

# define GFONT_API __declspec(dllexport)

#include <string>
#include <vector>

#ifdef _WIN32
#include <windows.h>
#endif // _WIN32


#include <gl gl.h="">
//--------------------------------------------------

typedef unsigned int uint;
typedef unsigned char byte;

#define DEFAULT_HEIGHT 99999

struct LCharCoords
{
GLfloat left;
GLfloat top;
GLfloat right;
GLfloat bottom;
bool enabled;
float widthFactor;
};

struct LFont
{
std::string name;
GLuint textureId;
uint defaultHeight;
uint height;
float widthScale;
bool italic;
GLfloat angle;
GLfloat r, g, b;
LCharCoords chars[256];
};

struct LStringData
{
std::string str;
uint font; // the font to be used
uint height; // the height of the font
GLfloat r, g, b; // the color
GLfloat angle; // the rotation angle
GLfloat x, y; // the position
float widthScale; // width scale
bool italic; // true if the font is italic
};

//--------------------------------------------------
class GFONT_API LFontRenderer
{
public:
// default constructor, initializes the object
LFontRenderer();
// the destructor, automatically called by delete
virtual ~LFontRenderer();
// returns the number of fonts loaded
uint GetFontCount();
// returns the name of the given font, index _must_ be smaller than GetFontCount()
const std::string& GetFontName(uint index);
// sets the active font, this function is also available in a version that takes the index as parameter
void SetActiveFont(const std::string& name);
// sets the active font, this function is also available in a version that takes the name
// of the font as parameter
void SetActiveFont(uint index);
// returns the index of the active font, throws an exception if no fonts are loaded
uint GetActiveFont();
// this function loads a font from a file and adds it to the list of fonts it returns the index of
// the new font. The font name paramater is a name for the font that can be used with
// SetActiveFont() etc.
uint LoadFont(const std::string& fontname, const std::string& filename);
// removes all fonts and clears any memory allocated
void Clear();
// sets the height of the current font
void SetHeight(uint height);
// sets the color of the active font
void SetColor(GLfloat red, GLfloat green, GLfloat blue);
// returns teh height of the active font
uint GetHeight();
// call this to get the color of the active font
void GetColor(GLfloat &red, GLfloat &green, GLfloat &blue);
// call thos method to output a string
void StringOut(float x, float y, const std::string &string);
// this method draws all the strings
void Draw();
// this methods sets the width scale of the active font
void SetWidthScale(float scale);
// this method returns the width scale of the active font
float GetWidthScale();
// this method sets the rotation angle for the active font
void SetRotation(float angle);
// this method returns the rotation angle for the active font
float GetRotation();
// this function is used to set either the active font should be italic or not
void SetItalic(bool value);
// this function returns true if the active font is italic
bool GetItalic();
// this function returns the width of the string. font metrics of the active font
// are used
uint GetStringWidth(const std::string &string);
protected:
// used internally
uint m_strCount;
// the index of the active font
uint m_activeFont;
// the array of fonts
std::vector<lfont> m_fonts;
// the strings to be rendered
std::vector<lstringdata> m_strings;
// the size of the viewport
uint m_viewTop;
uint m_viewLeft;
uint m_viewWidth;
uint m_viewHeight;

#ifdef GL_VERSION_1_3
// used internally, the number of supported texture units;
uint m_textureUnits;
#endif // GL_VERSION_1_3
};


//--------------------------------------------------
#endif // LFONTRENDERER_H
GeneralRe: Using STL in a DLL Pin
Gian11-Feb-03 22:34
Gian11-Feb-03 22:34 
GeneralMainFrame OnClose() crashes Pin
ns11-Feb-03 2:16
ns11-Feb-03 2:16 
GeneralRe: MainFrame OnClose() crashes Pin
karl_w11-Feb-03 2:37
karl_w11-Feb-03 2:37 
GeneralRe: MainFrame OnClose() crashes Pin
Vagif Abilov11-Feb-03 5:30
professionalVagif Abilov11-Feb-03 5:30 
GeneralRe: MainFrame OnClose() crashes Pin
ns11-Feb-03 7:04
ns11-Feb-03 7:04 
Generalconvert rtf to bitmap Pin
particle2k11-Feb-03 2:00
particle2k11-Feb-03 2:00 
GeneralCapture Webcam Image Pin
Chintan11-Feb-03 1:17
Chintan11-Feb-03 1:17 
GeneralRe: Capture Webcam Image Pin
benjymous11-Feb-03 3:02
benjymous11-Feb-03 3:02 
GeneralRe: Capture Webcam Image Pin
Chintan18-Feb-03 18:23
Chintan18-Feb-03 18:23 
GeneralMs Word Automation - How to center a Table Pin
Rafoloman11-Feb-03 1:16
Rafoloman11-Feb-03 1:16 
GeneralQuestion about delete a char* pointer Pin
George211-Feb-03 0:48
George211-Feb-03 0:48 
GeneralRe: Question about delete a char* pointer Pin
karl_w11-Feb-03 1:05
karl_w11-Feb-03 1:05 
GeneralRe: Question about delete a char* pointer Pin
George211-Feb-03 1:14
George211-Feb-03 1:14 
GeneralRe: Question about delete a char* pointer Pin
jhwurmbach11-Feb-03 1:07
jhwurmbach11-Feb-03 1:07 
GeneralRe: Question about delete a char* pointer Pin
George211-Feb-03 1:15
George211-Feb-03 1:15 
GeneralRe: Question about delete a char* pointer Pin
peterchen11-Feb-03 2:05
peterchen11-Feb-03 2:05 
GeneralRe: Question about delete a char* pointer Pin
George211-Feb-03 13:07
George211-Feb-03 13:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.