From 959831f4ef5a3e797f576c3de08cd65032c997ad Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 13 Jan 2013 18:54:10 +1000 Subject: Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard. --- .../examples/05.UserInterface/Makefile | 76 +-- .../examples/05.UserInterface/UserInterface.dev | 118 ++--- .../examples/05.UserInterface/UserInterface.vcproj | 326 ++++++------ .../05.UserInterface/UserInterface_vc10.vcxproj | 460 ++++++++--------- .../05.UserInterface/UserInterface_vc11.vcxproj | 468 ++++++++--------- .../05.UserInterface/UserInterface_vc8.vcproj | 462 ++++++++--------- .../05.UserInterface/UserInterface_vc9.vcproj | 460 ++++++++--------- .../examples/05.UserInterface/main.cpp | 566 ++++++++++----------- .../examples/05.UserInterface/tutorial.html | 450 ++++++++-------- 9 files changed, 1693 insertions(+), 1693 deletions(-) (limited to 'libraries/irrlicht-1.8/examples/05.UserInterface') diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/Makefile b/libraries/irrlicht-1.8/examples/05.UserInterface/Makefile index 24cd5d4..f720536 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/Makefile +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/Makefile @@ -1,38 +1,38 @@ -# Makefile for Irrlicht Examples -# It's usually sufficient to change just the target name and source file list -# and be sure that CXX is set to a valid compiler -Target = 05.UserInterface -Sources = main.cpp - -# general compiler settings -CPPFLAGS = -I../../include -I/usr/X11R6/include -CXXFLAGS = -O3 -ffast-math -#CXXFLAGS = -g -Wall - -#default target is Linux -all: all_linux - -ifeq ($(HOSTTYPE), x86_64) -LIBSELECT=64 -endif - -# target specific settings -all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor -all_linux clean_linux: SYSTEM=Linux -all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm -all_win32 clean_win32: SYSTEM=Win32-gcc -all_win32 clean_win32: SUF=.exe -# name of the binary - only valid for targets which set SYSTEM -DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF) - -all_linux all_win32: - $(warning Building...) - $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS) - -clean: clean_linux clean_win32 - $(warning Cleaning...) - -clean_linux clean_win32: - @$(RM) $(DESTPATH) - -.PHONY: all all_win32 clean clean_linux clean_win32 +# Makefile for Irrlicht Examples +# It's usually sufficient to change just the target name and source file list +# and be sure that CXX is set to a valid compiler +Target = 05.UserInterface +Sources = main.cpp + +# general compiler settings +CPPFLAGS = -I../../include -I/usr/X11R6/include +CXXFLAGS = -O3 -ffast-math +#CXXFLAGS = -g -Wall + +#default target is Linux +all: all_linux + +ifeq ($(HOSTTYPE), x86_64) +LIBSELECT=64 +endif + +# target specific settings +all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor +all_linux clean_linux: SYSTEM=Linux +all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm +all_win32 clean_win32: SYSTEM=Win32-gcc +all_win32 clean_win32: SUF=.exe +# name of the binary - only valid for targets which set SYSTEM +DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF) + +all_linux all_win32: + $(warning Building...) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS) + +clean: clean_linux clean_win32 + $(warning Cleaning...) + +clean_linux clean_win32: + @$(RM) $(DESTPATH) + +.PHONY: all all_win32 clean clean_linux clean_win32 diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.dev b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.dev index 6a32ece..0a9e5cd 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.dev +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.dev @@ -1,59 +1,59 @@ -[Project] -FileName=example.dev -Name=Irrlicht Example 05 User Interface -UnitCount=1 -Type=1 -Ver=1 -ObjFiles= -Includes=..\..\include -Libs= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Compiler= -CppCompiler= -Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_ -IsCpp=1 -Icon= -ExeOutput=../../bin/Win32-gcc -ObjectOutput=obj -OverrideOutput=1 -OverrideOutputName=05.UserInterface.exe -HostApplication= -Folders= -CommandLine= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=0000000000000000000000 -UseCustomMakefile=0 -CustomMakefile= - -[Unit1] -FileName=main.cpp -CompileCpp=1 -Folder=Projekt1 -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Irrlicht Engine example compiled using DevCpp and gcc -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - +[Project] +FileName=example.dev +Name=Irrlicht Example 05 User Interface +UnitCount=1 +Type=1 +Ver=1 +ObjFiles= +Includes=..\..\include +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler= +CppCompiler= +Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_ +IsCpp=1 +Icon= +ExeOutput=../../bin/Win32-gcc +ObjectOutput=obj +OverrideOutput=1 +OverrideOutputName=05.UserInterface.exe +HostApplication= +Folders= +CommandLine= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings=0000000000000000000000 +UseCustomMakefile=0 +CustomMakefile= + +[Unit1] +FileName=main.cpp +CompileCpp=1 +Folder=Projekt1 +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Irrlicht Engine example compiled using DevCpp and gcc +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.vcproj b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.vcproj index 4428169..804d986 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.vcproj +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface.vcproj @@ -1,163 +1,163 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc10.vcxproj b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc10.vcxproj index 12c0501..e54b346 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc10.vcxproj +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc10.vcxproj @@ -1,231 +1,231 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - 05.UserInterface - {622C9DD7-0391-49FF-AF53-24F9D5A8EC53} - UserInterface - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - - - - .\Debug/UserInterface.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\05.UserInterface.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Debug/UserInterface.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\05.UserInterface.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Release/UserInterface.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\05.UserInterface.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - .\Release/UserInterface.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\05.UserInterface.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 05.UserInterface + {622C9DD7-0391-49FF-AF53-24F9D5A8EC53} + UserInterface + + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\..\bin\Win32-VisualStudio\ + ..\..\bin\Win64-VisualStudio\ + + + ..\..\bin\Win32-VisualStudio\ + ..\..\bin\Win64-VisualStudio\ + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + .\Debug/UserInterface.tlb + + + + + Disabled + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level3 + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win32-VisualStudio\05.UserInterface.exe + ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) + true + Console + + + + + + + .\Debug/UserInterface.tlb + + + + + Disabled + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level3 + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win64-VisualStudio\05.UserInterface.exe + ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) + true + Console + + + + + + + .\Release/UserInterface.tlb + + + + + MaxSpeed + OnlyExplicitInline + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win32-VisualStudio\05.UserInterface.exe + ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) + Console + + + + + + + .\Release/UserInterface.tlb + + + + + MaxSpeed + OnlyExplicitInline + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win64-VisualStudio\05.UserInterface.exe + ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) + Console + + + + + + + Disabled + Disabled + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + EnableFastChecks + EnableFastChecks + MaxSpeed + MaxSpeed + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + \ No newline at end of file diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc11.vcxproj b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc11.vcxproj index cc6561b..49132a4 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc11.vcxproj +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc11.vcxproj @@ -1,235 +1,235 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - 05.UserInterface - {622C9DD7-0391-49FF-AF53-24F9D5A8EC53} - UserInterface - - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - ..\..\bin\Win32-VisualStudio\ - ..\..\bin\Win64-VisualStudio\ - - - AllRules.ruleset - AllRules.ruleset - - - - - AllRules.ruleset - AllRules.ruleset - - - - - - - - .\Debug/UserInterface.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\05.UserInterface.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Debug/UserInterface.tlb - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - - - Level3 - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\05.UserInterface.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - true - Console - - - - - - - .\Release/UserInterface.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win32-VisualStudio\05.UserInterface.exe - ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - .\Release/UserInterface.tlb - - - - - MaxSpeed - OnlyExplicitInline - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - - - Level3 - - - NDEBUG;%(PreprocessorDefinitions) - 0x0c07 - - - ..\..\bin\Win64-VisualStudio\05.UserInterface.exe - ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) - Console - - - - - - - Disabled - Disabled - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - EnableFastChecks - EnableFastChecks - MaxSpeed - MaxSpeed - %(AdditionalIncludeDirectories) - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - %(PreprocessorDefinitions) - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 05.UserInterface + {622C9DD7-0391-49FF-AF53-24F9D5A8EC53} + UserInterface + + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\..\bin\Win32-VisualStudio\ + ..\..\bin\Win64-VisualStudio\ + + + ..\..\bin\Win32-VisualStudio\ + ..\..\bin\Win64-VisualStudio\ + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + .\Debug/UserInterface.tlb + + + + + Disabled + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level3 + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win32-VisualStudio\05.UserInterface.exe + ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) + true + Console + + + + + + + .\Debug/UserInterface.tlb + + + + + Disabled + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level3 + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win64-VisualStudio\05.UserInterface.exe + ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) + true + Console + + + + + + + .\Release/UserInterface.tlb + + + + + MaxSpeed + OnlyExplicitInline + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win32-VisualStudio\05.UserInterface.exe + ..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories) + Console + + + + + + + .\Release/UserInterface.tlb + + + + + MaxSpeed + OnlyExplicitInline + ..\..\include;%(AdditionalIncludeDirectories) + WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + + + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0c07 + + + ..\..\bin\Win64-VisualStudio\05.UserInterface.exe + ..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories) + Console + + + + + + + Disabled + Disabled + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + EnableFastChecks + EnableFastChecks + MaxSpeed + MaxSpeed + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + + + + + \ No newline at end of file diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc8.vcproj b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc8.vcproj index fdc4fef..fe82faf 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc8.vcproj +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc8.vcproj @@ -1,231 +1,231 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc9.vcproj b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc9.vcproj index e192238..3797cbc 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc9.vcproj +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/UserInterface_vc9.vcproj @@ -1,230 +1,230 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/main.cpp b/libraries/irrlicht-1.8/examples/05.UserInterface/main.cpp index ec52cd5..f45c081 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/main.cpp +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/main.cpp @@ -1,283 +1,283 @@ -/** Example 005 User Interface - -This tutorial shows how to use the built in User Interface of -the Irrlicht Engine. It will give a brief overview and show -how to create and use windows, buttons, scroll bars, static -texts, and list boxes. - -As always, we include the header files, and use the irrlicht -namespaces. We also store a pointer to the Irrlicht device, -a counter variable for changing the creation position of a window, -and a pointer to a listbox. -*/ -#include -#include "driverChoice.h" - -using namespace irr; - -using namespace core; -using namespace scene; -using namespace video; -using namespace io; -using namespace gui; - -#ifdef _IRR_WINDOWS_ -#pragma comment(lib, "Irrlicht.lib") -#endif - -// Declare a structure to hold some context for the event receiver so that it -// has it available inside its OnEvent() method. -struct SAppContext -{ - IrrlichtDevice *device; - s32 counter; - IGUIListBox* listbox; -}; - -// Define some values that we'll use to identify individual GUI controls. -enum -{ - GUI_ID_QUIT_BUTTON = 101, - GUI_ID_NEW_WINDOW_BUTTON, - GUI_ID_FILE_OPEN_BUTTON, - GUI_ID_TRANSPARENCY_SCROLL_BAR -}; - -/* -The Event Receiver is not only capable of getting keyboard and -mouse input events, but also events of the graphical user interface -(gui). There are events for almost everything: Button click, -Listbox selection change, events that say that a element was hovered -and so on. To be able to react to some of these events, we create -an event receiver. -We only react to gui events, and if it's such an event, we get the -id of the caller (the gui element which caused the event) and get -the pointer to the gui environment. -*/ -class MyEventReceiver : public IEventReceiver -{ -public: - MyEventReceiver(SAppContext & context) : Context(context) { } - - virtual bool OnEvent(const SEvent& event) - { - if (event.EventType == EET_GUI_EVENT) - { - s32 id = event.GUIEvent.Caller->getID(); - IGUIEnvironment* env = Context.device->getGUIEnvironment(); - - switch(event.GUIEvent.EventType) - { - - /* - If a scrollbar changed its scroll position, and it is - 'our' scrollbar (the one with id GUI_ID_TRANSPARENCY_SCROLL_BAR), then we change - the transparency of all gui elements. This is a very - easy task: There is a skin object, in which all color - settings are stored. We simply go through all colors - stored in the skin and change their alpha value. - */ - case EGET_SCROLL_BAR_CHANGED: - if (id == GUI_ID_TRANSPARENCY_SCROLL_BAR) - { - s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); - - for (u32 i=0; igetSkin()->getColor((EGUI_DEFAULT_COLOR)i); - col.setAlpha(pos); - env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col); - } - - } - break; - - /* - If a button was clicked, it could be one of 'our' - three buttons. If it is the first, we shut down the engine. - If it is the second, we create a little window with some - text on it. We also add a string to the list box to log - what happened. And if it is the third button, we create - a file open dialog, and add also this as string to the list box. - That's all for the event receiver. - */ - case EGET_BUTTON_CLICKED: - switch(id) - { - case GUI_ID_QUIT_BUTTON: - Context.device->closeDevice(); - return true; - - case GUI_ID_NEW_WINDOW_BUTTON: - { - Context.listbox->addItem(L"Window created"); - Context.counter += 30; - if (Context.counter > 200) - Context.counter = 0; - - IGUIWindow* window = env->addWindow( - rect(100 + Context.counter, 100 + Context.counter, 300 + Context.counter, 200 + Context.counter), - false, // modal? - L"Test window"); - - env->addStaticText(L"Please close me", - rect(35,35,140,50), - true, // border? - false, // wordwrap? - window); - } - return true; - - case GUI_ID_FILE_OPEN_BUTTON: - Context.listbox->addItem(L"File open"); - // There are some options for the file open dialog - // We set the title, make it a modal window, and make sure - // that the working directory is restored after the dialog - // is finished. - env->addFileOpenDialog(L"Please choose a file.", true, 0, -1, true); - return true; - - default: - return false; - } - break; - - case EGET_FILE_SELECTED: - { - // show the model filename, selected in the file dialog - IGUIFileOpenDialog* dialog = - (IGUIFileOpenDialog*)event.GUIEvent.Caller; - Context.listbox->addItem(dialog->getFileName()); - } - break; - - default: - break; - } - } - - return false; - } - -private: - SAppContext & Context; -}; - - -/* -Ok, now for the more interesting part. First, create the Irrlicht device. As in -some examples before, we ask the user which driver he wants to use for this -example: -*/ -int main() -{ - // ask user for driver - video::E_DRIVER_TYPE driverType=driverChoiceConsole(); - if (driverType==video::EDT_COUNT) - return 1; - - // create device and exit if creation failed - - IrrlichtDevice * device = createDevice(driverType, core::dimension2d(640, 480)); - - if (device == 0) - return 1; // could not create selected driver. - - /* The creation was successful, now we set the event receiver and - store pointers to the driver and to the gui environment. */ - - device->setWindowCaption(L"Irrlicht Engine - User Interface Demo"); - device->setResizable(true); - - video::IVideoDriver* driver = device->getVideoDriver(); - IGUIEnvironment* env = device->getGUIEnvironment(); - - /* - To make the font a little bit nicer, we load an external font - and set it as the new default font in the skin. - To keep the standard font for tool tip text, we set it to - the built-in font. - */ - - IGUISkin* skin = env->getSkin(); - IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp"); - if (font) - skin->setFont(font); - - skin->setFont(env->getBuiltInFont(), EGDF_TOOLTIP); - - /* - We add three buttons. The first one closes the engine. The second - creates a window and the third opens a file open dialog. The third - parameter is the id of the button, with which we can easily identify - the button in the event receiver. - */ - - env->addButton(rect(10,240,110,240 + 32), 0, GUI_ID_QUIT_BUTTON, - L"Quit", L"Exits Program"); - env->addButton(rect(10,280,110,280 + 32), 0, GUI_ID_NEW_WINDOW_BUTTON, - L"New Window", L"Launches a new Window"); - env->addButton(rect(10,320,110,320 + 32), 0, GUI_ID_FILE_OPEN_BUTTON, - L"File Open", L"Opens a file"); - - /* - Now, we add a static text and a scrollbar, which modifies the - transparency of all gui elements. We set the maximum value of - the scrollbar to 255, because that's the maximal value for - a color value. - Then we create an other static text and a list box. - */ - - env->addStaticText(L"Transparent Control:", rect(150,20,350,40), true); - IGUIScrollBar* scrollbar = env->addScrollBar(true, - rect(150, 45, 350, 60), 0, GUI_ID_TRANSPARENCY_SCROLL_BAR); - scrollbar->setMax(255); - - // set scrollbar position to alpha value of an arbitrary element - scrollbar->setPos(env->getSkin()->getColor(EGDC_WINDOW).getAlpha()); - - env->addStaticText(L"Logging ListBox:", rect(50,110,250,130), true); - IGUIListBox * listbox = env->addListBox(rect(50, 140, 250, 210)); - env->addEditBox(L"Editable Text", rect(350, 80, 550, 100)); - - // Store the appropriate data in a context structure. - SAppContext context; - context.device = device; - context.counter = 0; - context.listbox = listbox; - - // Then create the event receiver, giving it that context structure. - MyEventReceiver receiver(context); - - // And tell the device to use our custom event receiver. - device->setEventReceiver(&receiver); - - - /* - And at last, we create a nice Irrlicht Engine logo in the top left corner. - */ - env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"), - position2d(10,10)); - - - /* - That's all, we only have to draw everything. - */ - - while(device->run() && driver) - if (device->isWindowActive()) - { - driver->beginScene(true, true, SColor(0,200,200,200)); - - env->drawAll(); - - driver->endScene(); - } - - device->drop(); - - return 0; -} - -/* -**/ +/** Example 005 User Interface + +This tutorial shows how to use the built in User Interface of +the Irrlicht Engine. It will give a brief overview and show +how to create and use windows, buttons, scroll bars, static +texts, and list boxes. + +As always, we include the header files, and use the irrlicht +namespaces. We also store a pointer to the Irrlicht device, +a counter variable for changing the creation position of a window, +and a pointer to a listbox. +*/ +#include +#include "driverChoice.h" + +using namespace irr; + +using namespace core; +using namespace scene; +using namespace video; +using namespace io; +using namespace gui; + +#ifdef _IRR_WINDOWS_ +#pragma comment(lib, "Irrlicht.lib") +#endif + +// Declare a structure to hold some context for the event receiver so that it +// has it available inside its OnEvent() method. +struct SAppContext +{ + IrrlichtDevice *device; + s32 counter; + IGUIListBox* listbox; +}; + +// Define some values that we'll use to identify individual GUI controls. +enum +{ + GUI_ID_QUIT_BUTTON = 101, + GUI_ID_NEW_WINDOW_BUTTON, + GUI_ID_FILE_OPEN_BUTTON, + GUI_ID_TRANSPARENCY_SCROLL_BAR +}; + +/* +The Event Receiver is not only capable of getting keyboard and +mouse input events, but also events of the graphical user interface +(gui). There are events for almost everything: Button click, +Listbox selection change, events that say that a element was hovered +and so on. To be able to react to some of these events, we create +an event receiver. +We only react to gui events, and if it's such an event, we get the +id of the caller (the gui element which caused the event) and get +the pointer to the gui environment. +*/ +class MyEventReceiver : public IEventReceiver +{ +public: + MyEventReceiver(SAppContext & context) : Context(context) { } + + virtual bool OnEvent(const SEvent& event) + { + if (event.EventType == EET_GUI_EVENT) + { + s32 id = event.GUIEvent.Caller->getID(); + IGUIEnvironment* env = Context.device->getGUIEnvironment(); + + switch(event.GUIEvent.EventType) + { + + /* + If a scrollbar changed its scroll position, and it is + 'our' scrollbar (the one with id GUI_ID_TRANSPARENCY_SCROLL_BAR), then we change + the transparency of all gui elements. This is a very + easy task: There is a skin object, in which all color + settings are stored. We simply go through all colors + stored in the skin and change their alpha value. + */ + case EGET_SCROLL_BAR_CHANGED: + if (id == GUI_ID_TRANSPARENCY_SCROLL_BAR) + { + s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); + + for (u32 i=0; igetSkin()->getColor((EGUI_DEFAULT_COLOR)i); + col.setAlpha(pos); + env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col); + } + + } + break; + + /* + If a button was clicked, it could be one of 'our' + three buttons. If it is the first, we shut down the engine. + If it is the second, we create a little window with some + text on it. We also add a string to the list box to log + what happened. And if it is the third button, we create + a file open dialog, and add also this as string to the list box. + That's all for the event receiver. + */ + case EGET_BUTTON_CLICKED: + switch(id) + { + case GUI_ID_QUIT_BUTTON: + Context.device->closeDevice(); + return true; + + case GUI_ID_NEW_WINDOW_BUTTON: + { + Context.listbox->addItem(L"Window created"); + Context.counter += 30; + if (Context.counter > 200) + Context.counter = 0; + + IGUIWindow* window = env->addWindow( + rect(100 + Context.counter, 100 + Context.counter, 300 + Context.counter, 200 + Context.counter), + false, // modal? + L"Test window"); + + env->addStaticText(L"Please close me", + rect(35,35,140,50), + true, // border? + false, // wordwrap? + window); + } + return true; + + case GUI_ID_FILE_OPEN_BUTTON: + Context.listbox->addItem(L"File open"); + // There are some options for the file open dialog + // We set the title, make it a modal window, and make sure + // that the working directory is restored after the dialog + // is finished. + env->addFileOpenDialog(L"Please choose a file.", true, 0, -1, true); + return true; + + default: + return false; + } + break; + + case EGET_FILE_SELECTED: + { + // show the model filename, selected in the file dialog + IGUIFileOpenDialog* dialog = + (IGUIFileOpenDialog*)event.GUIEvent.Caller; + Context.listbox->addItem(dialog->getFileName()); + } + break; + + default: + break; + } + } + + return false; + } + +private: + SAppContext & Context; +}; + + +/* +Ok, now for the more interesting part. First, create the Irrlicht device. As in +some examples before, we ask the user which driver he wants to use for this +example: +*/ +int main() +{ + // ask user for driver + video::E_DRIVER_TYPE driverType=driverChoiceConsole(); + if (driverType==video::EDT_COUNT) + return 1; + + // create device and exit if creation failed + + IrrlichtDevice * device = createDevice(driverType, core::dimension2d(640, 480)); + + if (device == 0) + return 1; // could not create selected driver. + + /* The creation was successful, now we set the event receiver and + store pointers to the driver and to the gui environment. */ + + device->setWindowCaption(L"Irrlicht Engine - User Interface Demo"); + device->setResizable(true); + + video::IVideoDriver* driver = device->getVideoDriver(); + IGUIEnvironment* env = device->getGUIEnvironment(); + + /* + To make the font a little bit nicer, we load an external font + and set it as the new default font in the skin. + To keep the standard font for tool tip text, we set it to + the built-in font. + */ + + IGUISkin* skin = env->getSkin(); + IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp"); + if (font) + skin->setFont(font); + + skin->setFont(env->getBuiltInFont(), EGDF_TOOLTIP); + + /* + We add three buttons. The first one closes the engine. The second + creates a window and the third opens a file open dialog. The third + parameter is the id of the button, with which we can easily identify + the button in the event receiver. + */ + + env->addButton(rect(10,240,110,240 + 32), 0, GUI_ID_QUIT_BUTTON, + L"Quit", L"Exits Program"); + env->addButton(rect(10,280,110,280 + 32), 0, GUI_ID_NEW_WINDOW_BUTTON, + L"New Window", L"Launches a new Window"); + env->addButton(rect(10,320,110,320 + 32), 0, GUI_ID_FILE_OPEN_BUTTON, + L"File Open", L"Opens a file"); + + /* + Now, we add a static text and a scrollbar, which modifies the + transparency of all gui elements. We set the maximum value of + the scrollbar to 255, because that's the maximal value for + a color value. + Then we create an other static text and a list box. + */ + + env->addStaticText(L"Transparent Control:", rect(150,20,350,40), true); + IGUIScrollBar* scrollbar = env->addScrollBar(true, + rect(150, 45, 350, 60), 0, GUI_ID_TRANSPARENCY_SCROLL_BAR); + scrollbar->setMax(255); + + // set scrollbar position to alpha value of an arbitrary element + scrollbar->setPos(env->getSkin()->getColor(EGDC_WINDOW).getAlpha()); + + env->addStaticText(L"Logging ListBox:", rect(50,110,250,130), true); + IGUIListBox * listbox = env->addListBox(rect(50, 140, 250, 210)); + env->addEditBox(L"Editable Text", rect(350, 80, 550, 100)); + + // Store the appropriate data in a context structure. + SAppContext context; + context.device = device; + context.counter = 0; + context.listbox = listbox; + + // Then create the event receiver, giving it that context structure. + MyEventReceiver receiver(context); + + // And tell the device to use our custom event receiver. + device->setEventReceiver(&receiver); + + + /* + And at last, we create a nice Irrlicht Engine logo in the top left corner. + */ + env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"), + position2d(10,10)); + + + /* + That's all, we only have to draw everything. + */ + + while(device->run() && driver) + if (device->isWindowActive()) + { + driver->beginScene(true, true, SColor(0,200,200,200)); + + env->drawAll(); + + driver->endScene(); + } + + device->drop(); + + return 0; +} + +/* +**/ diff --git a/libraries/irrlicht-1.8/examples/05.UserInterface/tutorial.html b/libraries/irrlicht-1.8/examples/05.UserInterface/tutorial.html index 3f3614f..d7dff24 100644 --- a/libraries/irrlicht-1.8/examples/05.UserInterface/tutorial.html +++ b/libraries/irrlicht-1.8/examples/05.UserInterface/tutorial.html @@ -1,225 +1,225 @@ - - -Irrlicht Engine Tutorial - - - - -
- - - - - - - - -
-
-
-
Tutorial 5.User Interface
-
-
-
-

This tutorial shows how to use the built in User Interface of the Irrlicht - Engine. It will give a brief overview and show how to create and use - windows, buttons, scroll bars, static texts and list boxes.

-

The program which is described here will look like this:

-


-

-
-
-
- - - - - - - -
- Lets start!
-

As always, we include the header files (conio and curses for getting - user input from the console), and use the irrlicht namespaces. We also - store a pointer to the Irrlicht device, a counter variable for changing - the creation position of a window, and a pointer to a listbox.

- - - - -
#include <irrlicht.h>
-#include <iostream>
-using namespace irr;
-
using namespace core;
-using namespace scene;
-using namespace video;
-using namespace io;
-using namespace gui;
-
#pragma comment(lib, "Irrlicht.lib")
-
IrrlichtDevice *device = 0;
-s32 cnt = 0;
-IGUIListBox* listbox = 0;
-
-

The Event Receiver is not only capable of getting keyboard and mouse - input events, but also events of the graphical user interface (gui). - There are events for almost everything: Button click, Listbox selection - change, events that say that a element was hovered and so on. To be - able to react to some of these events, we create
- an event receiver. We only react to gui events, and if it's such an - event, we get the id of the caller (the gui element which caused the - event) and get the pointer to the gui environment.

- - - - -
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
-
            switch(event.GUIEvent.EventType)
-            {
-
-

If a scrollbar changed its scroll position, and it is 'our' scrollbar - (the one with id 104), then we change the
- transparency of all gui elements. This is a very easy task: There is - a skin object, in which all color settings are stored. We simply go - through all colors stored in the skin and change their alpha value. -

- - - - -
case EGET_SCROLL_BAR_CHANGED:
if (id == 104)
{
s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();

for (s32 i=0; i<EGDC_COUNT ; ++i)
{
SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
col.setAlpha(pos);
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
}
}
break;
-

If a button was clicked, it could be one of 'our' three buttons. If - it is the first, we shut down the engine.
- If it is the second, we create a little window with some text on it. - We also add a string to the list box to log
- what happened. And if it is the third button, we create a file open - dialog, and add also this as string to the list box.
- That's all for the event receiver.

- - - - -
-
       case EGET_BUTTON_CLICKED:
-              if (id == 101)
-              {
-                 device->closeDevice();
-                 return true;
-              }
-
              if (id == 102)
-              {
-                 listbox->addItem(L"Window created");
-                 cnt += 30;
-                 if (cnt > 200) 
-                   cnt = 0;
-
                 IGUIWindow* window = env->addWindow(
-                       rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt), 
false, // modal? - L"Test window");
-
                 env->addStaticText(L"Please close me", 
-                       rect<s32>(35,35,140,50),
-                       true, // border?,
-                       false, // wordwrap?
-                       window);
-
-                 return true;
-              }
-
              if (id == 103)
-              {
-                 listbox->addItem(L"File open");
-                 env->addFileOpenDialog(L"Please choose a file.");
-                 return true;
-              }
-
              break;
-          }
-       }
-       return false;
-    }
- };
-
-

Ok, now for the more interesting part. First, create the Irrlicht device. - As in some examples before, we ask the user which driver he wants to - use for this example:

-
- - - - -
int main()
-{
-  // ask user for driver
-  video::E_DRIVER_TYPE driverType;
-
-
-  printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");

char i;
std::cin >> i;
- switch(i)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_SOFTWARE; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
} - - // create device and exit if creation failed - device = createDevice(driverType, core::dimension2d<s32>(640, 480));
- if (device == 0) - return 1; -
-
-

The creation was successful, now we set the event receiver and store - pointers to the driver and to the gui environment.

- - - - -
MyEventReceiver receiver;
-device->setEventReceiver(&receiver);
-device->setWindowCaption(L"Irrlicht Engine - User Inferface Demo");
-
video::IVideoDriver* driver = device->getVideoDriver();
-IGUIEnvironment* env = device->getGUIEnvironment();
-
-
-

We add three buttons. The first one closes the engine. The second creates - a window and the third opens a file open dialog. The third parameter is - the id of the button, with which we can easily identify the button in - the event receiver.

- - - - -
env->addButton(rect<s32>(10,240,100,270), 0, 101, L"Quit");
env->addButton(rect<s32>(10,280,100,320), 0, 102, L"New Window");
env->addButton(rect<s32>(10,330,100,370), 0, 103, L"File Open");
-

Now, we add a static text and a scrollbar, which modifies the transparency - of all gui elements. We set the maximum value of the scrollbar to 255, - because that's the maximal value for a color value.
- Then we create an other static text and a list box.

- - - - -
env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);
IGUIScrollBar* scrollbar = env->addScrollBar(true, - rect<s32>(150, 45, 350, 60), 0, 104);
scrollbar->setMax(255);
-
env->addStaticText(L"Logging ListBox:", rect<s32>(50,110,250,130), true);
-listbox = env->addListBox(rect<s32>(50, 140, 250, 210));
-
- To make the font a little bit nicer, we load an external font and set it - as new font in the skin. An at last, we create a nice Irrlicht Engine logo - in the top left corner.
-
- - - - -
IGUISkin* skin = env->getSkin();
IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");
if (font)
skin->setFont(font);
-
IGUIImage* img = env->addImage(
driver->getTexture("../../media/irrlichtlogoalpha.tga"),
position2d<int>(10,10));
-

That's all, we only have to draw everything.

- - - - -
-
  while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,122,65,171)); - env->drawAll(); - driver->endScene(); - } - - device->drop();
-
  return 0;
-}
-
- -
-

 

- - + + +Irrlicht Engine Tutorial + + + + +
+ + + + + + + + +
+
+
+
Tutorial 5.User Interface
+
+
+
+

This tutorial shows how to use the built in User Interface of the Irrlicht + Engine. It will give a brief overview and show how to create and use + windows, buttons, scroll bars, static texts and list boxes.

+

The program which is described here will look like this:

+


+

+
+
+
+ + + + + + + +
+ Lets start!
+

As always, we include the header files (conio and curses for getting + user input from the console), and use the irrlicht namespaces. We also + store a pointer to the Irrlicht device, a counter variable for changing + the creation position of a window, and a pointer to a listbox.

+ + + + +
#include <irrlicht.h>
+#include <iostream>
+using namespace irr;
+
using namespace core;
+using namespace scene;
+using namespace video;
+using namespace io;
+using namespace gui;
+
#pragma comment(lib, "Irrlicht.lib")
+
IrrlichtDevice *device = 0;
+s32 cnt = 0;
+IGUIListBox* listbox = 0;
+
+

The Event Receiver is not only capable of getting keyboard and mouse + input events, but also events of the graphical user interface (gui). + There are events for almost everything: Button click, Listbox selection + change, events that say that a element was hovered and so on. To be + able to react to some of these events, we create
+ an event receiver. We only react to gui events, and if it's such an + event, we get the id of the caller (the gui element which caused the + event) and get the pointer to the gui environment.

+ + + + +
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
+
            switch(event.GUIEvent.EventType)
+            {
+
+

If a scrollbar changed its scroll position, and it is 'our' scrollbar + (the one with id 104), then we change the
+ transparency of all gui elements. This is a very easy task: There is + a skin object, in which all color settings are stored. We simply go + through all colors stored in the skin and change their alpha value. +

+ + + + +
case EGET_SCROLL_BAR_CHANGED:
if (id == 104)
{
s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();

for (s32 i=0; i<EGDC_COUNT ; ++i)
{
SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
col.setAlpha(pos);
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
}
}
break;
+

If a button was clicked, it could be one of 'our' three buttons. If + it is the first, we shut down the engine.
+ If it is the second, we create a little window with some text on it. + We also add a string to the list box to log
+ what happened. And if it is the third button, we create a file open + dialog, and add also this as string to the list box.
+ That's all for the event receiver.

+ + + + +
+
       case EGET_BUTTON_CLICKED:
+              if (id == 101)
+              {
+                 device->closeDevice();
+                 return true;
+              }
+
              if (id == 102)
+              {
+                 listbox->addItem(L"Window created");
+                 cnt += 30;
+                 if (cnt > 200) 
+                   cnt = 0;
+
                 IGUIWindow* window = env->addWindow(
+                       rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt), 
false, // modal? + L"Test window");
+
                 env->addStaticText(L"Please close me", 
+                       rect<s32>(35,35,140,50),
+                       true, // border?,
+                       false, // wordwrap?
+                       window);
+
+                 return true;
+              }
+
              if (id == 103)
+              {
+                 listbox->addItem(L"File open");
+                 env->addFileOpenDialog(L"Please choose a file.");
+                 return true;
+              }
+
              break;
+          }
+       }
+       return false;
+    }
+ };
+
+

Ok, now for the more interesting part. First, create the Irrlicht device. + As in some examples before, we ask the user which driver he wants to + use for this example:

+
+ + + + +
int main()
+{
+  // ask user for driver
+  video::E_DRIVER_TYPE driverType;
+
+
+  printf("Please select the driver you want for this example:\n"\
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
" (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\
" (f) NullDevice\n (otherKey) exit\n\n");

char i;
std::cin >> i;
+ switch(i)
{
case 'a': driverType = video::EDT_DIRECT3D9;break;
case 'b': driverType = video::EDT_DIRECT3D8;break;
case 'c': driverType = video::EDT_OPENGL; break;
case 'd': driverType = video::EDT_SOFTWARE; break;
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
case 'f': driverType = video::EDT_NULL; break;
default: return 1;
} + + // create device and exit if creation failed + device = createDevice(driverType, core::dimension2d<s32>(640, 480));
+ if (device == 0) + return 1; +
+
+

The creation was successful, now we set the event receiver and store + pointers to the driver and to the gui environment.

+ + + + +
MyEventReceiver receiver;
+device->setEventReceiver(&receiver);
+device->setWindowCaption(L"Irrlicht Engine - User Inferface Demo");
+
video::IVideoDriver* driver = device->getVideoDriver();
+IGUIEnvironment* env = device->getGUIEnvironment();
+
+
+

We add three buttons. The first one closes the engine. The second creates + a window and the third opens a file open dialog. The third parameter is + the id of the button, with which we can easily identify the button in + the event receiver.

+ + + + +
env->addButton(rect<s32>(10,240,100,270), 0, 101, L"Quit");
env->addButton(rect<s32>(10,280,100,320), 0, 102, L"New Window");
env->addButton(rect<s32>(10,330,100,370), 0, 103, L"File Open");
+

Now, we add a static text and a scrollbar, which modifies the transparency + of all gui elements. We set the maximum value of the scrollbar to 255, + because that's the maximal value for a color value.
+ Then we create an other static text and a list box.

+ + + + +
env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);
IGUIScrollBar* scrollbar = env->addScrollBar(true, + rect<s32>(150, 45, 350, 60), 0, 104);
scrollbar->setMax(255);
+
env->addStaticText(L"Logging ListBox:", rect<s32>(50,110,250,130), true);
+listbox = env->addListBox(rect<s32>(50, 140, 250, 210));
+
+ To make the font a little bit nicer, we load an external font and set it + as new font in the skin. An at last, we create a nice Irrlicht Engine logo + in the top left corner.
+
+ + + + +
IGUISkin* skin = env->getSkin();
IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");
if (font)
skin->setFont(font);
+
IGUIImage* img = env->addImage(
driver->getTexture("../../media/irrlichtlogoalpha.tga"),
position2d<int>(10,10));
+

That's all, we only have to draw everything.

+ + + + +
+
  while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,122,65,171)); + env->drawAll(); + driver->endScene(); + } + + device->drop();
+
  return 0;
+}
+
+ +
+

 

+ + -- cgit v1.1