Jump to content

smashthewindow

Members
  • Posts

    136
  • Joined

  • Last visited

Everything posted by smashthewindow

  1. I want to buy it but their website is **** and doesn't load any pages properly.
  2. Hey guys, Recently I'm thinking of buying a new laptop since I travel a lot. I'm thinking of buying a 15-inch Macbook Pro and using bootcamp on it, but I don't know much about computer hardware. What kind of system configuration would allow Leadwerks to run smoothly? I've an Alienware M15X which I can do all the system intense graphics stuff - I'm only planning to write code & test on the new machine. Thanks for reading.
  3. ActorRegistration objects are created once globally at application initialization and it registers the appropriate constructor and the actor_type ID to the factory. I find this was a lot more easy to maintain than adding switch cases to call constructors. (I've actually got this idea from the book Game Engine Gems and Source Engine.)
  4. Yep, I've coded with templates for the fourth time now... Here's my factory . class ActorRegistrationBase { public: ActorRegistrationBase() { ActorFactory::getInstance()->registerBuilder(this); } virtual ~ActorRegistrationBase() { ActorFactory::getInstance()->deregisterBuilder(this); } virtual int getType() = 0; virtual Actor* createActor( LE::TEntity entity_ ) = 0; private: }; class ActorFactory : public Singleton< ActorFactory > { public: typedef std::map<int,ActorRegistrationBase*> Container; void registerBuilder(ActorRegistrationBase* item_) { items.insert(std::pair<int,ActorRegistrationBase*>(item_->getType(),item_)); } void deregisterBuilder(ActorRegistrationBase* item_) { Container::iterator iter_ = items.find(item_->getType()); items.erase( iter_ ); if(items.empty()) { destroyInstance(); } } Actor* createActor( LE::TEntity entity_, int actor_key_ = 0 ) { if( actor_key_ == 0 ) { actor_key_ = ctoi( LE::GetEntityKey(entity_,"actor_key","0" ) ); } Container::iterator iter_ = items.find( actor_key_ ); if( iter_ != items.end() ) { return iter_->second->createActor( entity_ ); } else { TRACE("ActorRegistrationBase for actor_key %i doesn't exists.", actor_key_ ); ASSERT(true); } } private: friend class Singleton<ActorFactory>; ActorFactory(void); ~ActorFactory(void); Container items; }; template<typename T> class ActorRegistration : public ActorRegistrationBase { public: ActorRegistration( int actor_key_ ) : ActorRegistrationBase(), key( actor_key_ ) { } virtual int getType() { return type; } virtual Actor* createActor( LE::TEntity entity_ ) { Actor* actor_ = new T( entity_ ); MemoryMgr::getInstance()->addActor( actor_ ); return actor_; } private: int key; };
  5. That's what I've tried with the pivot returned from the LE::LoadScene command but that also causes memory problems (specifically a 1-byte memory shift if located under a debugger). I'm thinking that the garbage collection mechanism doesn't go well with C++, and is just better to free them myself.
  6. I was looking for somewhat a semi-automatic way to manage memory utilizing the garbage collector but your method would be better if the ResetFramework is buggy. I hope there is better management in Le3D. Thanks for the replies.
  7. So you keep track of all your LE::TEntity instances?
  8. Ohh. Sorry guys, I made a small mistake in a line. In the main loop, if( LE::KeyHit( LE::KEY_0 ) ) { LE::FreeEntity( mesh ); //LE::ResetFramework(); } that should be if( LE::KeyHit( LE::KEY_0 ) ) { //LE::FreeEntity( mesh ); LE::ResetFramework(); } This throws an exception at LE::ResetFramework() when in debug mode. Could anyone check this again? This may seem trivial, but the crash tends to lead to more memory problems when I do stuff that are more complex in the game.
  9. That is very weird... I'll have to investigate further. Did you test on both debug and release?
  10. In the attached file, there is a very simplified system of how I set up my entity system and abstraction. As you see, if you build the project I've provided and press 0 during in game, the game crashes at ResetFramework() (Whether in debug or release). Below is a small description of how I do things. Actor is a class that modifies an entity in some way. Bombs, traps, characters etc inherits from this class. CallbackRegistration class registers callbacks to the actors. For the base Actor class, FreeEntityCallbackRegistration is inherited as the Actor C++ object needs to be deleted when the entity is freed. Download & change VC dir & compile, and tell me what you think. I'm looking for some quick explanation on why the program crashes and some ways I could fix this. Thank you for all those who are trying to help me. EDIT: File attached. Forgot to press "Attach This File" button. (Why can't I attach 7z archive? Smaller size... )
  11. Not if you bought it before last year then it doesn't show up.
  12. There's been a speed test between STL classes and Doom 3's implementation of the respective classes, STL's classes showed significantly faster speed. I would suggest to use STL for primitive containers such as lists or vectors, which are probably the fastest implementation out there.
  13. As long as this thing is just used internally within the engine I wouldn't mind (Do your magic Josh, you're the genius.). But for the users I think it would be a lot better to use the STL, creating a new system would make it difficult for new users to adapt.
  14. Why not just use STL? Using STL interator isn't that hard, and I find that a lot more people will be familiar with it. (Not sure about that but I'm pretty sure I would be.)
  15. I took a break from coding due to heavy workload on school life, but I finally got to work. I went to finishing the renderer was like the first thing I done when I got back, so here it is. I had to rely on a few OpenGL functions but it's not that heavy. #ifndef GWEN_RENDERERS_LEADWERKS_H #define GWEN_RENDERERS_LEADWERKS_H #include <Gwen/Gwen.h> #include <Gwen/BaseRender.h> #include <engine.h> #include <glGL.h> #include <glGLU.h> namespace Gwen { namespace Renderer { class Leadwerks : public Gwen::Renderer::Base { public: Leadwerks(); ~Leadwerks(); virtual void Begin(); virtual void End(); virtual void SetDrawColor( Color color ); virtual void DrawFilledRect( Gwen::Rect rect ); virtual void LoadTexture( Gwen::Texture* pTexture ); virtual void FreeTexture( Gwen::Texture* pTexture ); virtual void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f ); virtual void LoadFont( Gwen::Font* pFont ); virtual void FreeFont( Gwen::Font* pFont ); virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text ); virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text ); virtual void DrawPixel( int x, int y ); virtual void DrawLinedRect( Gwen::Rect rect ); virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::String& text ); virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::String& text ); private: enum CullMode { CULL_NONE, CULL_DRAW_CCW, CULL_DRAW_CW }; void leglBegin (TCamera camera = NULL, float zoom = 1.0f, CullMode cm = CULL_DRAW_CCW); void leglEnd (bool was3D = false); void leglBindTexture(TTexture texture); }; } } #endif #include "Renderer.h" #include <GwenUtility.h> #include <GwenTexture.h> #include <engine.h> namespace Gwen { namespace Renderer { Leadwerks::Leadwerks() { } Leadwerks::~Leadwerks() { } void Leadwerks::Begin() { LE::SetBlend(1); } void Leadwerks::End() { LE::SetBlend(0); } void Leadwerks::SetDrawColor( Color color ) { LE::TVec4 c; c.X = color.r/255; c.Y = color.g/255; c.Z = color.b/255; c.W = color.a/255; LE::SetColor( c ); } void Leadwerks::DrawFilledRect( Gwen::Rect rect ) { Translate( rect ); if( rect.w == 1 && rect.h == 1 ) { LE::Plot( rect.x, rect.y ); return; } if( rect.w == 1 ) { LE::DrawLine( rect.x, rect.y, rect.x, rect.y + rect.h ); return; } if( rect.h == 1 ) { LE::DrawLine( rect.x, rect.y, rect.x + rect.w, rect.y ); return; } LE::DrawRect( rect.x, rect.y, rect.w, rect.h ); } void Leadwerks::LoadTexture( Gwen::Texture* pTexture ) { BP tex = LE::LoadTexture( pTexture->name.Get().c_str() ); pTexture->data = tex; pTexture->failed = (tex == nullptr); if( tex != nullptr ) { pTexture->width = LE::TextureWidth( tex ); pTexture->height = LE::TextureHeight( tex ); } } void Leadwerks::FreeTexture( Gwen::Texture* pTexture ) { LE::FreeTexture( (BP)pTexture->data ); } void Leadwerks::DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1, float v1, float u2, float v2 ) { Translate( pTargetRect ); leglBegin(); leglBindTexture( (BP)pTexture->data ); glBegin( GL_QUADS ); glTexCoord2f(u2, v2); glVertex2i(pTargetRect.x + pTargetRect.w, pTargetRect.y + pTargetRect.h); glTexCoord2f(u2, v1); glVertex2i(pTargetRect.x + pTargetRect.w, pTargetRect.y); glTexCoord2f(u1, v1); glVertex2i(pTargetRect.x, pTargetRect.y ); glTexCoord2f(u1, v2); glVertex2i(pTargetRect.x, pTargetRect.y + pTargetRect.h ); glEnd(); leglBindTexture(NULL); leglEnd(); } void Leadwerks::LoadFont( Gwen::Font* pFont ) { if( Gwen::Utility::UnicodeToString(pFont->facename) != "Default" ) { TFont font = LE::LoadFont( Gwen::Utility::UnicodeToString(pFont->facename).c_str() ); LE::SetFont(font); pFont->data = font; } pFont->size = LE::FontHeight(); } void Leadwerks::FreeFont( Gwen::Font* pFont ) { if( pFont->data ) LE::FreeFont( (BP)pFont->data ); } void Leadwerks::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text ) { RenderText( pFont, pos, Gwen::Utility::UnicodeToString(text) ); } Gwen::Point Leadwerks::MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text ) { return MeasureText( pFont, Gwen::Utility::UnicodeToString(text) ); } void Leadwerks::DrawLinedRect( Gwen::Rect rect ) { Translate( rect ); LE::DrawLine( rect.x + 1, rect.y, rect.x + rect.w - 1, rect.y ); LE::DrawLine( rect.x + rect.w, rect.y, rect.x + rect.w, rect.y + rect.h ); LE::DrawLine( rect.x + rect.w - 1, rect.y + rect.h, rect.x + 1, rect.y + rect.h ); LE::DrawLine( rect.x, rect.y + rect.h, rect.x, rect.y ); } void Leadwerks::DrawPixel( int x, int y ) { Translate( x, y ); LE::Plot( x, y ); } Gwen::Point Leadwerks::MeasureText( Gwen::Font* pFont, const Gwen::String& text ) { if( pFont->data ) LoadFont( pFont ); return Gwen::Point( LE::TextWidth( text.c_str()), LE::FontHeight() ); } void Leadwerks::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::String& text ) { Translate( pos.x, pos.y ); if( pFont->data ) LoadFont( pFont ); LE::DrawTextA( pos.x, pos.y, text.c_str() ); } void Leadwerks::leglBegin(TCamera camera, float zoom, CullMode cm) { // Setup projetion according to argument if (NULL != camera) { // Save current projection matrix. Then reset glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); // Calculate the view frustum float nearRange, farRange; GetCameraRange(camera, nearRange, farRange); float theta = 1.0f / zoom; // tan(45°) = 1.0f float aspect = float(BufferWidth(CurrentBuffer()))/BufferHeight(CurrentBuffer()); glFrustum (-nearRange*theta, nearRange*theta, -nearRange/aspect*theta, nearRange/aspect*theta, nearRange,farRange); // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); // LE uses a differently handed coordinate system than ogl does glScalef(1.0f, 1.0f, -1.0f); // Calculate the LookAt vectors (camera direction and up vector)... TVec3 from = EntityPosition(camera, true); TVec3 to = {0,0,-1}; to = TFormVector(to, camera, NULL); to += from; TVec3 up = {0,1,0}; up = TFormVector(up, camera, NULL); // Set LookAt gluLookAt(from.X, from.Y, from.Z, to.X, to.Y , to.Z, up.X, up.Y, up.Z); } else { glPushMatrix(); // Set orthographic projection (used for 2D drawing) // Get the current viewport/buffer size. int vPort[4]; glGetIntegerv(GL_VIEWPORT, vPort); // Set the projection gluOrtho2D(0, vPort[2], vPort[3], 0); // like glOrtho(0, vPort[2], vPort[3], 0, -1, 1); // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); } // Setup default drawing settings. // Alpha blending. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Backface culling. if (CULL_NONE != cm)glEnable(GL_CULL_FACE); if (NULL != camera)glCullFace((CULL_DRAW_CCW == cm) ? GL_BACK : GL_FRONT); else glCullFace((CULL_DRAW_CCW == cm) ? GL_FRONT : GL_BACK); // Depth test for 3D projection if (NULL != camera)glEnable(GL_DEPTH_TEST); // Drawing color. glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } // Use NULL (0) for the texture to reset (bind no texture) void Leadwerks::leglBindTexture(TTexture texture) { if(NULL != texture) { glEnable(GL_TEXTURE_2D); BindTexture(texture, 0); // LE command. } else { glBindTexture(GL_TEXTURE_2D, NULL); glDisable(GL_TEXTURE_2D); } } // End drawing. Set "was3D" to true if you specified a camera at leglBegin (= used 3D projection). void Leadwerks::leglEnd(bool was3D) { // Undo changes only made in 3D mode (camera != NULL) if (was3D) { glMatrixMode(GL_PROJECTION); glPopMatrix(); glDisable(GL_DEPTH_TEST); } else glPopMatrix(); // Reset transformation. glMatrixMode(GL_MODELVIEW); glPopMatrix(); // Undo changed settings. glDisable(GL_BLEND); glCullFace(GL_BACK); glDisable(GL_CULL_FACE); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); leglBindTexture(NULL); } } } /* GWEN Copyright (c) 2011 Facepunch Studios See license in Gwen.h */ #ifndef GWEN_INPUT_LEADWERKS_H #define GWEN_INPUT_LEADWERKS_H #include "Gwen/InputHandler.h" #include "Gwen/Gwen.h" #include "Gwen/Controls/Canvas.h" #include <engine.h> namespace Gwen { namespace Input { class Leadwerks { public: Leadwerks() { m_Canvas = NULL; m_MouseX = 0; m_MouseY = 0; m_MouseZ = 0; m_LMouseDown = false; m_RMouseDown = false; m_MMouseDown = false; } void Initialize( Gwen::Controls::Canvas* c ) { m_Canvas = c; } bool ProcessMessage( void ) { if ( !m_Canvas ) return false; if( m_MouseX != LE::MouseX() || m_MouseY != LE::MouseY() ) { int dx = LE::MouseX() - m_MouseX; int dy = LE::MouseY() - m_MouseY; m_MouseX = LE::MouseX(); m_MouseY = LE::MouseY(); return m_Canvas->InputMouseMoved( LE::MouseX(), LE::MouseY(), dx, dy ); } //TODO:: Charatcer input if( m_MouseZ != LE::MouseZ() ) { int dz = LE::MouseZ() - m_MouseZ; return m_Canvas->InputMouseWheel( dz ); } if( m_LMouseDown != LE::MouseDown( LE::MOUSE_LEFT ) ) { m_LMouseDown = LE::MouseDown( LE::MOUSE_LEFT ); return m_Canvas->InputMouseButton( 0, m_LMouseDown ); } if( m_RMouseDown != LE::MouseDown( LE::MOUSE_RIGHT ) ) { m_RMouseDown = LE::MouseDown( LE::MOUSE_RIGHT ); return m_Canvas->InputMouseButton( 1, m_RMouseDown ); } if( m_MMouseDown != LE::MouseDown( LE::MOUSE_MIDDLE ) ) { m_MMouseDown = LE::MouseDown( LE::MOUSE_MIDDLE ); return m_Canvas->InputMouseButton( 2, m_MMouseDown ); } //KEY INPUT if( LE::KeyHit( LE::KEY_RSHIFT ) || LE::KeyHit( LE::KEY_LSHIFT ) ) { bool down = LE::KeyDown( LE::KEY_RSHIFT ) || LE::KeyDown( LE::KEY_LSHIFT ); return m_Canvas->InputKey( Gwen::Key::Shift, down ); } if( LE::KeyHit( LE::KEY_ENTER ) ) { bool down = LE::KeyDown( LE::KEY_ENTER ); return m_Canvas->InputKey( Gwen::Key::Return, down ); } if( LE::KeyHit( LE::KEY_BACKSPACE ) ) { bool down = LE::KeyDown( LE::KEY_BACKSPACE ); return m_Canvas->InputKey( Gwen::Key::Backspace, down ); } if( LE::KeyHit( LE::KEY_DELETE ) ) { bool down = LE::KeyDown( LE::KEY_DELETE ); return m_Canvas->InputKey( Gwen::Key::Delete, down ); } if( LE::KeyHit( LE::KEY_LEFT ) ) { bool down = LE::KeyDown( LE::KEY_LEFT ); return m_Canvas->InputKey( Gwen::Key::Left, down ); } if( LE::KeyHit( LE::KEY_RIGHT ) ) { bool down = LE::KeyDown( LE::KEY_RIGHT ); return m_Canvas->InputKey( Gwen::Key::Right, down ); } if( LE::KeyHit( LE::KEY_TAB ) ) { bool down = LE::KeyDown( LE::KEY_TAB ); return m_Canvas->InputKey( Gwen::Key::Tab, down ); } if( LE::KeyHit( LE::KEY_SPACE ) ) { bool down = LE::KeyDown( LE::KEY_SPACE ); return m_Canvas->InputKey( Gwen::Key::Space, down ); } if( LE::KeyHit( LE::KEY_HOME ) ) { bool down = LE::KeyDown( LE::KEY_HOME ); return m_Canvas->InputKey( Gwen::Key::Home, down ); } if( LE::KeyHit( LE::KEY_END ) ) { bool down = LE::KeyDown( LE::KEY_END ); return m_Canvas->InputKey( Gwen::Key::End, down ); } if( LE::KeyHit( LE::KEY_RCONTROL ) || LE::KeyHit( LE::KEY_LCONTROL ) ) { bool down = LE::KeyDown( LE::KEY_RCONTROL ) || LE::KeyDown( LE::KEY_LCONTROL ); return m_Canvas->InputKey( Gwen::Key::Control, down ); } if( LE::KeyHit( LE::KEY_UP ) ) { bool down = LE::KeyDown( LE::KEY_UP ); return m_Canvas->InputKey( Gwen::Key::Up, down ); } if( LE::KeyHit( LE::KEY_DOWN ) ) { bool down = LE::KeyDown( LE::KEY_DOWN ); return m_Canvas->InputKey( Gwen::Key::Down, down ); } return false; } protected: Gwen::Controls::Canvas* m_Canvas; int m_MouseX; int m_MouseY; int m_MouseZ; bool m_LMouseDown; bool m_RMouseDown; bool m_MMouseDown; }; } } #endif Big thanks to Masterxilo who wrote the OpenGL tutorial over here.
  16. If you know what you're doing, sure go ahead, use inline ASM. (It would probably make it unreadable to other programmers though.) I have a bit of reverse-engineering background, so I use IDA/OllyDbg frequently to investigate calls & gain understanding of what's happening. (But I never use inline ASM to actually code stuff.)
  17. If you main game is going to be in C++, I would suggest that you program every major part of the game (characters, events etc) in C++. Lua should be used to program smaller, additional behaviours (opening doors, etc).
  18. I highly doubt creating a weapon system is hard. Just create a class that holds information on damage, range, fire mode, etc. Then you would need to create basic state machine system for fire, reload, or whatever else you need.
  19. Just integrated the buffer-based system on GWEN... I'm having terrible FPS though. Maybe you aren't suppose to use buffer method extensively (for example, like a complete GUI, where you would do this process multiple times in a single frame).
  20. I've searched everywhere to achieve the samething while writing a GWEN Leadwerks renderer. I believe this cannot be achieved with only pure Leadwerks command set, although using OpenGL is an option.
  21. GWEN is a GUI system written by Garry Newman, creator of Garry's Mod. I was in the process of writing a GWEN Leadwerks Renderer using only native commands (unlike all the other libraries out there), but is leaving at it's current progress. The main reason is the inability to crop textures only using native Leadwerks commands. (Using OpenGL is a solution though.) Even though not all the features are converted to Leadwerks, below library is more than enough to write a beautiful imageless GUI in Leadwerks. (Which is basically what I want ) I'm posting it here in hopes of someone benefiting out of this in some way. The Header. #ifndef GWEN_RENDERERS_LEADWERKS_H #define GWEN_RENDERERS_LEADWERKS_H #include "Gwen/Gwen.h" #include "Gwen/BaseRender.h" namespace Gwen { namespace Renderer { class Leadwerks : public Gwen::Renderer::Base { public: Leadwerks(); ~Leadwerks(); virtual void Begin(); virtual void End(); virtual void SetDrawColor( Color color ); virtual void DrawFilledRect( Gwen::Rect rect ); virtual void LoadTexture( Gwen::Texture* pTexture ); virtual void FreeTexture( Gwen::Texture* pTexture ); virtual void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f ); virtual void LoadFont( Gwen::Font* pFont ); virtual void FreeFont( Gwen::Font* pFont ); virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text ); virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text ); virtual void DrawPixel( int x, int y ); virtual Gwen::Point MeasureText( Gwen::Font* pFont, const Gwen::String& text ); virtual void RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::String& text ); }; } } #endif And the cpp file. Make sure to read comments . #include <GwenRenderersLeadwerks.h> #include <GwenUtility.h> #include <GwenTexture.h> #include <engine.h> namespace Gwen { namespace Renderer { Leadwerks::Leadwerks() { } Leadwerks::~Leadwerks() { } void Leadwerks::Begin() { LE::SetBlend(1); } void Leadwerks::End() { LE::SetBlend(0); } void Leadwerks::SetDrawColor( Color color ) { LE::TVec4 c; c.X = color.r/255; c.Y = color.g/255; c.Z = color.b/255; c.W = color.a/255; LE::SetColor( c ); } void Leadwerks::DrawFilledRect( Gwen::Rect rect ) { Translate( rect ); if( rect.w == 1 ) { LE::DrawLine( rect.x, rect.y, rect.x, rect.y + rect.h ); return; } if( rect.h == 1 ) { LE::DrawLine( rect.x, rect.y, rect.x + rect.w, rect.y ); return; } LE::DrawRect( rect.x, rect.y, rect.w, rect.h ); } void Leadwerks::LoadTexture( Gwen::Texture* pTexture ) { BP tex = LE::LoadTexture( pTexture->name.Get().c_str() ); pTexture->data = tex; pTexture->failed = (tex == nullptr); pTexture->width = LE::TextureWidth( tex ); pTexture->height = LE::TextureHeight( tex ); } void Leadwerks::FreeTexture( Gwen::Texture* pTexture ) { LE::FreeTexture( (BP)pTexture->data ); } void Leadwerks::DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1, float v1, float u2, float v2 ) { //Ignore this function. Right now you can't crop textures in Leadwerks. /* Translate( pTargetRect ); LE::DrawImage( (BP)pTexture->data, pTargetRect.x, pTargetRect.y, pTargetRect.w, pTargetRect.h ); */ } void Leadwerks::LoadFont( Gwen::Font* pFont ) { //Uncomment the lines below if you're going to use Leadwerks fonts. //I personally prefer the default font better... /* TFont font = LE::LoadFont( Gwen::Utility::UnicodeToString(pFont->facename).c_str() ); LE::SetFont(font); pFont->data = font; */ pFont->realsize = LE::FontHeight(); } void Leadwerks::FreeFont( Gwen::Font* pFont ) { if( pFont->data ) LE::FreeFont( (BP)pFont->data ); } void Leadwerks::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::UnicodeString& text ) { RenderText( pFont, pos, Gwen::Utility::UnicodeToString(text) ); } Gwen::Point Leadwerks::MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text ) { return MeasureText( pFont, Gwen::Utility::UnicodeToString(text) ); } void Leadwerks::DrawPixel( int x, int y ) { Translate( x, y ); LE::Plot( x, y ); } Gwen::Point Leadwerks::MeasureText( Gwen::Font* pFont, const Gwen::String& text ) { if( pFont->data ) LoadFont( pFont ); return Gwen::Point( LE::TextWidth( text.c_str()), LE::FontHeight() ); } void Leadwerks::RenderText( Gwen::Font* pFont, Gwen::Point pos, const Gwen::String& text ) { Translate( pos.x, pos.y ); if( pFont->data ) LoadFont( pFont ); LE::DrawTextA( pos.x, pos.y, text.c_str() ); } } }
  22. You probably should fix your time keeping too. Different framerates will cause different timings on your current solution.
  23. Well if that's the case it's no problem for me, as I'm just trying to scale simple spheres anyways. Thanks for the reply.
  24. I'm trying to recreate something like the mushroom effect in Super Mario game. (Mario turns bigger.) But in my case, I have to scale a model entity. I began searching the API, and I found this page. Is there any specific reason for this? (eg: the collision information does not get scaled, etc)
×
×
  • Create New...