preamble: since im legastenic and english not my main language, this text could be very ugly to read for you, sorry for this.
I will try to improve this in Future posts, but it cost me like 8x concentration to to care about correct spelling, so then i would take 4 hours for this text intead of 10 minuts, please be sorry with me in this case!
it was easyier than i thought first, also i just rewrited some stuff that i was not so superhappy in LE with, for expample i wrote my own font and display text managment system, and made it more compatible with the blitzmax 2d original stuff.
Same i did with drawimage() and simple graphic primitive functions.
the following max2d functions are "converted" now,
at first i made it compatible with Minib3d - Max2d to use all my old gui stuff just in Leadwerks Engine 2.4
BeginMax2d() 'this sets the GLortho and all the stuff
EndMax2d()'this sets all back =)
Also then the native Max2d Draw primitves functions that rewrited:
SetColor(r:Byte, g:Byte, b:Byte)
DrawRect(x:Float, y:Float, width:Float, Height:Float, fill:Int = 1)
DrawLine(x:Float, y:Float, x2:Float, y2:Float, draw_last_pixel:Int = True)
DrawOval(x:Int, y:Int, width:Int, Height:Int)
then i missed the Max2 frame image stuff, so i wrote a loader that extract the UV coordinates like the max2d frames
LoadImage:TImage(file:String, flags:Int = -1)
LoadAnimImage:TImage(file:String, cell_width:Int, cell_height:Int, first_cell:Int, cell_count:Int, flags:Int = -1)
then a new func, that i really like it extracts the UV and such coords from a special "IMP" file, with this the frames can have a differend size, very handy for making gui stuff with just 1 texture (saves up alot of rendertime when just 1 bindtexture() is happen for the whole gui)
LoadAnimImageIMP:TImage(file:String,impfile:string, cell_width:Int, cell_height:Int, first_cell:Int, cell_count:Int, flags:Int = -1)
drawing is like max2d style:
DrawImage(image:TImage, x:Float, y:Float, Frame:Int = 0)
DrawImageRect(image:TImage, x:Float, y:Float, sizex:Int, sizey:Int, Frame:Int = 0)
Also i was a little bit unhappy with the LE font system (its nice, but something was strange to me)
so i wrote my own font system based on fonts that where made and exported with the FontMaker tool from southern lake.
the special differend is that there is just the normal max2d like stuffs:
LoadFont:TFont(file:String, ignored1:Int = 0, ignored2:Int = 0)
DrawText(Text:String, x:Int, y:Int)
(its all related to my own tfont type)
when loading the UV for every char is extracted from the FNT file that was exported with the fontmaker tool,
and when writing a text then the string is iterated through all chars and for every char the letter will be drawn (all via glDrawArray)
this is nothing special, but the new stuff is the ttexthandle type, that is some kind of "prebuilded" array for a text,it can be created with
local text = ttexthandle.createfromstring("hallo world")
this will create the UV and vertpos arrays for displaying this text.
and after this, teh text can be drawn with
or changed with
Also there are lot other functions within the tann2d object type that are rly a handy bunch like drawing images colored, faded rectangels and such stuff, but that are to much to list them all here now i think.
And the second bigpart i did in the last week was portig anngui from max2d to leadwerks, at first i just wanted to wrap all max2d functiosn and then just use anngu, and this worked fine.
but then i saw alot of new ways how to improve it at all, and fix some issues with the old system.
The windows for example are now prebuilded arrays with all window borders and buttons in it, when making a hover effect i just change the UV of the hovered button, to the frame that is given for the "OnHover" thingy, and such a bunch of other stuff.
Also there is a very handy tmouse type, that can update the mouse stats, buttons, positions 1 time per frame, and then i can test if the mouse is in x,y with a simple function, and set a tooltip for this and all such little cosmetic stuff like changing the mousecursor depending what the button have setted.
The buttons can modify variables behind INT pointers, raise or decrease them with max and min values, and also they can run funcpointers when clicked. This is enough for the start with my ne anngui2 system =)
was a hard weekend to get this finished,
And since ppl love screenshots here some shots.
well the first and second screenshot are anngui in our old minib3d project (an online harvest moon like game)
and the third Screenshot is my rewrited gui system for LE, running in my actual and first LE project. =)
not much here now, only window and buttons are in, but soon there will come all the olther stuff to:
textfields, and lists
bbcode text interpreteter for colors, size, bold,underline, and images in texts.
tabs, sliders and all the stuff that is needed for my projects in future =)
so if Someone is really interested in ever using this gui or maybe only all the max2d functions than just tell me, it made me hard time to work, but maybe i can help someone getting into it faster.
i just need to write a little doc for it then, since the code is all commented and "bbdoc" also in German.
But its well splitted into tann2d (wich is just the max2d functions stuff for drawing and the font/text thingie) and tanngui wich handles windows and buttons etc (but it need tann2d to work but not vice versa)
The bad thing is, that its written in blitzmax, so if you use c++ or something then it will not help you B)
now after i got the basics done for my gui stuff, i can start with my first LE game Project, maybe i write more about this later =)