我一直在一个新项目工作,但我遇到一个问题,我不明白为什么失败.
当我执行此行时删除textY给我错误_Block_Type_Is_Valid(pHead-> nBlockUse).那么我做错了什么?
这是源代码:
Text.h
#ifndef TEXT_H
#define TEXT_H
typedef boost::shared_ptr<Font> FontPtr;
class Text
{
public:
Text(FontPtr font, char *text)
{
str = new char[35];
this->font = font; str = text;
}
Text(const Text& cSource);
Text& operator=(const Text& cSource);
~Text();
.
.
.
.
private:
FontPtr font;
char *str;
GLuint texture;
GLfloat pos_x, pos_y, width, height;
};
#endif
Run Code Online (Sandbox Code Playgroud)
Text.cpp
Text::Text(const Text& cSource)
{
font = cSource.font;
texture = cSource.texture;
pos_x = cSource.pos_x;
pos_y = cSource.pos_y;
width = cSource.width;
height = …Run Code Online (Sandbox Code Playgroud) 我目前参与了一个游戏项目,我们想要为菜单和其他东西添加GUI,但是我们花在开发自己的系统上的时间可能花费我们一些时间,这是一个部分我们不想失去太多时间的系统.
所以,我们正在阅读一些UI库,如GUIchan,CEGUI和最近的LibRocket,它们显然非常灵活和有用,所以我的问题是Librocket是否可以与用C++开发的SDL/OpenGL项目集成?如果你知道在哪里可以找到相关的信息,因为我们无法找到类似的东西.
我一直在为我的数据网络课程工作,我遇到了内存泄漏,但我不明白为什么会发生这种情况.
顺便说一句,我知道C和C++有很多混合,但是我无法做任何事情,它基于类代码,我无法修改它,我知道这不是一个好方法它和我需要使用char*作为必要条件.
我的程序是多线程的,我处理这个结构:
typedef struct packetQueue
{
char* buf;
int length;
packetQueue()
{
buf = nullptr;
length = 0;
}
packetQueue(char* buffer, int len)
{
length = len;
buf = new char[length + 1];
memcpy(buf, buffer, len);
buf[length] = '\0';
}
packetQueue(const packetQueue& other)
{
length = other.length;
if (other.buf)
{
buf = new char[length + 1];
memcpy(buf, other.buf, length);
buf[length] = '\0';
}
else
{
buf = nullptr;
}
}
packetQueue& operator=(const packetQueue& that)
{
if (this == &that) …Run Code Online (Sandbox Code Playgroud) c++ ×3
sdl ×2
c ×1
debugging ×1
integration ×1
memory-leaks ×1
opengl ×1
pointers ×1
queue ×1
visual-c++ ×1