Function Overwriting with Imports
BlitzMax Forums/BlitzMax Programming/Function Overwriting with Imports
| ||
Hi. My Problem : BlitzMax ImageFont Lib and my own ImageFont Lib. Both the same function names & parameter. I thought i can switch between the two Libs with Framework and Import. But i cant see a way to seperate ImageFont from Max2D. And if i Use : Framework brl.basic import brl.max2d import pub.myfont i get an Compiler duplicate Error. I thought the Compiler overwrites max2d functions with the same pub.myfont functions. Please give me any idea to get a good solution. Thanks! Mfg Suco |
| ||
Max2D imports imagefont by default. There are three ways to do this. The h4xx0r way is to replace the "imagefont.bmx" in "/mod/brl.mod/max2d.mod/" with your own source. The less h4xx0r and marginally safer thing to do would be to copy Max2D.mod to a new directory and call it TheOtherMax2D.mod, then exchange imagefonts like above. Then import that library instead of the real Max2D (this will also probably survive a syncmods). The sensible thing to do is probably just rename your functions - preferably by adding a prefix of some sort. |
| ||
I'm with the sensible thing. |
| ||
Hi Thx for help. But i need a direct way. I have do this before i ask in this Forum. Function DrawText(Txt:String,x:Float,y:Float) DCDrawText(Txt,x,y) End Function Function TextWidth:Float(Txt:String) Return DCTextWidth(Txt) End Function Function TextHeight:Float(Txt:String) Return DCTextHeight(Txt) End Function Thats the Functions in my Maincode. In the Maincode i can overwrite the max2d Functions without errors. Only problems with the imports........... And i need no stupid h4xx0r wrapping. Mfg Suco |