Blitzmax is excellent to program with!
BlitzMax Forums/BlitzMax Programming/Blitzmax is excellent to program with!
| ||
Just thought I would create a praise thread. Yesterday+Today I have been writting a small tool for a game. Now b3d and b+ were ok for doing this, but well bmax is just far superior. OOP just makes things so much easier and faster to develope. That aswell as function pointers, dynamic arrays, arrays of arrays, garbage collection, linkedlists, GL 2d, if expressions that fail at the first false and more just makes it really enjoyable to program in. I just posted this because I noticed my program had grown in complexity and I was ontop of it all. Usualy with the old blitz style of programming, things would be different. Im used to programming this way (the bmax way) from using php alot. Bmax does it better than php I find, everything just seems to on the same ideaoligy. No mish mash of command names/techniques. Thanks BRL, keep up the good work :) |
| ||
... on the other hand I'm getting stuck in what might be included in the official GA or future releases. i.e. Should I do it in pure GL which, for me, is a huge learning curve, or hope for 'assisted' commands in the future? Without knowing what the additional features are I don't know what to code round. |
| ||
Sk3n, what exactly are the benefits of programming with max over over versions of blitz? a couple of examples would be interesting |
| ||
* cross-platfom * faster * smaller executables * clean modular approach * free beer once a month Also, all of these features ... http://www.blitzbasic.com/Products/blitzmax.php |
| ||
- cross-platform - modular design - OOP (object orientated programming) - function pointers() - 2d with fast rotate/alpha/scale/filter/blend - automatic multiple lists for objects. instance can belong to multiple lists - redimable (its not done with dims anymore) arrays - arrays can be passed/returned to/from a function - memory pointers (can access the real location in memory of anything) - arrays can store arrays. .. and array of arrays! - shorts,bytes,longs,doubles (more data types) - can include data into your executable and load directly (readfile("incbin::file.txt")) - can import c+/c++ libraries into your program, and use them directly with bmax compiling them into the final exe. - minimum 10k - 20k exe's - small memory footprint There is plenty aswell :) example of OOP Type vehicle Field x,y Field r,g,b Field name:String Method update() Abstract End Type Type car Extends vehicle Function Create:vehicle(name:String) Local c:car = New car c.name = name Return vehicle(c) End Function Field frontleft_wheel:wheel = New wheel Field frontright_wheel:wheel = New wheel Field backleft_wheel:wheel = New wheel Field backright_wheel:wheel = New wheel Field enginepower Method StartEngine() enginepower = 100 End Method Method StopEngine() enginepower = 0 End Method Method Update() 'do car related movement End Method End Type Type bike Extends vehicle Function Create:vehicle(name:String) Local b:bike = New bike b.name = name Return vehicle(b) End Function Field front_wheel:wheel = New wheel Field back_wheel:wheel = New wheel Field gears Method Update() 'do bike related movement End Method End Type Type wheel Field ageofwheel End Type Local mybike:vehicle = bike.Create("town bike") Local mycar:vehicle = car.Create("ford") example of function pointers Local current_tool() Function tool_update_1() 'draw a rectangle End Function Function tool_update_2() 'draw a circle End Function current_tool = tool_update_1 Repeat 'call the update function for selected tool If current_tool <> Null current_tool() 'select various tools If KeyHit(KEY_1) current_tool = tool_update_1 If KeyHit(KEY_2) current_tool = tool_update_2 Until KeyDown(KEY_ESCAPE) example of linked lists Type train_station Field name:String End Type Type train Field route:TList = CreateList() method AddStationToRoute(station:train_station) route.AddLast(station) end method End Type Function CreateStation:train_station(name:String) Local station:train_station = New train_Station station.name = name Return station End Function 'create some stations Local station1:train_station = CreateStation("old kent road") Local station2:train_station = CreateStation("mayfair") Local station3:train_station = CreateStation("liverpool street") Local station4:train_station = CreateStation("picadilly") Local station5:train_station = CreateStation("kings cross") 'create some trains local train1:train = new train local train2:train = new train 'design the route for train 1 train1.AddStationToRoute(station1) train1.AddStationToRoute(station3) train1.AddStationToRoute(station4) 'design the route for train 2 (circle line) train1.AddStationToRoute(station1) train1.AddStationToRoute(station2) train1.AddStationToRoute(station3) train1.AddStationToRoute(station4) train1.AddStationToRoute(station5) train1.AddStationToRoute(station4) train1.AddStationToRoute(station3) train1.AddStationToRoute(station2) |
| ||
While I share your enthusiasm for BlitzMax, I think it's a little early to post something like this - it still has bugs for a start. |
| ||
you can't use c++ code, well you can if you dont want to access any thing in a class, ie you need a c wrapper of your classes for blitzmax to handle it. |
| ||
Drago covered the most disappointing part, but that aside it's a rather comfy language for Basic advocates (me). Although I find coding in D, C#, and pure C comfy too.. I'd say C has given me a bit of a 'god complex' due to memory management. I love having access to everything at my fingertips. |
| ||
While I share your enthusiasm for BlitzMax, I think it's a little early to post something like this - it still has bugs for a start. Well the bugs are minor, so it is irelivant. |
| ||
@skn3[ac] Your example for the function pointers: Three questions: One, in the line Local Current_Tool() is this a function prototype of a non existant function? Two, how would you pass this to, say, the OS (like for a callback) since this is not a 'traditional' variable? And three, I could not find any examples of function pointers in the manual either under 'functions' or 'pointers', so how did you find out about them and how to use them? @Drago That may be true, but that's sort of a lame criticism since this is not c++ (viva la difference!). Many of us use Blitz 3D/Plus/Max because we don't LIKE c++. That being said, perhaps something will be done about this in the future: It appears as though Mark is trying to combine the best features of both languages. Russell |
| ||
thanks sk3n looks like a better way of doing things |
| ||
That may be true, but that's sort of a lame criticism since this is not c++ Well, the idea is that you should be able to use other engines written in C++ without having to wrap them in C. At the moment (I'm assuming something will be done about this) this isn't possible. |
| ||
As long as the bugs can be fixed by the users, it's already good :) I'm buying the millisecond that the words "win32" and "blitz max" appear in the same sentence on the home page. No need to persuade me! Besides, I need to tempt my future infotech teacher away from the evil ways of visual basic. |
| ||
Mmm. Well, picklesworth, not all the bugs are user fixable. Atm the debugger is so buggy its unuseable. |
| ||
Mmm. Well, picklesworth, not all the bugs are user fixable. Atm the debugger is so buggy its unuseable. Protean debugger works fine. It's awesome. |
| ||
As well as the eclipse debugger. |
| ||
Mmm. Well, picklesworth, not all the bugs are user fixable. Atm the debugger is so buggy its unuseable. The debugger itself works fine, it is the IDE that is the problem. |
| ||
Going back to Blitz3D after using max for a while is quite painful :) |
| ||
@skn3[ac] Your example for the function pointers: Three questions: One, in the line Local Current_Tool() is this a function prototype of a non existant function? Two, how would you pass this to, say, the OS (like for a callback) since this is not a 'traditional' variable? And three, I could not find any examples of function pointers in the manual either under 'functions' or 'pointers', so how did you find out about them and how to use them? You can use a byte ptr. byte ptr(yourfunctionhere) ...and if you want windows to call it, define your function like this... function yourfunctionhere()"win32" end function |
| ||
Well the bugs are minor, so it is irelivant. I don't think it's time to be slapping Mark on the back just yet. ;-) |
| ||
If I am able to (in beta remember) design a 170k opengl based application, that can run fast, is easy to modify (the code) and very stable.. well I think it is time for slapping on the back. Remember, its in beta so its going to have minor bugs. There is nothing show stopping whatsoever in bmax. (as long as you have protean ;) |
| ||
skn3[ac] on case... Yeah its not the end of the world, its just annoying knowing that it is done in other languages. So they'll be no slapping until I say (or is that stoning?) I don't have Protean. ;-) |
| ||
Use eclipse :) |
| ||
some things are harder... i use bbmax to create new images... i draw only some symbols to it... a must save this as png-file with alpha... but bbmax dont't support nice image-access and i can't save pngs - only with additional modules... and i must writ my own drawing-functions... |
| ||
@Russell "That may be true, but that's sort of a lame criticism since this is not c++ (viva la difference!). Many of us use Blitz 3D/Plus/Max because we don't LIKE c++. " that is not what I was implying, it is more I have an engine I wrote in C++ that I wanted to let blitzmax use as a lib, the engine itself is OO, but to get blitzmax to use it would have to write a wrapper for it, which might not be bad for somethings, but for an engine that is still in development I don't want to write it and to have to keep updating it, so now I'm not. |
| ||
@skn3[ac]: Thanks for the reply, but I'm not sure you've answered my questions. :^/ In the line... Local current_tool() ...that is not an array, but it's not a function prototype either (although it does resemble one). Can you explain this a little bit more? On question two... huh? Can I send, for example, current_tool as a parameter to an OS routine? I guess I should ask, are these REAL function pointers in the traditional sense? There's something not quite right about the way they are done in Max... I sure wish I could just go... address:Long = FuncPtr(func_one) ...or something similar. And of course, the third question, which I've asked before is: Where did you get this information from since it is not in the manual? Thanks again, Russell |
| ||
1, it is a blitz function pointer. You have to define it so that it matches the function you wish to call. Eg local myfuncpointer(param1:int,param2:float,param3:string) 2, I did answer. If you want to get a ptr to a blitz function, to pass it to the os or an outside library, you use bytr ptr. local address:byte ptr = byte ptr(myfunctionhere) 3, Just picked most of it up. the byte ptr stuff is in the docs. Not sure about blitz function pointers, but I'm sure I read it either on a forum post/code example in docs. |
| ||
Thanks, skn3[ac], I guess you did explain number two (just seems really weird, and why this is not in the manual I can't imagine). If you got the function pointer info from the docs I'd like to know where, 'cuz I searched quite a bit for it. If it is in there, you'd think it would have been put under 'functions' or 'pointers', wouldn't you? It's not even in the 'Advanced topics' section! You know, I think what is so frustrating to me, and maybe some other newbies, is that the concepts are fairly easy to grasp but the SYNTAX of how to do certain things is a tad hard to nail down...for example the second bit of code above. But thanks again anyways! Hopefully this sort of information will make its way into an 'Advanced' section of the new-and-improved manual. Russell |