-
Posts
24,629 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Josh
-
If you're comfortable using BlitzMax, I don't see any reason to change. If I was making a PC game my personal preference would be to definitely use that with LE3, over C# or C++. It's more cross-platform compatible with less mess. Of course, LE3's implementation of Lua has the best cross-platform support, based on the fact it works without having to install any separate compilers or IDEs, and it runs the same on everything. With the LE3 Lua debugger I hope it will be useful for more complex programming. I like it because I have complete control and can provide a programming environment with no reliance on third party software or compilers.
-
You can have vertices in a model that aren't connected to anything. If your modeling program deletes unused vertices, you could always make a triangle with three verts in the same position.
-
It's very hard for us to tell what the problem is without seeing the actual model, but from your description it sounds like the model is moving out of its original bounds, and is being culled. Add a couple of dummy vertices to increase the size of the model's bounding box so it doesn't get culled.
-
There's no need for the community to implement this because I have the include file I am using for the editor. It just calls the C API, so there's no need for separate docs in BMX syntax. The C API is what the DLL exposes, so you just look at the docs and it matches the BMX commands. I am interested in getting a Leadwerks Engine 3 subforum in the BMX modules forum category, and I'll write Mark and ask when the time is closer. SuperStrict Import brl.pngloader Import "le3.lib" Import "le_const.bmx" Import "le_types.bmx" Extern "c" 'General 'Function leSetHook(hookid:Int,hook:Byte Ptr)="SetHook" Function leGetLogText_(char:Byte Ptr,length:Int)="GetLogText" 'Bank Function lePeekBankByte:Int(bank:LEBank,position:Int)="PeekBankByte" Function leGetBankSize:Int(bank:LEBank)="GetBankSize" Function leGetBankBuffer:Byte Ptr(bank:LEBank)="GetBankBuffer" 'Network Function leCreateServer:leServer(port:Int)="CreateServer" Function leUpdateServer:leMessage(server:leServer,timeout:Int)="UpdateServer" Function leDisconnectServer(server:leServer,client:LEPeer,force:Int)="DisconnectServer" Function leSendServer:Int(server:leServer,client:LEPeer,messageid:Int,date:Byte Ptr,size:Int,channel:Int,flags:Int)="SendServer" 'Window Function leCreateWindow:leWindow(title$z,width:Int,height:Int,style:Int)="CreateWindow" Function leCreateCustomWindow:leWindow(hwnd:Int)="CreateCustomWindow" Function leGetWindowWidth:Int(window:leWindow)="GetWindowWidth" Function leGetWindowHeight:Int(window:leWindow)="GetWindowHeight" Function leSetWindowShape(window:LEWindow,x:Int,y:Int,width:Int,height:Int)="SetWindowShape" Function leFreeWindow(window:leWindow)="FreeWindow" 'Graphics driver Function leSetGraphicsDriver(graphicsdriver:LEGraphicsDriver)="SetGraphicsDriver" Function leCreateOpenGL1GraphicsDriver:LEOpenGL1GraphicsDriver()="CreateOpenGL1GraphicsDriver" Function leCreateOpenGL3GraphicsDriver:LEOpenGL3GraphicsDriver()="CreateOpenGL3GraphicsDriver" Function leGetGraphicsDriver:LEGraphicsDriver()="GetGraphicsDriver" Function leGetGraphicsDriverName_:Int(graphicsdriver:LEGraphicsDriver,name:Byte Ptr,length:Int)="GetGraphicsDriverName" Function leGetGraphicsDriverVendor:Int(graphicsdriver:LEGraphicsDriver)="GetGraphicsDriverVendor" Function leGraphicsDriverSupported:Int(graphicsdriver:LEGraphicsDriver)="GraphicsDriverSupported" Function leBuffersSupported:Int()="BuffersSupported" 'File system Function leSetDir(path$z)="SetDir" 'Context Function leCreateContext:LEContext(window:LEWindow,multisamplemode:Int)="CreateContext" Function leSwapContext(context:LEContext,sync:Int)="SwapContext" 'Function leFreeContext(context:LEContext)="FreeContext" 'Buffer Function leCreateBuffer:LEBuffer(width:Int,height:Int,colortextures:Int,depthtexture:Int,multisamplemode:Int)="CreateBuffer" Function leClearBuffer(Buffer:LEBuffer,Mode:Int)="ClearBuffer" Function leGetBufferColorTexture:LETexture(Buffer:LEBuffer,index:Int)="GetBufferColorTexture" Function leGetBufferDepthTexture:LETexture(Buffer:LEBuffer)="GetBufferDepthTexture" Function leGetBuffer:LEBuffer()="GetBuffer" Function leGetBufferWidth:Int(buffer:LEBuffer)="GetBufferWidth" Function leGetBufferHeight:Int(buffer:LEBuffer)="GetBufferHeight" Function leSetBuffer(Buffer:LEBuffer)="SetBuffer" Function leFreeBuffer(Buffer:LEBuffer)="FreeBuffer" Function leGetBufferPixels(buffer:LEBuffer,buf:Byte Ptr,component:Int)="GetBufferPixels" 'World Function leCreateWorld:LEWorld()="CreateWorld" Function leSetWorld(World:LEWorld)="SetWorld" Function leGetWorld:LEWorld()="GetWorld" Function leRenderWorld()="RenderWorld" Function leFreeWorld(World:LEWorld)="FreeWorld" Function leSetWorldAmbientLight(world:LEWorld,r:Float,g:Float,b:Float,a:Float)="SetWorldAmbientLight" 'Entity Function leSetEntityPosition(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="SetEntityPosition" Function leSetEntityRotation(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="SetEntityRotation" Function leGetEntityPosition(entity:LEEntity,rotation:Byte Ptr,glb:Int)="GetEntityPosition" Function leGetEntityRotation(entity:LEEntity,rotation:Byte Ptr,glb:Int)="GetEntityRotation" Function leGetEntityMatrix(entity:LEEntity,matrix:Byte Ptr)="GetEntityMatrix" Function leMoveEntity(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="MoveEntity" Function leTurnEntity(entity:LEEntity,x:Float,y:Float,z:Float,glb:Int)="TurnEntity" Function leAlignEntityToVector(entity:LEEntity,x:Float,y:Float,z:Float,axis:Int,rate:Float,roll:Float)="AlignEntityToVector" Function leSetEntityMaterial(entity:LEEntity,material:LEMaterial)="SetEntityMaterial" Function leFreeEntity(entity:LEEntity)="FreeEntity" Function leHideEntity(entity:LEEntity)="HideEntity" Function leShowEntity(entity:LEEntity)="ShowEntity" Function leGetEntityAABB(entity:LEEntity,aabb:Byte Ptr,Mode:Int)="GetEntityAABB" Function leCountEntityChildren(entity:LEEntity)="CountEntityChildren" Function leGetEntityChild(entity:LEEntity,n:Int)="GetEntityChild" Function leSetEntityParent(entity:LEEntity,parent:LEEntity,glb:Int)="SetEntityParent" Function leEntityHidden:Int(entity:LEEntity)="EntityHidden" 'Pivot Function leCreatePivot:LEPivot(parent:LEEntity)="CreatePivot" 'Camera Function leCreateCamera_:LECamera(parent:LEEntity)="CreateCamera" Function leSetCameraProjectionMode(Camera:LECamera,projectionmode:Int)="SetCameraProjectionMode" Function leGetCameraProjectionMode:Int(Camera:LECamera)="GetCameraProjectionMode" Function leSetCameraClearColor(Camera:LECamera,r:Float,g:Float,b:Float,a:Float)="SetCameraClearColor" Function leGetCameraClearColor(Camera:LECamera,color:TVec4)="GetCameraClearColor" Function leSetCameraZoom(Camera:LECamera,zoom:Float)="SetCameraZoom" Function leGetCameraZoom:Float(Camera:LECamera)="GetCameraZoom" Function leSetCameraDrawMode(Camera:LECamera,Mode:Int)="SetCameraDrawMode" Function leSetCameraRange(camera:LECamera,nearrange:Float,farrange:Float)="SetCameraRange" Function leGetCameraRange(camera:LECamera,Range:Byte Ptr)="GetCameraRange" Function leSetCameraFOV(camera:LECamera,fov:Float)="SetCameraFOV" Function leGetCameraFOV:Float(camera:LECamera)="GetCameraFOV" Function leSetCameraMotionBlurMode(camera:LECamera,mode:Int)="SetCameraMotionBlurMode" Function leSetCameraViewport(camera:LECamera,x:Float,y:Float,width:Float,height:Float)="SetCameraViewport" Function leGetCameraViewport(camera:LECamera,viewport:Byte Ptr)="GetCameraViewport" 'Light Function leCreateDirectionalLight:LEDirectionalLight(parent:LEEntity)="CreateDirectionalLight" 'Model Function leLoadModel:LEModel(path$z,flags:Int)="LoadModel" Function leCreateModelSphere:LEModel(sides:Int)="CreateModelSphere" Function leCreateCube:LEModel(parent:LEEntity)="CreateCube" Function leFlipModelNormals(model:LEModel)="FlipModelNormals" 'Function leCreateModelSphere:Byte Ptr(sides:Int)="CreateModelSphere" 'Timing Function leUPS:Float()="UPS" Function leUpdateTime()="UpdateTime" 'Font Function leLoadfont:LEFont(path$z,size:Int,style:Int,family:Int)="LoadFont" Function leDrawFontText(font:LEFont,text$z,x:Int,y:Int,kerning:Float)="DrawFontText" Function leGetFontTextWidth(font:LEFont,text$z)="GetFontTextWidth" Function leGetFontHeight(font:LEFont)="GetFontHeight" Function leFreeFont(font:LEFont)="FreeFont" 'Drawing Function leDrawLine(x0:Int,y0:Int,x1:Int,y1:Int)="DrawLine" Function leDrawRect(x:Int,y:Int,width:Int,height:Int,style:Int)="DrawRect" Function leDrawImage(image:LETexture,x:Int,y:Int,width:Int,height:Int)="DrawImage" Function leSetBlendMode(blendmode:Int)="SetBlendMode" Function leSetColor(r:Float,g:Float,b:Float,a:Float)="SetColor" Function leSetClearColor(r:Float,g:Float,b:Float,a:Float)="SetClearColor" Function leSetScale(x:Float,y:Float)="SetScale" Function leSetRotation(rotation:Float)="SetRotation" Function leSetTranslation(x:Float,y:Float)="SetTranslation" Function leTileImage(texture:LETexture)="TileImage" Function leSetViewport(x:Int,y:Int,width:Int,height:Int)="SetViewport" 'Asset Function leGetAssetName_:Int(asset:LEAsset,name:Byte Ptr,length:Int)="GetAssetName" Function leGetAssetAssetReference:LEAssetReference(asset:LEAsset)="GetAssetAssetReference" Function leReloadAsset:Int(asset:LEAsset,flags:Int)="ReloadAsset" 'Asset Reference Function leFindAssetReference:LEAssetReference(name$z)="FindAssetReference" Function leReloadAssetReference:Int(assetreference:LEAssetReference,flags:Int)="ReloadAssetReference" Function leSetAssetReferenceName(assetreference:LEAssetReference,name$z)="SetAssetReferenceName" 'Texture Function leCreatetexture:LETexture(width:Int,height:Int,format:Int,flags:Int,frames:Int)="CreateTexture" Function leLoadTexture_:LETexture(path$z,flags:Int)="LoadTexture" Function leGetTextureTarget:Int(texture:LETexture)="GetTextureTarget" 'Function leLockTexture(texture:LETexture,miplevel:Int,framenumber:Int)="LockTexture" 'Function leUnlockTexture(texture:LETexture,miplevel:Int,framenumber:Int)="UnlockTexture" 'Function leWriteTexturePixel(texture:LETexture,x:Int,y:Int,r:Int,g:Int,b:Int,a:Int,miplevel:Int,framenumber:Int)="WriteTexturePixel" 'Function leReadTexturePixel:Int(texture:LETexture,x:Int,y:Int,miplevel:Int,framenumber:Int)="ReadTexturePixel" Function leGetTexturePixels(texture:LETexture,buf:Byte Ptr,miplevel:Int,framenumber:Int,face:Int)="GetTexturePixels" Function leSetTexturePixels(texture:LETexture,buf:Byte Ptr,miplevel:Int,framenumber:Int,face:Int)="SetTexturePixels" Function leGetTextureWidth(texture:LETexture,miplevel:Int)="GetTextureWidth" Function leGetTextureHeight(texture:LETexture,miplevel:Int)="GetTextureHeight" Function leSetTextureFilter(texture:LETexture,texturefilter:Int)="SetTextureFilter" Function leFreeTexture(texture:LETexture)="FreeTexture" 'Function leTextureLocked(texture:LETexture,miplevel:Int,framenumber:Int)="TextureLocked" 'Function leReloadTexture:Int(texture:LETexture,flags:Int)="ReloadTexture" Function leBindTexture(texture:LETexture,index:Int)="BindTexture" Function leGetTextureData:Byte Ptr(texture:LETexture,miplevel:Int,framenumber:Int)="GetTextureData" Function leCountTextureMipmaps:Int(texture:LETexture)="CountTextureMipmaps" Function leGetTextureMipmapSize:Int(texture:LETexture)="GetTextureMipmapSize" Function leGetTextureFormat:Int(texture:LETexture)="GetTextureFormat" Function leSetTextureClampMode(texture:LETexture,x:Int,y:Int,z:Int)="SetTextureClampMode" Function leGetTextureClampMode:Int(texture:LETexture,axis:Int)="GetTextureClampMode" Function leGetTextureAnisotropy:Float(texture:LETexture)="GetTextureAnisotropy" Function leSetTextureAnisotropy(texture:LETexture,anisotropy:Float)="SetTextureAnisotropy" 'Shader Function leLoadshader:LEShader(path$z,flags:Int)="LoadShader" Function leSetShader(shader:LEShader)="SetShader" 'Function leReloadShader:Int(shader:LEShader,flags:Int)="ReloadShader" Function leSetShaderFloat:Int(shader:LEShader,name$z,f:Float)="SetShaderFloat" Function leSetShaderVec2:Int(shader:LEShader,name$z,x:Float,y:Float)="SetShaderVec2" Function leSetShaderVec4:Int(shader:LEShader,name$z,x:Float,y:Float,z:Float,w:Float)="SetShaderVec4" Function leSetShaderMat4:Int(shader:LEShader,name$z,mat:Byte Ptr)="SetShaderMat4" Function leFreeShader(shader:LEShader)="FreeShader" Function leSetShaderSource(shader:LEShader,source$z,n:Int)="SetShaderSource" Function leGetShaderSource_:Int(shader:LEShader,n:Int,s:Byte Ptr,l:Int)="GetShaderSource" Function leGetShaderError_:Int(shader:LEShader,s:Byte Ptr,l:Int)="GetShaderError" Function leCompileShader:Int(shader:LEShader,n:Int)="CompileShader" Function leLinkShader:Int(shader:LEShader)="LinkShader" Function leCreateShader:LEShader()="CreateShader" 'Material Function leLoadmaterial:LEMaterial(path$z,flags:Int)="LoadMaterial" Function leChooseMaterialShader:LEShader(material:LEMaterial)="ChooseMaterialShader" Function leGetMaterialTexture:LETexture(material:LEMaterial,index:Int)="GetMaterialTexture" Function leSetMaterialShader(material:LEMaterial,shader:LEShader)="SetMaterialShader" Function leGetMaterialShader:LEShader(material:LEMaterial)="GetMaterialShader" Function leSetMaterialTexture(material:LEMaterial,texture:LETexture,index:Int)="SetMaterialTexture" Function leFreeMaterial(material:LEMaterial)="FreeMaterial" Function leSetMaterialBlendMode(material:LEMaterial,mode:Int)="SetMaterialBlendMode" Function leGetMaterialBlendMode:Int(material:LEMaterial)="GetMaterialBlendMode" Function leSetMaterialShadowMode(material:LEMaterial,mode:Int)="SetMaterialShadowMode" Function leGetMaterialShadowMode:Int(material:LEMaterial)="GetMaterialShadowMode" Function leSetMaterialBackFaceCullMode(material:LEMaterial,mode:Int)="SetMaterialBackFaceCullMode" Function leGetMaterialBackFaceCullMode:Int(material:LEMaterial)="GetMaterialBackFaceCullMode" Function leSetMaterialZSortMode(material:LEMaterial,mode:Int)="SetMaterialZSortMode" Function leGetMaterialZSortMode:Int(material:LEMaterial)="GetMaterialZSortMode" Function leSetMaterialDepthTestMode(material:LEMaterial,mode:Int)="SetMaterialDepthTestMode" Function leGetMaterialDepthTestMode:Int(material:LEMaterial)="GetMaterialDepthTestMode" Function leSetMaterialFloat(material:LEMaterial,name$z,x:Float)="SetMaterialFloat" Function leSetMaterialVec2(material:LEMaterial,name$z,x:Float,y:Float)="SetMaterialVec2" Function leSetMaterialVec3(material:LEMaterial,name$z,x:Float,y:Float,z:Float)="SetMaterialVec3" Function leSetMaterialVec4(material:LEMaterial,name$z,x:Float,y:Float,z:Float,w:Float)="SetMaterialVec4" Function leGetMaterialFloat:Float(material:LEMaterial,name$z)="GetMaterialFloat" Function leGetMaterialVec4(material:LEMaterial,name$z,v:Byte Ptr)="GetMaterialVec4" Function leMaterialContainsValue:Int(material:LEMaterial,name$z)="MaterialContainsValue" EndExtern Private Global char:Byte[102400] Public Function leGetShaderSource:String(shader:LEShader,n:Int) Local char:Byte[] char=char[..leGetShaderSource_(shader,n,Null,0)+1] leGetShaderSource_(shader,n,char,char.length) Return String.FromCString(char) EndFunction Function leGetShaderError:String(shader:LEShader) Local char:Byte[] char=char[..leGetShaderError_(shader,Null,0)+1] leGetShaderError_(shader,char,char.length) Return String.FromCString(char) EndFunction Function leGetAssetName:String(asset:LEAsset) Local char:Byte[] char=char[..leGetAssetName_(asset,Null,0)+1] leGetAssetName_(asset,char,char.length) Return String.FromCString(char) EndFunction Function leGetGraphicsDriverName:String(graphicsdriver:LEGraphicsDriver) Local char:Byte[] char=char[..leGetGraphicsDriverName_(graphicsdriver,Null,0)+1] leGetGraphicsDriverName_(graphicsdriver,char,char.length) Return String.FromCString(char) EndFunction Function leGetLogText:String() Local char:Byte[] char=char[..leGetLogText_(Null,0)+1] leGetLogText_(char,char.length) Return String.FromCString(char) EndFunction Function leLoadtexture:LETexture(path:String,flags:Int=0) Local ext:String Local pixmap:TPixmap ext=ExtractExt(path).tolower() Select ext Case "tex","thb" Return leLoadTexture_(path,flags) Default pixmap=LoadPixmap(path) If pixmap Return lePixmapToTexture(pixmap) EndIf EndSelect EndFunction Function leSaveTexture:Int(texture:LETexture,path:String) Local pixmap:TPixmap=leTextureToPixmap(texture) If pixmap Select ExtractExt(path).tolower() Case "png" Return SavePixmapPNG(pixmap,path) 'Case "bmp" Return SavePixmapBMP(pixmap,path) 'Case "tga" Return SavePixmapTGA(pixmap,path) Default Return False EndSelect EndIf Return False EndFunction Function leTextureToPixmap:TPixmap(texture:LETexture) Local pixmap:TPixmap=CreatePixmap(leGetTextureWidth(texture,0),leGetTextureHeight(texture,0),PF_RGBA8888) Local x:Int,y:Int,color:Int 'Local lockmode:Int=leTextureLocked(texture,0,0) 'If Not lockmode leLockTexture(texture,0,0) 'For x=0 To pixmap.width-1 ' For y=0 To pixmap.height-1 ' pixmap.WritePixel(x,y,leReadTexturePixel(texture,x,y,0,0)) ' Next 'Next 'If Not lockmode leUnlockTexture(texture,0,0) leGetTexturePixels texture,pixmap.pixels,0,0,0 Return pixmap EndFunction Function leCreateCamera:LECamera(parent:LEEntity) 'DebugStop Return leCreateCamera_(parent) EndFunction Function lePixmapToTexture:LETexture(pixmap:TPixmap) Local texture:LETexture Local x:Int,y:Int,color:Byte[4],colori:Int If pixmap.format<>PF_RGBA8888 pixmap=pixmap.convert(PF_RGBA8888) texture = leCreateTexture(pixmap.width,pixmap.height,LE_TEXTURE_RGBA,0,1) If texture 'leLockTexture(texture,0,0) 'For x=0 To pixmap.width-1 ' For y=0 To pixmap.height-1 ' colori = pixmap.ReadPixel(x,y) ' MemCopy color,Varptr colori,4 ' leWriteTexturePixel(texture,x,y,color[2],color[1],color[0],color[3],0,0) ' Next 'Next 'leUnlockTexture(texture,0,0) leSetTexturePixels(texture,pixmap.pixels,0,0,0) 'Print "BMX: "+Int(pixmap.pixels) EndIf Return texture EndFunction
-
A BlitzMax import file or module will be provided. There will be no documentation or official tutorials for BlitzMax. It's only being supported at this point because I am using it to write the editor. The language is no longer being developed, unfortunately , so it's not something I want to promote. Blitz is a really good illustration why free upgrades for life is a bad idea.
-
SM4 is required for the deferred renderer. Anything less than that will use the fixed function pipeline. There would not be any disadvantage to using le3 for a 2d game, since the minimum specs are so low.
-
This package of tutorials is the best place to start: http://www.leadwerks.com/werkspace/page/Documentation/LE2/tutorials/_/programming/cpp/leadwerks-c-tutorials-r25 There's also a lesson on getting started here: http://www.leadwerks.com/werkspace/page/Documentation/le2/_/tutorials/getting-started-with-c-r85
-
A debugger with pause and stepping is a pretty big task, which you can read about here: http://www.leadwerks.com/werkspace/blog/1/entry-658-lua-and-c-debugger/
-
can we direct output of RenderFramework() to a color buffer?
Josh replied to deniz's topic in Programming
Certainly, but I don't recommend rendering to an extra image like a mirror with full effects enabled, since it will be much slower. I'd use minimum rendering, as demonstrated in the beginning tutorial, with shadows disabled. -
Yeah, it's a weird time right now. I'm making a lot of progress, but the finished LE3 is still miles away. This has sort of taught me why software companies usually keep adding to their existing product until they become totally unmanagable, rather than starting new IP. There never really comes a time where starting something new is profitable in the short-term, so it just keeps getting put off.
-
It would be good to support DAE of all formats better.
-
Always set these values right before you do anything with OpenGL images and pixels: glPixelStorei GL_PACK_ROW_LENGTH,w glPixelStorei GL_UNPACK_ROW_LENGTH,w glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format] glPixelStorei GL_PACK_ALIGNMENT,1 glPixelStorei GL_UNPACK_ALIGNMENT,1
-
Have you tried the Collada to FBX converter?
-
Loading a model, loading a mesh, or copying either will all result in the minimum number of vertex and indice buffers used. Every instance in the engine will use the same data and be rendered in a single draw call.
-
The C++ object debugger for Lua is working now. It was a little tricky, but I implemented a method to view all members of C++ objects. The debugger does handle dynamic object fetching, so if you expand a node in the debug tree representing a C++ object, the contents of that object will be loaded and displayed. Let's say you have an entity parented to another entity. This allows you to expand the parent member of the child, then find the child in the parent's child list, and so on, ad infinitum. If you're interested in how this works internally, every class in LE3 is derived from a base class called "Object". The Object class has a virtual function called Debug() which returns a string in a format like the following: entity={position={x=0,y=0,z=0},rotation={x=0,y=0,z=0},scale={x=1,y=1,z=1},parent=0x00fh7fC} This is read by the debugger and used to create more readable nodes in the debug tree. The hex address listed for all pointers can be compared to values in C++ or another language, if needed. Classes that are used as direct objects, like math classes, and, well,. nothing else, simply output their data like this: v={0.0,0.0,0.0} Hard to explain, but easy to understand when you just look at the debugger.
-
I actually could cast it back, since I am using pointers and they'll be fine as long as they aren't deleted, but I don't think I will be doing that. Anyways, it works. See my blog for details about the Lua debugger.
-
Here's the proper way to convert to an integer and hex string, and back: int pointer = (int)(int*)o; std::string hex; stringstream ss; ss << hex << pointer; hex = ss.str(); int l=hex.length(); for (int h=0; h<8-l; h++) { hex = "0"+hex; } o = (Object*)pointer; return "0x"+hex;
-
I'm actually storing the object in a map, looked up by the hex address, but I like to display the hex address because it can be verified in any programming language. I always found it weird how C++ programmers are so scared of this idea. It's just a block of RAM.
-
I don't see why it wouldn't work. It's just a memory pointer.
-
In theory, this works: Object* o= (Object*)&pointer; But the program says the second pointer is not the same as the original.
-
My example above is not the actual code I am using. The object pointer is pointing to a valid object.
-
I'm actually getting the same hex address from each object, but only the original pointer seems to be recognized.
-
I can convert an object to an integer as follows: Object* o; int pointer = *(int*)o; What is the reverse operation to get an object from an integer?
-
Yes. Object slicing with ToLua isn't an issue as long as you keep the object in Lua memory somehow, so I just add all relevant object to a global table.
-
Yeah, that is in the design spec.