GL2D_GUI
1.0.0
Collected on Delphi 10.4 Community
ps: Отрисовка использует старый формат вывода изображения через glBegin/glEnd, в принципе для своих задач он подходит, вершин которые передаются с CPU->GPU не так много как с 3D объектами. Возможно когда нибудь и будет переделываться на буффер VBO
List of files (relevant for version 2.14):
| File | Description |
|---|---|
GUIv2 | Основная папка |
| dlguifont.pas | Work with fonts |
| dlguiform.pas | Form with a list of components |
| dlguiformlist.pas | List of forms incl. their display (Formlist.draw) |
| dlguiobject.pas | The main class from which the components and forms are inherited |
| dlguimouse.pas | Component for displaying the mouse cursor |
| dlguipaletteheelper.pas | The module for working with a palette, according to the coordinates, determines the color in the palette |
| dlguitypes.pas | Types and classes that are used in modules |
| DlguivertexController.pas | Module for working with peaks in objects (components) |
| dlguixmlserial.pas | Serialization of GUI classes in XML format |
components | Компоненты |
| components dlguibevel.pas | Frame |
| components dlguicheckbox.pas | Chekbox (switch) |
| components dlguicombobox.pas | Opening list |
| components dlguieditbox.pas | Text input field (single -line) |
| components dlguiimage.pas | Image |
| components dlguilabel.pas | Text (can be multi -line) |
| components dlguilistbox.pas | List of lines |
| components dlguimainmenu.pas | The main menu |
| components dlguipanel.pas | Panel without components, can be replaced by bevel (frame) |
| components dlguiprogressbar.pas | Loading indicator |
| components dlguiiradiobutton.pas | Selection switches |
| components dlguitable.pas | Table |
| components dlguitrackbar.pas | Selecting a numerical value using a slider |
| components dlguitracker.pas | The tracker (horizontal/vertical) is used for components such as (Combobox, Listbox, Table) ... |
Textures | Модули для работы с текстурами |
| Textures dltextureloader.pas | Module for downloading format textures (BMP, JPG, JPEG, TGA, PNG) |
| Textures dltexturelist.pas | Texture management (search, addition, deletion) |
OpenGL | Модуль для работы с OpenGL |
| Opengl dlopengl.pas | Working with the framework Opengl |
Image | Список изображений |
| Image logo.png | Logo |
| Image guipalette.bmp | Palette for components |
| Image Consolas | Consolas font |
| Images Gadugi | Font Gadugi |
| Images Verdana | Font Verdana |
All components are inherited from the dlguiobject.tguiobject class to download texture, modules are used
To start using GUI, you need
Form:
uses dlGUIForm;
...
var Form : TGUIForm; // Класс формы
...
// Загрузка текстур
TextureList.Add( ' GUI ' , ' .ImageGUIPallette.bmp ' , GL_RGB, GL_MODULATE, GL_NEAREST, True, RGB( 252 , 52 , 252 ));
TextureList.Add( ' GUIFont ' , ' .ImageVerdanaVerdana 8.fgl.png ' , GL_RGBA, GL_MODULATE, GL_LINEAR);
...
Form:= TGUIForm.Create( ' FormName ' , TextureList.Search( ' GUI ' )); // Создание класса формы
Form.Caption:= ' Заголовок формы ' ;
Form.SetRect( 0 , 0 , 200 , 100 ); // Начальная позиция и размер формы
Form.Font.SetTextureLink(TextureList.Search( ' GUIFont ' )); // Установка шрифта формы
// Добавление формы в список форм
FormList.AddForm(Form);
... (render)
FormList.Draw; При добавлении на форму компонентов если у компонента не указана текстура и шрифт, то она назначается такой же как у формы
Button (button):
uses dlGUIButton;
...
var Button: TGUIButton;
...
Button:= TGUIButton.Create; // Создание класса кнопки
Button.SetRect( 10 , 10 , 200 , 10 ); // Позиция и размер кнопки
Button.Caption:= ' Текст кнопки ' ; // Текст
Button.OnClick:= Proc; // Вызываемая процедура
// Включить всплывающую подсказку
Button.Hint.Enable:= True;
Button.Hint.Text := ' Текст всплывающей подсказки ' ;
Button.Flat := False; // Скрыть/Показать рамку кнопки
// Если добавляем на форму
Form.AddComponent(Button);
// Если просто нужно отобразить
Button.Draw;Input field:
uses dlGUIEditBox;
...
var EditBox: TGUIEditBox;
...
EditBox:= TGUIEditBox.Create;
EditBox.SetPos( 10 , 10 , 200 , 20 );
Form.AddComponent(EditBox);