Merge revision 4812:4822 from trunk to ogl-es:

- Fix compile troubles on VS. Thx @Foaly for reporting.
- Animated dwarfes are more fun.
- Reset group-page as well when calling CGUIProfiler::firstPage.
- Ignore binary 17.
- Add examples 17 and 30+ to Linux build support.
- Fix warnings.
- Fix typo in comment.
- CGUIProfiler can now handle it when a group doesn't fit on a single page.
- Add interface for easier access to scrollbars for IGUIListBox, IGUITreeView and IGUITable
- Add IGUITable::getItemHeight


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4853 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2014-05-08 17:38:19 +00:00
parent bf9f3a3b5d
commit 901ec7b0da
16 changed files with 197 additions and 28 deletions

View File

@ -7,6 +7,7 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- Add interface for easier access to scrollbars for IGUIListBox, IGUITreeView and IGUITable
- Fix serializing colors as strings. Was previously mixing up strings with number-arrays and hex color values. Now using hex color values always, but also fixed the the handling when it get's number-array strings.
- Fix IAttributes::setAttribute implementation for textures (did do nothing before).
- Added support for separate blending in OpenGL and D3D9 drivers.
@ -14,6 +15,7 @@ Changes in 1.9 (not yet released)
- Added BlendFactor field to SMaterial which allow user to set blending factor per SMaterial set call without use EMT_ONETEXTURE_BLEND type.
- Fixed issue with blending operation set to EBO_NONE and some transparent material types.
- Add a code profiler (stop-watch style)
- Add IGUITable::getItemHeight to access item (row) height
- Add override font to IGUITable
- IGUITable can now disable the active column.
- IGUIElement::getElementFromPoint now virtual

View File

@ -0,0 +1,39 @@
# 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 = 17.HelloWorld_Mobile
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: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
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

View File

@ -378,13 +378,11 @@ void Q3Player::respawn ()
Device->getLogger()->log( "respawn" );
if ( StartPositionCurrent >= Q3StartPosition (
Mesh, camera,StartPositionCurrent++,
cam ()->getEllipsoidTranslation() )
)
{
if (StartPositionCurrent >= Q3StartPosition(Mesh, camera,
StartPositionCurrent, cam()->getEllipsoidTranslation()))
StartPositionCurrent = 0;
}
else
++StartPositionCurrent;
}
/*
@ -2023,12 +2021,11 @@ void CQuake3EventHandler::Animate()
// Query Scene Manager attributes
if ( player->Anim[0].flags & FIRED )
{
ISceneManager *smgr = Game->Device->getSceneManager ();
wchar_t msg[128];
IVideoDriver * driver = Game->Device->getVideoDriver();
IAttributes * attr = smgr->getParameters();
#ifdef _IRR_SCENEMANAGER_DEBUG
IAttributes * attr = Game->Device->getSceneManager()->getParameters();
swprintf ( msg, 128,
L"Q3 %s [%ls], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)",
Game->CurrentMapName.c_str(),

View File

@ -255,7 +255,7 @@ public:
{
irr::f32 gapZ = z > 0 ? (z-1)*GAP : 0.f;
irr::f32 posZ = -halfSizeZ + z*extent.Z + gapZ;
scene::IMeshSceneNode * node = SceneManager->addMeshSceneNode (mesh, NULL, -1, vector3df(posX, posY, posZ) );
scene::IAnimatedMeshSceneNode * node = SceneManager->addAnimatedMeshSceneNode(aniMesh, NULL, -1, vector3df(posX, posY, posZ) );
node->setMaterialFlag(video::EMF_LIGHTING, false);
}
}

View File

@ -1,4 +1,4 @@
DIRS = $(wildcard [012]* Demo)
DIRS = $(wildcard [0123]* Demo)
all: $(DIRS)

View File

@ -13,6 +13,7 @@ namespace irr
namespace gui
{
class IGUISpriteBank;
class IGUIScrollBar;
//! Enumeration for listbox colors
enum EGUI_LISTBOX_COLOR
@ -128,6 +129,9 @@ namespace gui
//! Sets whether to draw the background
virtual void setDrawBackground(bool draw) = 0;
//! Access the vertical scrollbar
virtual IGUIScrollBar* getVerticalScrollBar() const = 0;
};

View File

@ -13,6 +13,7 @@ namespace irr
namespace gui
{
class IGUIFont;
class IGUIScrollBar;
//! modes for ordering used when a column header is clicked
enum EGUI_COLUMN_ORDERING
@ -208,6 +209,15 @@ namespace gui
/** Currently this is the override font when one is set and the
font of the active skin otherwise */
virtual IGUIFont* getActiveFont() const = 0;
//! Get the height of items/rows
virtual s32 getItemHeight() const = 0;
//! Access the vertical scrollbar
virtual IGUIScrollBar* getVerticalScrollBar() const = 0;
//! Access the horizontal scrollbar
virtual IGUIScrollBar* getHorizontalScrollBar() const = 0;
};

View File

@ -15,6 +15,7 @@ namespace gui
{
class IGUIFont;
class IGUITreeView;
class IGUIScrollBar;
//! Node for gui tree view
@ -268,6 +269,12 @@ namespace gui
//! Returns the node which is associated to the last event.
/** This pointer is only valid inside the OnEvent call! */
virtual IGUITreeViewNode* getLastEventNode() const = 0;
//! Access the vertical scrollbar
virtual IGUIScrollBar* getVerticalScrollBar() const = 0;
//! Access the horizontal scrollbar
virtual IGUIScrollBar* getHorizontalScrollBar() const = 0;
};

View File

@ -906,6 +906,11 @@ void CGUIListBox::setDrawBackground(bool draw)
DrawBack = draw;
}
//! Access the vertical scrollbar
IGUIScrollBar* CGUIListBox::getVerticalScrollBar() const
{
return ScrollBar;
}
} // end namespace gui
} // end namespace irr

View File

@ -131,6 +131,9 @@ namespace gui
//! Sets whether to draw the background
virtual void setDrawBackground(bool draw) _IRR_OVERRIDE_;
//! Access the vertical scrollbar
virtual IGUIScrollBar* getVerticalScrollBar() const _IRR_OVERRIDE_;
private:
struct ListItem

View File

@ -2,14 +2,11 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
// Written by Michael Zeilfelder
// TODO: We should have more pages for groups that don't fit into the display area.
// So additional to CurrentGroupIdx we would also have a current-page-for-current-group thing.
// The interface doesn't have to be changed for that - just the implementation.
#include "CGUIProfiler.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUITable.h"
#include "IGUIScrollBar.h"
#include "IGUIEnvironment.h"
#include "CProfiler.h"
@ -21,7 +18,7 @@ namespace gui
//! constructor
CGUIProfiler::CGUIProfiler(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIProfiler(environment, parent, id, rectangle)
, DisplayTable(0), CurrentGroupIdx(0), IgnoreUncalled(false)
, DisplayTable(0), CurrentGroupIdx(0), CurrentGroupPage(0), NumGroupPages(1), IgnoreUncalled(false)
{
Profiler = &getProfiler();
@ -118,6 +115,49 @@ void CGUIProfiler::updateDisplay()
}
}
}
// IGUITable has no page-wise scrolling yet. The following code can be replaced when we add that.
// For now we use some CGUITable implementation info to figure this out.
// (If you wonder why I didn't code page-scrolling directly in CGUITable ... because then it needs to be a
// public interface and I don't have enough time currently to design & implement that well)
s32 itemsTotalHeight = DisplayTable->getRowCount() * DisplayTable->getItemHeight();
s32 tableHeight = DisplayTable->getAbsolutePosition().getHeight();
s32 heightTitleRow = DisplayTable->getItemHeight()+1;
if ( itemsTotalHeight+heightTitleRow < tableHeight )
{
NumGroupPages = 1;
}
else
{
s32 heightHScrollBar = DisplayTable->getHorizontalScrollBar() ? DisplayTable->getHorizontalScrollBar()->getAbsolutePosition().getHeight() : 0;
s32 pageHeight = tableHeight - (heightTitleRow+heightHScrollBar);
if ( pageHeight > 0 )
{
NumGroupPages = (itemsTotalHeight/pageHeight);
if ( itemsTotalHeight % pageHeight )
++NumGroupPages;
}
else // won't see anything, but that's up to the user
{
NumGroupPages = DisplayTable->getRowCount();
}
if ( NumGroupPages < 1 )
NumGroupPages = 1;
}
if ( CurrentGroupPage < 0 )
CurrentGroupPage = (s32)NumGroupPages-1;
IGUIScrollBar* vScrollBar = DisplayTable->getVerticalScrollBar();
if ( vScrollBar )
{
if ( NumGroupPages < 2 )
vScrollBar->setPos(0);
else
{
f32 factor = (f32)CurrentGroupPage/(f32)(NumGroupPages-1);
vScrollBar->setPos( s32(factor * (f32)vScrollBar->getMax()) );
}
}
}
}
@ -133,27 +173,41 @@ void CGUIProfiler::draw()
void CGUIProfiler::nextPage(bool includeOverview)
{
if ( ++CurrentGroupIdx >= Profiler->getGroupCount() )
if ( CurrentGroupPage < NumGroupPages-1 )
++CurrentGroupPage;
else
{
if ( includeOverview )
CurrentGroupIdx = 0;
else
CurrentGroupIdx = 1; // can be invalid
CurrentGroupPage = 0;
if ( ++CurrentGroupIdx >= Profiler->getGroupCount() )
{
if ( includeOverview )
CurrentGroupIdx = 0;
else
CurrentGroupIdx = 1; // can be invalid
}
}
}
void CGUIProfiler::previousPage(bool includeOverview)
{
if ( CurrentGroupIdx > 0 )
--CurrentGroupIdx;
else
CurrentGroupIdx = Profiler->getGroupCount()-1;
if ( CurrentGroupIdx == 0 && !includeOverview )
if ( CurrentGroupPage > 0 )
{
if ( Profiler->getGroupCount() )
--CurrentGroupPage;
}
else
{
CurrentGroupPage = -1; // unknown because NumGroupPages has to be re-calculated first
if ( CurrentGroupIdx > 0 )
--CurrentGroupIdx;
else
CurrentGroupIdx = Profiler->getGroupCount()-1;
if ( CurrentGroupIdx == 0 )
CurrentGroupIdx = 1; // invalid to avoid showing the overview
if ( CurrentGroupIdx == 0 && !includeOverview )
{
if ( Profiler->getGroupCount() )
CurrentGroupIdx = Profiler->getGroupCount()-1;
if ( CurrentGroupIdx == 0 )
CurrentGroupIdx = 1; // invalid to avoid showing the overview
}
}
}
@ -163,6 +217,7 @@ void CGUIProfiler::firstPage(bool includeOverview)
CurrentGroupIdx = 0;
else
CurrentGroupIdx = 1; // can be invalid
CurrentGroupPage = 0;
}

View File

@ -69,6 +69,8 @@ namespace gui
IProfiler * Profiler;
irr::gui::IGUITable* DisplayTable;
irr::u32 CurrentGroupIdx;
irr::s32 CurrentGroupPage;
irr::s32 NumGroupPages;
bool IgnoreUncalled;
};

View File

@ -1099,6 +1099,24 @@ IGUIFont* CGUITable::getActiveFont() const
return 0;
}
//! Get the height of items/rows
s32 CGUITable::getItemHeight() const
{
return ItemHeight;
}
//! Access the vertical scrollbar
IGUIScrollBar* CGUITable::getVerticalScrollBar() const
{
return VerticalScrollBar;
}
//! Access the horizontal scrollbar
IGUIScrollBar* CGUITable::getHorizontalScrollBar() const
{
return HorizontalScrollBar;
}
//! Writes attributes of the element.
void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{

View File

@ -152,6 +152,15 @@ namespace gui
//! Get the font which is used right now for drawing
virtual IGUIFont* getActiveFont() const _IRR_OVERRIDE_;
//! Get the height of items/rows
virtual s32 getItemHeight() const _IRR_OVERRIDE_;
//! Access the vertical scrollbar
virtual IGUIScrollBar* getVerticalScrollBar() const _IRR_OVERRIDE_;
//! Access the horizontal scrollbar
virtual IGUIScrollBar* getHorizontalScrollBar() const _IRR_OVERRIDE_;
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.

View File

@ -1081,6 +1081,18 @@ void CGUITreeView::setImageList( IGUIImageList* imageList )
}
}
//! Access the vertical scrollbar
IGUIScrollBar* CGUITreeView::getVerticalScrollBar() const
{
return ScrollBarV;
}
//! Access the horizontal scrollbar
IGUIScrollBar* CGUITreeView::getHorizontalScrollBar() const
{
return ScrollBarH;
}
} // end namespace gui
} // end namespace irr

View File

@ -297,6 +297,12 @@ namespace gui
virtual IGUITreeViewNode* getLastEventNode() const _IRR_OVERRIDE_
{ return LastEventNode; }
//! Access the vertical scrollbar
virtual IGUIScrollBar* getVerticalScrollBar() const _IRR_OVERRIDE_;
//! Access the horizontal scrollbar
virtual IGUIScrollBar* getHorizontalScrollBar() const _IRR_OVERRIDE_;
private:
//! calculates the heigth of an node and of all visible nodes.
void recalculateItemHeight();