• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

136 Neutral

About Chisser98

  • Rank
  1. Ah, right.  Thanks saejox, AngelBinder was a big help.   Well, I guess it's pretty clear by now that I have no idea what I'm doing:     So, after more researching, and asking around a little on stackoverflow, I have something compiling.   However, now I seem to be unable to create a asSMethodPtr object...   I define the following struct:     struct S {     int f()     {         return 5;     }     int x = 10; };     and use it thusly:         asSMethodPtr pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );     However, I get the following compile time exception:     template_tests.cpp: In function ‘int main()’: template_tests.cpp:64:15: error: missing template arguments before ‘pt’ template_tests.cpp:64:15: error: expected ‘;’ before ‘pt’     Any idea why in the world I get that?     If I try to add an integer in there as a template, like so:   asSMethodPtr<16> pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );       I get this error instead: template_tests.cpp: In function ‘int main()’: template_tests.cpp:66:120: error: conversion from ‘asSFuncPtr’ to non-scalar type ‘asSMethodPtr<16>’ requested
  2. Ok, I'm trying to actually figure out how to do it...How do you create a asSMethodPtr struct object without the Macro...?   I've got this:   auto methodPtr = asSMethodPtr<sizeof(void (classObject.pointer)())>::Convert((void (classObject.pointer)())(classObject.addRefMethodPointer));     (Where 'classObject' is a struct of type 'Class' (defined in my first post))   But it doesn't compile, I get:      src/common/as_wrapper/AngelScript.cpp:98:66: error: void value not ignored as it ought to besrc/common/as_wrapper/AngelScript.cpp:98:68: error: template argument 1 is invalid src/common/as_wrapper/AngelScript.cpp:98:107: error: void value not ignored as it ought to be     Any ideas?  I've afraid this asSMethodPtr struct is pushing the limits of my C++ abilities...
  3. Ahh that makes sense.  I'll give wrapping asSFuncPtr a go.   Thanks SiCrane.
  4. hey all   I'm writing a thin wrapper for Angelscript for my game.   I'm a little unsure how to actually 'wrap' the asMETHOD macro.   I've got something like this so far:       void AngelScript::registerClass(Class classObject, std::vector<Method> methods) { registerObjectType(classObject.name.c_str(), 0, asOBJ_REF); registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_FACTORY, classObject.factorySignature.c_str(), asFUNCTION(classObject.factoryPointer), asCALL_CDECL); registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_ADDREF, "void f()", asMETHOD(classObject.pointer, classObject.addRefMethodPointer), asCALL_THISCALL); registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_RELEASE, "void f()", asMETHOD(classObject.pointer, classObject.releaseRefMethodPointer), asCALL_THISCALL); for ( Method m : methods) { registerMethod(classObject, m); } }       where Class and Method are defined as:      struct Class { std::string name; std::string factorySignature; void* pointer; void* factoryPointer; void* addRefMethodPointer; void* releaseRefMethodPointer; }; struct Method { std::string name; std::string signature; void* pointer; };         Unfortuantely, my compiler is giving me an error like this:    src/common/as_wrapper/AngelScript.cpp: In member function ‘void as_wrapper::AngelScript::registerClass(as_wrapper::Class, std::vector<as_wrapper::Method>)’: src/common/as_wrapper/AngelScript.cpp:100:160: error: template argument 1 is invalid src/common/as_wrapper/AngelScript.cpp:101:165: error: template argument 1 is invalid     Where line 100 and 101 are these two lines:     ... registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_ADDREF, "void f()", asMETHOD(classObject.pointer, classObject.addRefMethodPointer), asCALL_THISCALL); registerObjectBehaviour(classObject.name.c_str(), asBEHAVE_RELEASE, "void f()", asMETHOD(classObject.pointer, classObject.releaseRefMethodPointer), asCALL_THISCALL); ...       I'm not sure how I would go about passing (whatever it is) I need to pass to the asMETHOD to get this sucker compiled.   Anyone have any ideas?
  5. Apparently, that method is now deprecated. Found out from Chris on stackoverflow (here: http://stackoverflow.com/questions/13370774/using-angelscript-compile-error) [quote]According to the source (angelscript.h line 664), GetFunctionIdByDecl is deprecated, so you need to #define AS_DEPRECATED to use it[/quote]
  6. Hi all, I'm trying to use angelscript 2.25.1 using gcc 4.7.1 I compiled angelscript without issues. When I try to compile my project that uses angelscript, however, I'm getting this error: [CODE]jarrett@jarrett-g74s:~/projects/myproject$ scons scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... g++ -o build/common/as_wrapper/AngelScript.o -c -I"../lwis/src/engine" -I"../ice_engine/src/engine" src/common/as_wrapper/AngelScript.cpp src/common/as_wrapper/AngelScript.cpp: In member function ‘void as_wrapper::AngelScript::loadScripts()’: src/common/as_wrapper/AngelScript.cpp:85:33: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] src/common/as_wrapper/AngelScript.cpp:87:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] src/common/as_wrapper/AngelScript.cpp:88:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] src/common/as_wrapper/AngelScript.cpp: In member function ‘int as_wrapper::AngelScript::initContext(char*, char*)’: src/common/as_wrapper/AngelScript.cpp:242:20: error: ‘class asIScriptModule’ has no member named ‘GetFunctionIdByDecl’ src/common/as_wrapper/AngelScript.cpp:258:22: error: invalid conversion from ‘int’ to ‘asIScriptFunction*’ [-fpermissive] In file included from src/common/as_wrapper/AngelScript.h:11:0, from src/common/as_wrapper/AngelScript.cpp:8: /usr/local/include/angelscript/angelscript.h:734:26: error: initializing argument 1 of ‘virtual int asIScriptContext::Prepare(asIScriptFunction*)’ [-fpermissive] scons: *** [build/common/as_wrapper/AngelScript.o] Error 1 scons: building terminated because of errors.[/CODE] So basically, it (I guess the compiler) can't find [CODE]GetFunctionIdByDecl[/CODE] function in [CODE]asIScriptModule[/CODE]. I'm pretyt sure it should be there though. Also, the code on lin 242 is: [CODE]int funcId = mod->GetFunctionIdByDecl(function);[/CODE] where 'function' is declared earlier as a 'char*' and 'mod' is of type 'asIScriptModule *mod'. I thought this might be an issue with gcc 4.7.1....but I'm not sure. Does anyone have any ideas? I appreciate any help! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Cheers Jarrett
  7. Oh man, this problem was a nightmare haha. But I finally got it fixed! Solution: 1) Because this is a Camera, I had to use the Conjugate of the rotation Quaternion to fill the matrix that OpenGL used to change the Model View Matrix. 2) Some of the math I was doing when getting the change in mouse coordinates was producing HUGE float values, so I had to cast some of the results to (float) and it was then producing the correct values. Can't say this was a fun problem, but I learned a crap load. Thanks a lot to anyone who looked over the problem! Jarrett
  8. Still can't get it working - everything looks good to me! Here is a quick video of what is happening: http://jarrettchisholm.com/downloads/QuaternionTest.mpeg - To see mouse input, watch from the beginning. - To see to keyboard input (go forward, backward, etc) skip to 0:51 seconds. Again, I appreciate ANY help you guys can offer
  9. [quote name='bluntman' timestamp='1308056343' post='4823196'] Don't think this is your main problem, but your axis angle Quat constructor already converts degrees to radians so you don't need to do it in your code as well (probably better if the axis angle constructor takes radians and doesn't do conversion, as most of the time you don't need to work in degrees, they just add extra calculations). [/quote] That's right, I forgot I did that. I didn't used to do that, but I added it while trying to fix it (which probably didn't help any, eh?). Thanks for catching that (and for looking over the code). Unfortunately, the camera is still not working :S
  10. Hi guys, I'm just starting to work with Quaternions, but I'm having some annoying difficulties getting a simple FPS camera to work properly using Quaternions. Basically, whenever I try to move the mouse, a triangle I draw on the screen goes crazy and moves off and on the screen faster than I can see. Also, the movement keys are not at all working as expected.. Here's my Camera .h file: [code] /* * CameraSceneNode.h * * Created on: 2011-05-08 * Author: jarrett */ #ifndef CAMERASCENENODE_H_ #define CAMERASCENENODE_H_ #include "ICameraSceneNode.h" #include "Quaternion.h" //#include "IInputListener.h" namespace icee { namespace engine { class CameraSceneNode: public ICameraSceneNode { public: CameraSceneNode(); CameraSceneNode(vmath::Vector3f position, vmath::Vector3f lookAt, bool active = true); virtual ~CameraSceneNode(); // inherited from ICameraSceneNode virtual void render(); // don't really need this // inherited from ICameraSceneNode virtual const vmath::Vector3f& getLookAt(); virtual void setLookAt(const vmath::Vector3f& newLookAt); virtual void move(MOVE_DIRECTION dir, bool enabled); // up/down virtual void rotateX(float32 degrees); // left/right virtual void rotateY(float32 degrees); virtual void tick(float32 time); protected: vmath::Vector3f lookAt_; Quaternion rotation_; sint32 prevX_, prevY_; char8 movement_[NUM_MOVE_DIRECTIONS]; float32 moveSpeed_, rotSpeed_; void clearMovementBuffer(); float32 xRot_, yRot_; void initialize(); }; } } #endif /* CAMERASCENENODE_H_ */ [/code] And here's my Camera .cpp file: [code] /* * CameraSceneNode.cpp * * Created on: 2011-05-08 * Author: jarrett */ #include "CameraSceneNode.h" #include "../common/math/Math.h" #include <GL/gl.h> #include <iostream> namespace icee { namespace engine { CameraSceneNode::CameraSceneNode() { setLookAt(vmath::Vector3f(1, 1, 1)); setPosition(vmath::Vector3f(0, 0, 0)); active_ = true; initialize(); } CameraSceneNode::CameraSceneNode(vmath::Vector3f position, vmath::Vector3f lookAt, bool active) { setPosition(position); setLookAt(lookAt); active_ = active; initialize(); } CameraSceneNode::~CameraSceneNode() { } void CameraSceneNode::initialize() { clearMovementBuffer(); xRot_ = 0; yRot_ = 0; moveSpeed_ = 0.25f; rotSpeed_ = 0.01f; } void CameraSceneNode::render() { if (isActive()) { float32 matrix[16]; rotation_.fillMatrix(matrix); glMultMatrixf(&matrix[0]); glTranslatef(-pos_.x, -pos_.y, -pos_.z); } } const vmath::Vector3f& CameraSceneNode::getLookAt() { return lookAt_; } void CameraSceneNode::setLookAt(const vmath::Vector3f& newLookAt) { lookAt_ = newLookAt; } /** * */ void CameraSceneNode::clearMovementBuffer() { for (uint32 i = 0; i < NUM_MOVE_DIRECTIONS; i++) movement_[i] = 0; } /** * */ void CameraSceneNode::move(MOVE_DIRECTION dir, bool enabled) { movement_[dir] = (enabled ? 1 : 0); } // up/down /** * */ void CameraSceneNode::rotateX(float32 degrees) { xRot_ = degrees; } // left/right /** * */ void CameraSceneNode::rotateY(float32 degrees) { yRot_ = degrees; } /** * */ void CameraSceneNode::tick(float32 time) { // movement direction if (movement_[MOVE_DIR_FORWARD] == 1) pos_ += rotation_ * vmath::Vector3f(0, 0, -moveSpeed_ * time); if (movement_[MOVE_DIR_BACKWARD] == 1) pos_ += rotation_ * vmath::Vector3f(0, 0, moveSpeed_ * time); if (movement_[MOVE_DIR_LEFT] == 1) pos_ += rotation_ * vmath::Vector3f(-moveSpeed_ * time, 0, 0); if (movement_[MOVE_DIR_RIGHT] == 1) pos_ += rotation_ * vmath::Vector3f(moveSpeed_ * time, 0, 0); // rotation if (xRot_ != 0) { Quaternion quatRotation = Quaternion(vmath::Vector3f(1, 0, 0), (xRot_ * time * rotSpeed_) * math::DEGTORAD); rotation_ = rotation_ * quatRotation; xRot_ = 0; } if (yRot_ != 0) { Quaternion quatRotation = Quaternion(vmath::Vector3f(0, 1, 0), (yRot_ * time * rotSpeed_) * math::DEGTORAD); rotation_ = quatRotation * rotation_; yRot_ = 0; } } } } [/code] For good measure, here is also my Quaternion implementation: [code] /* * Quaternion.h * * Created on: 2011-05-12 * Author: jarrett */ #ifndef QUATERNION_H_ #define QUATERNION_H_ #include "../vmath/Vector3f.h" #include "../common/math/Math.h" #include <math.h> namespace icee { namespace engine { using namespace compatibility; class Quaternion { private: float32 real_; vmath::Vector3f imaginary_; public: /** * Constructor. */ Quaternion() { real_ = 1; imaginary_ = vmath::Vector3f(0, 0, 0); } /** * Constructor. */ Quaternion(float32 real, float32 x, float32 y, float32 z) { real_ = real; imaginary_ = vmath::Vector3f(x, y, z); } /** * Constructor. */ Quaternion(float32 real, const vmath::Vector3f& imaginary) { real_ = real; imaginary_ = imaginary; } /** * Constructor. * Create this Quaternion from an axis angle. This is useful if you want to use the Quaternion * to rotate through an angle about the axis (unit) vector. The equation for this is: * q = cos(theta/2) + vector*sin(theta/2) */ Quaternion(const vmath::Vector3f& vec, float32 degrees) { buildFromAxisAngle(vec.x, vec.y, vec.z, degrees); /* // convert from degrees to radians float32 angle = ((degrees / 180.0f) * math::PI); float32 sinAngle; angle *= 0.5f; vmath::Vector3f vector(vec); vector.normalize(); sinAngle = sin(angle); imaginary_.x = (vector.x * sinAngle); imaginary_.y = (vector.y * sinAngle); imaginary_.z = (vector.z * sinAngle); real_ = cos(angle); */ } /** * Build this Quaternion from an axis angle. This is useful if you want to use the Quaternion * to rotate through an angle about the axis (unit) vector. The equation for this is: * q = cos(theta/2) + vector*sin(theta/2) */ void buildFromAxisAngle(float32 x, float32 y, float32 z, float32 degrees) { // convert from degrees to radians float32 angle = ((degrees / 180.0f) * math::PI); float32 sinAngle; angle *= 0.5f; //vmath::Vector3f vector(vec); //vector.normalize(); sinAngle = sin(angle); imaginary_.x = (x * sinAngle); imaginary_.y = (y * sinAngle); imaginary_.z = (z * sinAngle); real_ = cos(angle); } /* // Convert from Euler Angles Quaternion(float32 pitch, float32 yaw, float32 roll) { // Basically we create 3 Quaternions, one for pitch, one for yaw, one for roll // and multiply those together. // the calculation below does the same, just shorter float p = pitch * PIOVER180 / 2.0; float y = yaw * PIOVER180 / 2.0; float r = roll * PIOVER180 / 2.0; float sinp = sin(p); float siny = sin(y); float sinr = sin(r); float cosp = cos(p); float cosy = cos(y); float cosr = cos(r); this->x = sinr * cosp * cosy - cosr * sinp * siny; this->y = cosr * sinp * cosy + sinr * cosp * siny; this->z = cosr * cosp * siny - sinr * sinp * cosy; this->w = cosr * cosp * cosy + sinr * sinp * siny; normalise(); } */ /** * Copy constructor. */ Quaternion(const Quaternion &quat) { real_ = quat.real_; imaginary_ = quat.imaginary_; } /** * Destructor. */ virtual ~Quaternion() { } const Quaternion& operator =(const Quaternion &quat) { real_ = quat.real_; imaginary_ = quat.imaginary_; return *this; } const Quaternion operator +(const Quaternion &quat) const { return Quaternion(real_ + quat.real_, imaginary_ + quat.imaginary_); } const Quaternion operator -(const Quaternion &quat) const { return Quaternion(real_ - quat.real_, imaginary_ - quat.imaginary_); } const Quaternion operator *(const Quaternion &quat) const { return Quaternion( real_ * quat.real_ - imaginary_ * quat.imaginary_, imaginary_.y * quat.imaginary_.z - imaginary_.z * quat.imaginary_.y + real_ * quat.imaginary_.x + imaginary_.x * quat.real_, imaginary_.z * quat.imaginary_.x - imaginary_.x * quat.imaginary_.z + real_ * quat.imaginary_.y + imaginary_.y * quat.real_, imaginary_.x * quat.imaginary_.y - imaginary_.y * quat.imaginary_.x + real_ * quat.imaginary_.z + imaginary_.z * quat.real_); } // Multiplying a quaternion q with a vector v applies the q-rotation to v const vmath::Vector3f operator*(const vmath::Vector3f &vec) { vmath::Vector3f vector(vec); vector.normalize(); Quaternion vectorQuat, resultQuat; vectorQuat.imaginary_.x = vector.x; vectorQuat.imaginary_.y = vector.y; vectorQuat.imaginary_.z = vector.z; vectorQuat.real_ = 0.0f; resultQuat = vectorQuat * getConjugate(); resultQuat = *this * resultQuat; return (vmath::Vector3f(resultQuat.imaginary_.x, resultQuat.imaginary_.y, resultQuat.imaginary_.z)); } const Quaternion operator /(const Quaternion &quat) const { Quaternion retQuat(quat); retQuat.invert(); return *this * retQuat; } const Quaternion& operator /=(float32 scale) { real_ /= scale; imaginary_ /= scale; return *this; } void invert() { conjugate(); *this /= lengthSquared(); } void conjugate() { imaginary_ *= (-1.f); } Quaternion getConjugate() { return Quaternion(-imaginary_.x, -imaginary_.y, -imaginary_.z, real_); } float32 length() const { return (float32) (sqrt(real_ * real_ + imaginary_ * imaginary_)); } /** * Get the squared length of this quaternion. */ float32 lengthSquared() { return (float32) (real_ * real_ + imaginary_ * imaginary_); } void normalize() { *this /= length(); } /** * * Fills in Column-Major order. */ void fillMatrix(float32 matrix[]) { // First row matrix[0] = 1.0f - 2.0f * (imaginary_.y * imaginary_.y + imaginary_.z * imaginary_.z); matrix[1] = 2.0f * (imaginary_.x * imaginary_.y + imaginary_.z * real_); matrix[2] = 2.0f * (imaginary_.x * imaginary_.z - imaginary_.y * real_); matrix[3] = 0.0f; // Second row matrix[4] = 2.0f * (imaginary_.x * imaginary_.y - imaginary_.z * real_); matrix[5] = 1.0f - 2.0f * (imaginary_.x * imaginary_.x + imaginary_.z * imaginary_.z); matrix[6] = 2.0f * (imaginary_.z * imaginary_.y + imaginary_.x * real_); matrix[7] = 0.0f; // Third row matrix[8] = 2.0f * (imaginary_.x * imaginary_.z + imaginary_.y * real_); matrix[9] = 2.0f * (imaginary_.y * imaginary_.z - imaginary_.x * real_); matrix[10] = 1.0f - 2.0f * (imaginary_.x * imaginary_.x + imaginary_.y * imaginary_.y); matrix[11] = 0.0f; // Fourth row matrix[12] = 0; matrix[13] = 0; matrix[14] = 0; matrix[15] = 1.0f; } /* // Convert to Matrix Matrix4 getMatrix() const { float x2 = x * x; float y2 = y * y; float z2 = z * z; float xy = x * y; float xz = x * z; float yz = y * z; float wx = w * x; float wy = w * y; float wz = w * z; // This calculation would be a lot more complicated for non-unit length quaternions // Note: The constructor of Matrix4 expects the Matrix in column-major format like expected by // OpenGL return Matrix4( 1.0f - 2.0f * (y2 + z2), 2.0f * (xy - wz), 2.0f * (xz + wy), 0.0f, 2.0f * (xy + wz), 1.0f - 2.0f * (x2 + z2), 2.0f * (yz - wx), 0.0f, 2.0f * (xz - wy), 2.0f * (yz + wx), 1.0f - 2.0f * (x2 + y2), 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) } */ /* // Convert to Axis/Angles void getAxisAngle(Vector3* axis, float* angle) { float scale = sqrt(x * x + y * y + z * z); axis->x = x / scale; axis->y = y / scale; axis->z = z / scale; *angle = acos(w) * 2.0f; } */ }; } } #endif /* QUATERNION_H_ */ [/code] It is important to mention that before CameraSceneNode::render() gets called, the following bit of code is called first: [code] glMatrixMode(GL_MODELVIEW); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); [/code] What happens in my game loop is that CameraSceneNode::tick(..) gets called, which updates the movement/rotation variables. Then after some other code, CameraSceneNode::render() is called. I know that's a lot of code to look over, but I would really appreciate it if anyone could see any (hopefully!) glaring omissions or errors on my part. Also, if something isn't clear just ask! Thanks all, Jarrett
  11. Oh. Thanks makes a lot of sense. Thanks Brother Bob
  12. Thanks Brother Bob and marius1930 for your replies. Hmm, interesting..I thought about that Brother Bob, but I had no idea what the syntax would be. I thought that in order to make the value that is being pointed to constant, you had to put the 'const' before the variable type? As in [code]const char* const* Console::getConsoleOutput() {...}[/code] ? Wouldn't what you have make the pointers that point to the char*'s const, but allow you to change the value they point to? haha I dunno, const confuses me sometines. Still learning c++. I got the above to compile, but don't have time right now to test it. I'll do that in a bit and hopefully it works out Thanks again guys! [quote name='Brother Bob' timestamp='1299576426' post='4783075'] You need to add an additional level of const to your return value. <pre>char const * const *Console::getConsoleOutput() {...}</pre> When automatically adding const to a type of [i]char **[/i], you get [i]char const * const *[/i], not [i]char const **[/i]. If you don't protect the first layer of pointers, you can indirectly change the second layer, which is what you're supposed to protect with the first [i]const[/i]. Consider this (if the second [i]const[/i] wasn't necessary, that is): <pre> char const **foo = myConsole.GetConsoleOutput(); foo[0] = "bar"; </pre> Even though the values of [i]foo[/i] was protected by const, I could change it via a non-const pointer. [/quote]
  13. Hi guys, I'm trying to convert a char** to a const char**, but my compiler is giving me grief. Is this conversion possible?? I have 2 methods, like this: [code] const char** Console::getConsoleOutput() { return this->prevInputs_; } const char* Console::getCurrentInput() { return this->curInput_; } [/code] prevInputs_ is a char** (i.e. array of char*'s) and curInput_ is a char*. The second method, getCurrentInput(), compiles fine. However, the first method, getConsoleOutput() gives me the error: [code]error: invalid conversion from ‘char**’ to ‘const char**’[/code] Is there some way this can be done? I basically don't want any other objects changing the prevInputs_ data. Thanks guys! I appreciate any help you can offer. Jarrett
  14. [quote name='aeroz' timestamp='1299453018' post='4782591'] [quote name='Chisser98' timestamp='1299449890' post='4782571'] I *think* the problem has something to do with the freetype library... [/quote] This could be the cause of the problem. You need to link (statically too, maybe?) the freetype library to your project. [/quote] That's what I thought too. I linked to the freetype library in my project, but no dice. Interestingly, when I link to the SDL_ttf library in /usr/libs it doesn't complain about undefined references of freetype methods, and it also does not require me to link to the freetype library. freakin weird man [quote name='aeroz' timestamp='1299453018' post='4782591'] Did you specify the path /usr/libs manually or has the system detected the library automatically? (what should be the case I think) [/quote] It works without me manually specifying the path.
  15. HAH Okay, so I found that SDL_ttf was already installed via aptitude, and I found the library in /usr/libs. I linked to that SDL_ttf library and *TADA!*, it works! Still have no freaking idea what I did wrong, but it's working now (albeit with an older version of SDL_ttf, but who cares).. Thanks for trying to help me with this one aeroz, I appreciate it. Cheers [quote name='Chisser98' timestamp='1299449890' post='4782571'] Hmm The SDL_ttf library is already added to the c++ linker library (-l), as well as the path to the library (-L). I tried compiling it as a shared (.so) library, but got the same errors. I *think* the problem has something to do with the freetype library...it looks like the errors it's spitting out when I compile my project (the one that uses the SDL_ttf library) is saying that the SDL_ttf.c class can't find certain freetype methods (however, when I compile the SDL_ttf source code I get no such errors). That's why I tried including the freetype library to my project as well, but to no avail. I believe you when you say the SDL-ttf package is typically easy to install, that's what makes this so frustrating I think I'll try a pre-compiled version of SDL_ttf and see if that works [quote name='aeroz' timestamp='1299443848' post='4782525'] Somehow you have to add the library to the project. Have you tried Project=>Properties=>C/C++ Build=>Settings=>GCC C++ Linker=>Libraries, add "SDL_ttf" to the -l box and the path to the library file to -L. Is there a reason not using SDL-ttf as a shared library? In most GNU/Linux distros the SDL-ttf package is very easy to install. [/quote] [/quote]