Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

AnniXa

Members
  • Content Count

    73
  • Joined

  • Last visited

Blog Entries posted by AnniXa

  1. AnniXa
    Actually i ported my Gui system from MiniB3d / native OpenGl to LE
     
    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)
    SetAlpha(alpha:Float)
    Plot(x:Int, y:Int)
    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)
    DrawPoly(xy: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)
    GetImageFont:TFont()
    SetImageFont(font:TFont)
    TextHeight:Int(Text:String)
    TextWidth:Int(Text:String)
    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
    text.drawme(10,10)
    or changed with
    text.settextfromstring()
     
    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 =)
  2. AnniXa
    Today and yesterday i wrote alot of new gui stuff:
     
    GuiFrameView, wich is adding just a rect that shows a frame from an timage object to the vertexbuffer of the containing window,
    This can be a classic max2d like frame or my new IMP frame system.
    same as a new TextButton, wich is adding 3 rechts, to the buffer, 2 for the both "end piceces" and a stretched one, also it adds a ttexthandle to the buffer.
    Width can be auto assigned from the text, or manually setted (in this case the text will centrated in the button)
     
    Also i added a (not so) simple text lists, that got a buildin support for the mouse stuff, detecting wich entry was hovered/klicked, the possiblity to set a function pointer that is called when a list entry is clicked, and some methods for getting the last clicked ID or Text.
    Also included is autscroll down when new text entry appears, and a "max entrys" setting.
    When a flag is set you cann scroll the menu when you with the mouse over with the mousewheel
     
    Also the first visibile entry can be used to point them into pointer buttons, or then in future comming pointer scroller, wich can modify the var behind the pointer depending on how you scroll it.
     
    And another nice extra are "Entity buttons", a button that can be atached to an entity, and fixes up its position to the entity, also there is a special extend of that that uses 2 extra pivots to "stretch" the button over the entity, wich can be handy maybe sometimes B)
     
    This the first implement of the entity buttons is just using tann2d´s drawimagerect instead of adding the button to the buffer arrays of the windows, because the buttons will "delete" them self from the carrier window when the entity to wich them attached is Freed, and so i would neet to rebuild the whole window array anytime when a new entity button apears or is getting deleted.
     
    Maybe i create a differend kind later that means to be more a "static entity button" wich is more for entitys that stay over the whole time, but im not sure if this is a good idea, sinc when i have like 100 entitys thate are not in view, there would still be room in the windowarray for them, and the quads/tris would be still drawn (because i dont use an arrayindex)
     
     
    so At least here some screenshots =)
     
    Some textbuttons, textfields, iconbuttons with differend modes in action.

     
    The new textlist in action

     
    Some "EntityButtons" in action

     
     
    Enjoy life!
Facebook Twitter Youtube Github Steam
×
×
  • Create New...