Skip to content

Commit

Permalink
Fixed the tooltips offset.
Browse files Browse the repository at this point in the history
This was coming from the fact of using the OS cursor only, as CEGUI considers
it being 0x0 in size, and then computes the offset badly in that case.
I thus added an empty 12x12 cursor and used it without hiding the system one.

I also removed a obsolete comments and explained another one.

Fixes OpenDungeons#337
  • Loading branch information
Yohann Ferreira committed Dec 30, 2014
1 parent c79266d commit 712ccab
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
1 change: 0 additions & 1 deletion gui/OpenDungeonsOldSkin.imageset
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
<Image height="6" name="MultiLineEditboxBottomLeft" width="6" xPos="41" yPos="100" />
<Image height="7" name="MultiLineEditboxBottomRight" width="7" xPos="60" yPos="98" />
<Image height="8" name="MultiLineEditboxBackdrop" width="8" xPos="50" yPos="88" />
<Image height="18" name="MouseArrow" width="17" xPos="138" yPos="127" />
<Image height="1" name="TabHorizontalFiller" width="8" xPos="195" yPos="201" />
<Image height="8" name="TabContentPaneMiddle" width="8" xPos="50" yPos="88" />
<Image height="17" name="TabButtonScrollLeftNormal" width="16" xPos="96" yPos="108" />
Expand Down
Binary file modified gui/OpenDungeonsOldSkin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gui/OpenDungeonsSkin.imageset
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<Image height="8" name="TooltipLeftEdge" width="4" xPos="67" yPos="96" />
<Image height="8" name="TooltipRightEdge" width="4" xPos="103" yPos="96" />
<Image height="8" name="TooltipMiddle" width="32" xPos="71" yPos="96" />
<Image height="12" name="MouseArrow" width="12" xPos="0" yPos="0" />
<Image height="13" name="MouseMoveCursor" width="13" xPos="184" yPos="45" />
<Image height="13" name="MouseNoSoCursor" width="6" xPos="143" yPos="45" />
<Image height="5" name="MouseEsWeCursor" width="13" xPos="124" yPos="49" />
Expand Down
5 changes: 0 additions & 5 deletions source/entities/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*TODO list:
* - replace hardcoded calculations by scripts and/or read the numbers from XML defintion files
* - the doUpkeep() functions needs script support
*/

#include "entities/Creature.h"

#include "entities/CreatureAction.h"
Expand Down
11 changes: 5 additions & 6 deletions source/render/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

//TODO: The event handlers should be call functions to AS instead of hardcoded so that we can
// script the GUI actions. Maybe even register CEGUI to AS to make it fully scripted?
// Then we could easily adjust the GUI without recompiling.

#include "render/Gui.h"

#include "render/ODFrameListener.h"
Expand Down Expand Up @@ -70,8 +66,11 @@ Gui::Gui()

CEGUI::SchemeManager::getSingleton().createFromFile("OpenDungeonsSkin.scheme");

// CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setImage("OpenDungeons/MouseArrow");
// CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setVisible(true);
// Needed to get the correct offset when using up to CEGUI 0.8.4
// We're thus using an empty mouse cursor.
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("OpenDungeonsSkin/MouseArrow");
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setVisible(true);

CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("OD/Tooltip");

CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr();
Expand Down
4 changes: 3 additions & 1 deletion source/render/ODFrameListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ bool ODFrameListener::frameRenderingQueued(const Ogre::FrameEvent& evt)
CEGUI::System::getSingleton().getDefaultGUIContext().injectTimePulse(evt.timeSinceLastFrame);

// Sleep to limit the framerate to the max value
// FIXME: This 2.0 should be a 1.0 but this gives the correct result. This probably indicates a bug.
// Note: This 2.0 should be a 1.0 but this gives the correct result.
// As sleep functions can't be too accurate themselves (as they do take time to compute after all)
// Thus, giving some free time to them helps getting the correct behaviour...
double frameDelay = (2.0 / ODApplication::MAX_FRAMES_PER_SECOND) - evt.timeSinceLastFrame;
if (frameDelay > 0.0)
{
Expand Down

3 comments on commit 712ccab

@hwoarangmy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good

@hwoarangmy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On windows, I see the standard mouse cursor. However, tooltips seem better displayed

EDIT: I think it comes from InputManager.cpp:
paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));

But I don't really know what should be there

@Bertram25
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit isn't meant to make OD use some kind of custom mouse arrow. I left the OS cursor on purpose for now.
I must say my actual goal is still to use the hand mesh above all layers.

Please sign in to comment.