Some modules for ya.
Community Forums/Showcase/Some modules for ya.
| ||
I thought I'd share these with the community, you can probably find these somewhere on the BMax forum but I thought I'd save you the trouble. What do we have? Indiepath.ProjMatrix : Lets you play with the projection matrix : works with DirectX and OpenGL (this is your best friend) Indiepath.AnimImageFast : Accelerated Single Surface Animated Image drawing : DirectX and OpenGL - This function is at least 45% faster than the inbuilt command and requires less video memory. Indiepath.bMapText : Accelerated Single Surface Bitmap text drawing : DirectX and OpenGL - shed loads faster than using the inbuilt stuff. Heres the files : http://indiepath.com/tim/indiepath.mod.rar Here's an example (.exe and example included in archive) Strict Framework BRL.D3D7Max2D Import Indiepath.AnimImageFast Import Indiepath.ProjMatrix Import Indiepath.bMapText Framework BRL.D3D7Max2D SetGraphicsDriver D3D7Max2DDriver() ' Set the Graphics to whatever you want, the matrix will deal with the scale and position. Graphics 640,480,0,60 'Graphics 800,600,0,60 'Graphics 1024,768,0,60 'SetMatrix(BaseWidth,BaseHeight,BaseDepth) SetMatrix(800,600,2) SetClsColor(80,80,80) Cls 'bMapText.Create(bitmapname:string,flags) Local text1:bMapText = bMapText.Create("fatbot",FILTEREDIMAGE|MIPMAPPEDIMAGE) ' TAnimImage(url:object,cell_width,cell_height,Start_frame,NumberFrames,Flags) Local blob:TAnimImage = TAnimImage.Load("blocks.png", 32, 32, 0, 16, FILTEREDIMAGE) For Local b=0 To 15 ' This Draw Command is 45% faster than the existing command. 'Draw(x,y,width,height,frame) blob.Draw(5 + (b * 40), 200, 30, 30, b) Next SetScale(0.4,0.4) ' DrawbMapText(text:string,x,y,center,right) text1.DrawbMapText("Indiepath Ltd",400,280,True,False) SetScale(0.35,0.35) SetColor(255,255,155) text1.DrawbMapText("Hit ESC to Exit",400,330,True,False) Flip WaitKey() |
| ||
Thanks Tim, I'll take a close look at these. Very sexy... The 45% faster boost - is that because it's single surface or is it the TnL stuff? |
| ||
opengl works directx says: DX7ImageFrame Lock failed |
| ||
Rob, it's single surface using the normal HAL renderer. The normal AnimImage command creates a new surface and texture for each frame, this is both expensive in terms of memory and switching surfaces everytime you draw to screen. Don999, You need to have version 1.10 of Bmax as a minimum to compile the stuff.. Where does the error come from? which module? {EDIT} When v1.12 is released I may have to rework some of this as I suspect there have been some big changes |
| ||
Very nice! Thanks!! |
| ||
Very generous although some of them could come obsolete soon! |
| ||
Tim;s fixes have been posted around the place for a while, it'll be interesting to see if any of them have made it to the official mods. Altho, if you look at the modserver, the brl.random module has floyd's name on it, which suggests they took his better random generator. Tim's name is no where to be found, so maybe they overlooked these ones. Time will tell (not much time now!) @Don999: As Tim said you need v1.10 for the DX stuff... however, if you upgrade to v1.10 now you can't syncmods, because the modserver is locked for the upgrade. So you will have to wait until v1.12 is released. And then it could be a case of none of this code works anymore ;] |
| ||
I get the same error, with 1.10 with latest syncmods: Unhandled Exception: DX7ImageFrame Lock failed Did you make any custom changes to the BRL DX7 module as well, by any chance? when running the sample source, both the text1.DrawbMapText and the blob.Draw commands trigger the error. Remarking those three lines out and the error goes away, but of course nothing really happens anymore either at that point. Any idea what's causing this? I would really be interested in getting that resolved, since these are incredibly useful additions to BMax. |
| ||
I am using standard Bmax commands. No "under the hood" stuff here guys. |
| ||
Hm, Weird... I copied the 'indiepath.mod' folder under the blitzmax/mod directory, would I need to do anything else for the sample to run? *update* I just switched to SetGraphicsDriver GLMax2DDriver(), and it -does- compile and run. However, it has some kind of problem as well: ![]() (Just the text, the squares look OK on the screen. they just look bad in this screenshot due to JPG compression artifacts) The pre-compiled sample .EXE works fine though, and shows the text without corruption. I tried both regular and debug mode -- With OpenGL both modes look the same, in DirectX mode the release mode will immediately quit without error, in debug mode it will throw the error message mentioned above. The Matrix-projection portion does seem to work though. |
| ||
Cool. I'll check it out - later.. It seems to be a UV issue. |
| ||
the same code now fails to compile altogether using the Blitzmax 1.12 version: C:/Code/BlitzMax/mod/indiepath.mod/animimagefast.mod/animimagefast.release.win32.a(animimagefast.bmx.release.win32.o.b)(code+0x37e): undefined reference to `bbGCEnter' C:/Code/BlitzMax/mod/indiepath.mod/animimagefast.mod/animimagefast.release.win32.a(animimagefast.bmx.release.win32.o.b)(code+0x3bb): undefined reference to `bbGCFlush' C:/Code/BlitzMax/mod/indiepath.mod/animimagefast.mod/animimagefast.release.win32.a(animimagefast.bmx.release.win32.o.b)(code+0x3cb): undefined reference to `bbGCLeave' C:/Code/BlitzMax/mod/indiepath.mod/bmaptext.mod/bmaptext.release.win32.a(bmaptext.bmx.release.win32.o.b)(code+0x217): undefined reference to `bbGCEnter' C:/Code/BlitzMax/mod/indiepath.mod/bmaptext.mod/bmaptext.release.win32.a(bmaptext.bmx.release.win32.o.b)(code+0x232): undefined reference to `bbGCFlush' C:/Code/BlitzMax/mod/indiepath.mod/bmaptext.mod/bmaptext.release.win32.a(bmaptext.bmx.release.win32.o.b)(code+0x242): undefined reference to `bbGCLeave' Build Error: Failed to link d:/indiepath/lil_demo.exe |
| ||
Are you suprised? BMax will fail on any instance of Flushmem(). I'll repost these at some point today. |
| ||
So none of these made it into official modules? Shame. |
| ||
Okay, updated and re-compiled. All modules work correctly with OpenGL and DirectX, even the Projection Matrix Mod! Just download from the link above and install as normal. |
| ||
Very nice! Now works correctly under both DX and OpenGL on my system. |
| ||
A tip for others playing around with these modules: It appears that the projection matrix behaves slightly different in OpenGL than in DirectX: In DirectX mode, SetViewport needs the virtual resolution, while in OpenGL mode SetViewport requires the actual resolution. That means that if your application runs in both graphic modes, you'll have to apply some extra logic around any calls to SetViewPort, or one of the two will not behave as expected. (Also -- the commands don't get highlighted in the IDE?) |
| ||
It looks like the latest syncmods broke your module again: Building lil_demo Compiling:lil_demo.bmx flat assembler version 1.64 3 passes, 1813 bytes. Linking:lil_demo.exe C:/Code/BlitzMax/mod/indiepath.mod/animimagefast.mod/animimagefast.release.win32.a(animimagefast.bmx.release.win32.o.b)(code+0x36e): undefined reference to `brl_d3d7max2d_TDX7ImageFrame' C:/Code/BlitzMax/mod/indiepath.mod/bmaptext.mod/bmaptext.release.win32.a(bmaptext.bmx.release.win32.o.b)(code+0x7bd): undefined reference to `brl_d3d7max2d_TDX7ImageFrame' Build Error: Failed to link D:/indiepath2/lil_demo.exe Process complete |
| ||
Don't sync mods then :D I haven't. I'll fix this when....... 1) Indiegamebusiness.com has been launched 2) igLoader has been lauched as a commercial product 3) Seasonal games are launched on cloverleaf and portals. 4) I get a spare moment. |
| ||
Fixed, uploaded new file. |
| ||
Oooooh. A-Star Pathfinding and DeltaTime module as well, I see? Any documentation on any of these? |
| ||
ah, I did not mean to include the A* stuff :D Delta Time :- |
| ||
You'll be including your games next. So thats where I find makeGame() - in 1.15! |
| ||
Lol, na the commands are : MakeNewSkin(); CreateMoneyFromOldRope(); |
| ||
ah, I did not mean to include the A* stuff :D Don't you hate it when that happens? :-) |
| ||
Is the module still available? The link at the start of this the thread is broken at the moment. In any case Indie I tracked down another thread with your posting of the basic matrix code and got it working in my project. Fantastic!!! I had pretty much resigned myself to only supporting one resolution rather than go through the pain of doing things the really ugly "take screen res into account for every calculation" way. Thanks a ton. |
| ||
Yeah, I've removed the majority of my stuff for the time being. |
| ||
Have any updated versions of that FastAnimImage type, or should I just scrape the from the old (3 years) posts? (though perhaps this has already been included in version 1.30 of bmax...??) |