Author Topic: recons gui system  (Read 2679 times)

recon

  • 3Impact Full Member
  • ***
  • Posts: 115
recons gui system
« on: June 10, 2007, 04:25:26 PM »
It's the first release of my "gui system" following this topic: http://www.3impact.com/3Impact_Engine/forum/index.php?topic=2065.0
You can consider this a sort of Beta since not all components
and functions are working/completed and since there is no
documentation yet. Except the demo that comes with this
first release that demonstrates pretty good how to use it,
and since the syntax looks exactly like the 3impact api:s it
shouldn't be to hard to figure it out for experienced users.
Although this project is compiled with 3impact v5 and
devc++ 4.9.9.1 there is no guaranties it should work with
earlier versions of 3impact or other programming languages
than c++.

Here is the instructions for how to install the gui api
(assuming you are using devc++),
first of extract all contents of the GUI-DLL 0.0.0.1.rar file
and then:
* Place the GUI.dll in your 3impact Work folder.
* Place both the libGUI.a and the dllgui.h somewhere
  where you can reach them easily from all your projects
  that will use them (ex. C:\Program\3impact5\).
* Add this lines of code to your projects main .cpp file
Code: [Select]
#define WIN32DLL_API __declspec(dllimport)
#define CALLMODE_API
#define _GUI_EXTERN
#include "..\dllgui.h" // change this path so it matches where you put the dllgui.h file.
* In your projects Parameters options, click "Add Library
   or Object" and select the libGUI.a file.

That's it for using the api, and here are the instructions
for installing the provided demo:
* Place the GUI.dll in your 3impact Work folder.
* Place the Gui 0.0.0.1 Demo folder in
   your 3impact directory (ex. C:\Program\3impact5\).
* Place the libdll3impact.a, dll3impact.h
   dllgui.h and libGUI.a in the
   Gui 0.0.0.1 Demo folder.
   (the libdll3impact.a and dll3impact.h files can
   be found in your \3Impact_as_a_DLL\DEVCPP
   folder).
* Move the gui_sprites_res folder to your
   3impact Work\ folder.

Then try to compile the project, if it is working, you
are done!



Here's a monster screenie  ;D:



More info later, im to tired to write more right now...
« Last Edit: June 13, 2007, 08:55:16 AM by recon »

recon

  • 3Impact Full Member
  • ***
  • Posts: 115
Re: recons gui system
« Reply #1 on: June 10, 2007, 04:28:42 PM »
And if you are also to tired (to do the above) just to test it,
download this file and run the .exe file to test the demo.
(requires that you are enable to run 3impact v5 projects)

quasar

  • 3Impact Newbie
  • *
  • Posts: 26
Re: recons gui system
« Reply #2 on: June 12, 2007, 10:24:11 AM »
recon, very nice  ;D
I tried the run demo, and it worked very well.

The dll approach is a very good idea, IMHO.
Maybe, in later releases, you could link the resources into it aswell, so people only need to add the dll for having gui functionality.

I truly hope you'll continue with your work there.

Did you think about a "business model" yet, like maybe sell this addon for a small fee to other 3i users?
Of course, having it for free would be best  8), but to me it seems that authors tend to stick more to their work and keep the update cycles running when a bit of money is involved.
And 5 or ten bucks for such an addon, given via paypal, would not really do harm to anybody, I think.
Just an idea...

q

recon

  • 3Impact Full Member
  • ***
  • Posts: 115
Re: recons gui system
« Reply #3 on: June 12, 2007, 02:27:11 PM »
Thanks @quasar, yeah taking a fee for the dll has crossed my mind but until i see some interest
from the comunity it's no idea start asking for cash  ;D. And, heh, also i'm not 18 years old
yet so i don't think i can register for that kinda service yet (you'll need a credit card)..
But anyway, what would keep me working on it the most would of course be feedback from the ones that
are using it  :)

Quote
you could link the resources into it as well

I'd have to think about that since the size of the dll would increase drastically, but maybe the most
basic resources could be linked (like the fullscreen sprite which can used for almost all
sprites, se the demo and you'll notice it's almost the only loaded .x file).


And here is some info i promised..

What is this system?
- The gui system is a add-on library to the 3impact api which easily enables users to create simple
  or more advanced gui components, the common Windows stuff (textboxes, dropdowns, etc).

Features:
* Has the same api interface as 3impact
  (the 'i' functions).

* Currently includes following (working) objects
  - IMAGE* (it's like a extended version of a SPRITE* with some extra functions needed for some components))
  - TEXTBOX*
  - INPUTFIELD*
  - SELECTIONBOX*
  - DROPDOWN*
  - SLIDERBAR*
  - WINDOW*

* Has an inbuilt resource handler for sprites and textures (uses functions iLoadSprite()
  and iLoadTexture()) so one file will only be loaded to memory one time.

* It's currently free, without royalties and stuff.


Next thing planned is more components and documentation for the functions that comes in this version

All functions listed:
Code: [Select]
void iComponentsDestroyAll();
void iComponentsUpdateAll();


void iLoadSprite(string, D3DXVECTOR2);
void iLoadTexture(string);


IMAGE* iImageCreate(string, string, CAMERA*);
void iImageDestroy(IMAGE*);
void iImageEventFunctionOnReleaseSet(IMAGE*, void(int));
void iImageEventFunctionOnRolloutSet(IMAGE*, void(void));
void iImageEventFunctionOnRollOverSet(IMAGE*, void(void));
void iImageEventFunctionOnClickSet(IMAGE*, void(int));
void iImageEventFunctionOnRelease2Set(IMAGE*, void(int,IMAGE*));
void iImageEventFunctionOnRollout2Set(IMAGE*, void(IMAGE*));
void iImageEventFunctionOnRollOver2Set(IMAGE*, void(IMAGE*));
void iImageEventFunctionOnClick2Set(IMAGE*, void(int,IMAGE*));
void iImageEventFunctionOnReleaseRelease(IMAGE*);
void iImageEventFunctionOnRollOutRelease(IMAGE*);
void iImageEventFunctionOnRollOverRelease(IMAGE*);
void iImageEventFunctionOnOnClickRelease(IMAGE*);
bool iImageIsClicked(IMAGE*, int);
bool iImageIsOver(IMAGE*);
void iImageDisable(IMAGE*);
void iImageShow(IMAGE*);
void iImageHide(IMAGE*);
void iImageRenderModesSet(IMAGE*, DWORD, DWORD);
void iImageTextureModeSet(IMAGE*, DWORD);
void iImageMipFilterModeSet(IMAGE*, DWORD);
void iImageRenderPriority(IMAGE*, int);
void iImageColorSet(IMAGE*, float, float, float);
void iImageAlphaSet(IMAGE*, float);
void iImageMaxAlphaSet(IMAGE*, float);
void iImageMinAlphaSet(IMAGE*, float);
D3DXVECTOR2 iImageAbsoluteSizeGet(IMAGE*);
void iImageLocationSet(IMAGE*, D3DXVECTOR2);
void iImageLocationAdd(IMAGE*, D3DXVECTOR2);
D3DXVECTOR2 iImageLocationGet(IMAGE*);
void CALLMODE_API iImageScaleSet(IMAGE*, D3DXVECTOR2);
D3DXVECTOR2 iImageScaleGet(IMAGE*);
void iImageTopLeftPositionSet(IMAGE*, D3DXVECTOR2);
void iImageTopRightPositionSet(IMAGE* , D3DXVECTOR2);
void iImageBottomLeftPositionSet(IMAGE*, D3DXVECTOR2);
void iImageBottomRightPositionSet(IMAGE*, D3DXVECTOR2);
void iImageTopLeftPositionMove(IMAGE*, D3DXVECTOR2);
void iImageTopRightPositionMove(IMAGE*, D3DXVECTOR2);
void iImageBottomLeftPositionMove(IMAGE*, D3DXVECTOR2);
void iImageBottomRightPositionMove(IMAGE*, D3DXVECTOR2);
D3DXVECTOR2 CALLMODE_API iImageTopLeftPositionGet(IMAGE*);
D3DXVECTOR2 CALLMODE_API iImageTopRightPositionGet(IMAGE*);
D3DXVECTOR2 CALLMODE_API iImageBottomLeftPositionGet(IMAGE*);
D3DXVECTOR2 iImageBottomRightPositionGet(IMAGE*);
void iImageHeightSet(IMAGE*, float);
void iImageWidthSet(IMAGE*, float);
float iImageHeightGet(IMAGE*);
float iImageWidthGet(IMAGE*);
void iImageAttachToImage(IMAGE*, IMAGE*, D3DXVECTOR2, int, int, bool, bool, bool, bool, float);
void iImageReleaseFromAttachedImage(IMAGE*);
void iImageAttachedImageOffsetSet(IMAGE*, D3DXVECTOR2);
void iImageAttachedImagePartsSet(IMAGE*, int, int);
void iImageAttachedImageLock(IMAGE*);
void iImageAttachedImageUnLock(IMAGE*);
void iImageAttachedImageAutoHideSet(IMAGE*, bool);
void iImageAttachedImageAutoFadeSet(IMAGE*, bool);
void iImageAttachedImageAutoFadeDistanceSet(IMAGE*, float);
void iImageRender(IMAGE*, bool);
void iImageTextureSetFromFilename(IMAGE*, string);
void iImageTextureReset(IMAGE*);
void iImageTextureChange(IMAGE*,char*);
void iImageTextureSet(IMAGE*,TEXTURE*);
void iImageTextureSwap(IMAGE*,TEXTURE*);
void iImageAlphaTextureChange(IMAGE*,char*);
void iImageCopyProperties(IMAGE*, IMAGE*);


CHECKBOX* iCheckBoxCreate();
void iCheckBoxDestroy(CHECKBOX*);


TEXTBOX* iTextBoxCreate(string, FONT*, IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*);
void iTextBoxDestroy(TEXTBOX* textbox);
void iTextBoxShow(TEXTBOX*);
void iTextBoxHide(TEXTBOX*);
void iTextBoxAlphaSet(TEXTBOX*, float);
bool iTextBoxIsSingleField(TEXTBOX*);
bool iTextBoxIsOver(TEXTBOX*);
void iTextBoxScrollbarYrestrictionSet(TEXTBOX*, float);
void iTextBoxScrollbarXoffsetSet(TEXTBOX*, float);
void iTextBoxTextShow(TEXTBOX*);
void iTextBoxTextHide(TEXTBOX*);
string iTextBoxTextGet(TEXTBOX*);
string iTextBoxTextFormatedGet(TEXTBOX*);
bool iTextBoxTextIsEmpty(TEXTBOX*);
void iTextBoxTextSet(TEXTBOX*, string&);
void iTextBoxTextAdd(TEXTBOX*, string&);
int iTextBoxTextLinesGet(TEXTBOX*);
int iTextBoxTextMaxLinesGet(TEXTBOX*);
int iTextBoxTextLinePositionGet(TEXTBOX*);
string iTextBoxTextOfLineGet(TEXTBOX*, int);
void iTextBoxTextCenterSet(TEXTBOX*, bool);
void iTextBoxTextAutoLineBreakingSet(TEXTBOX*, bool);
void iTextBoxTextAutoScrollDownSet(TEXTBOX*, bool);
void iTextBoxTextScalingSet(TEXTBOX*, D3DXVECTOR2);
void iTextBoxTextSpacingSet(TEXTBOX*, D3DXVECTOR2);
void iTextBoxTextBordersizeSet(TEXTBOX*, D3DXVECTOR2);
D3DXVECTOR2 iTextBoxTextScalingGet(TEXTBOX*);
D3DXVECTOR2 iTextBoxTextSpacingGet(TEXTBOX*);
D3DXVECTOR2 iTextBoxTextBordersizeGet(TEXTBOX*);
void iTextBoxTextAlphaSet(TEXTBOX*, float);
void iTextBoxTextColorSet(TEXTBOX*, float, float, float);
void iTextboxTextAttachFloat(TEXTBOX*, string, float*, string, int);

INPUTFIELD* iInputfieldCreate(string, FONT*, int, IMAGE*);
void iInputfieldDestroy(INPUTFIELD*);
void iInputfieldShow(INPUTFIELD*);
void iInputfieldHide(INPUTFIELD*);
void iInputfieldTextShow(INPUTFIELD*);
void iInputfieldTextHide(INPUTFIELD*);
void iInputfieldTextGet(INPUTFIELD*, string&);
bool iInputfieldTextIsEmpty(INPUTFIELD*);
void iInputfieldTextSet(INPUTFIELD*, string);
void iInputfieldTextCenterSet(INPUTFIELD*, bool);
void iInputfieldTextScalingSet(INPUTFIELD*, D3DXVECTOR2);
void iInputfieldTextSpacingSet(INPUTFIELD*, float);
void iInputfieldTextYoffsetSet(INPUTFIELD*, float);
void iInputfieldTextColorSet(INPUTFIELD*, float, float, float);
void iInputfieldTextAlphaSet(INPUTFIELD*, float);
void iInputfieldEventFunctionSubmitAsCharPointerSet(INPUTFIELD*, void(char*));
void iInputfieldEventFunctionSubmitAsStringSet(INPUTFIELD*, void(string));

SELECTIONBOX* iSelectionBoxCreate(string, TEXTBOX*);
void iSelectionBoxDestroy(SELECTIONBOX*);
void iSelectionBoxShow(SELECTIONBOX*);
void iSelectionBoxHide(SELECTIONBOX*);
void iSelectionBoxAlphaSet(SELECTIONBOX*, float);
void iSelectionBoxTextAlphaSet(SELECTIONBOX*, float);
int iSelectionBoxIndexOfSelectedGet(SELECTIONBOX*);
string iSelectionBoxTextOfSelectedGet(SELECTIONBOX*);
bool iSelectionBoxIsOver(SELECTIONBOX*);

DROPDOWN* iDropdownCreate(TEXTBOX*, IMAGE*, SELECTIONBOX*);
void iDropdownDestroy(DROPDOWN*);
void iDropdownShow(DROPDOWN*);
void iDropdownHide(DROPDOWN*);

SLIDERBAR* iSliderBarCreate(IMAGE*, IMAGE*);
void iSliderBarDestroy(SLIDERBAR*);
void iSliderBarShow(SLIDERBAR*);
void iSliderBarHide(SLIDERBAR*);
float iSliderBarInterpolatedValueGet(SLIDERBAR*, float, float);
float iSliderBarPercentageOfSliderGet(SLIDERBAR*);
void iSliderBarPercentageOfSliderSet(SLIDERBAR*, float);
void iSliderBarAssignFloat(SLIDERBAR*, float*, float, float);
void iSliderBarReleaseFloat(SLIDERBAR*);

WINDOW* iWindowCreate(IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*, string, FONT*);
void iWindowDestroy(WINDOW*);
void iWindowShow(WINDOW*);
void iWindowHide(WINDOW*);
void iWindowLocationSet(WINDOW*, D3DXVECTOR2);
void iWindowLockSize(WINDOW*);
void iWindowUnLockSize(WINDOW*);
void iWindowLockPosition(WINDOW*);
void iWindowUnLockPosition(WINDOW*);
void iWindowMinSizeSet(WINDOW*, D3DXVECTOR2);
void iWindowMaxSizeSet(WINDOW*, D3DXVECTOR2);
void iWindowAlphaSet(WINDOW*, float);
void iWindowColorSet(WINDOW*, float, float, float);
void iWindowBorderColorSet(WINDOW*, float, float, float);
void iWindowTitleTextColorSet(WINDOW*, float, float, float);
void iWindowBorderAllEventFunctionsSet(WINDOW*, void(int), void(void), void(void), void(int));

Schnitzel

  • 3Impact Newbie
  • *
  • Posts: 10
Re: recons gui system
« Reply #4 on: September 16, 2008, 10:33:07 AM »
Hey Recon,

I was interested in trying your system out, but I cannot for the life of me get it to compile.
I followed your instructions under Dev C++ and continue to get errors.  Compiler reports
that dllgui.h calls iTextBoxCreate to have the following arguments:


dllgui.h----> too many arguments (string, FONT* , IMAGE*, IMAGE*, IMAGE*, IMAGE*, IMAGE*)

but several instances of iTextBoxCreate in the 3impactCode.cpp example file call out only one Image.
lines 255, 267, 419 and 468.
example: Label1 = iTextBoxCreate("Show the demo window", FontWhite, Button1);

I've tried changing the the 3ImpactCode file to match, but I get a crash.
Same as if I change the dllgui.h file.

Your precompiled demo runs great. 

--Is the dllgui.h callout correct for expected arguments?
--Why wouldn't an altered file work?
--Do you have the exact files you compiled the RUN with? 
(Like to check if I have some problem on my end.

The GUI you have looks great.  Let me know if you can help.

Don


mf

  • 3Impact Newbie
  • *
  • Posts: 5
Re: recons gui system
« Reply #5 on: July 30, 2010, 09:38:27 AM »
Hello recon
that is a great works

but i don't know how to include "libGUI.a"
i don't know what is "projects Parameters options"
i'm using visual studio 2008

could you please help me
 :)  :)  :)  :)  :)   :)  :)  :)
thanks.....