Giter Site home page Giter Site logo

gwen's People

Contributors

ananace avatar billyquith avatar deekayht avatar epajarre avatar garrynewman avatar hyperknot avatar jamiehales avatar jeremieroy avatar meoo avatar narutoua avatar nem0 avatar qehgt avatar raptorfactor avatar simonboorer avatar topblast avatar voodooattack avatar wizzard033 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gwen's Issues

OpenGL Renderer doesn't display anything? SFML Renderer works great though.

I created a test app using SDL 2.x (unreleased) and using the OpenGL renderer. All that is shown is this: http://wstaw.org/m/2013/01/21/plasma-desktopyJS671.png (the canvas background color, which is set to green, with what I presume is the bottom-right edge centered on the center of the screen).

So if only one thing is wrong, it's the coordinate system in this renderer.
code using renderer:

https://gist.github.com/4591362

So I used the sample code that used the SFML renderer. This works beautifully, as shown below (with the unit test)
http://wstaw.org/m/2013/01/22/plasma-desktopngU671.png

I'll step through it and debug it, see what it's doing wrong and keep this post updated with my status.

TreeControl extreme slow with many children (+workaround)

When adding 10k or 100k items in the list, the performance of TreeControl grinds to a halt. Reproduction: simply add a while loop in the UnitTest.cpp

char msg[1024];
for (int i=0; i < 10000;i++)
{
sprintf(msg,"Node %d",i);
Gwen::UnicodeString txt =Gwen::Utility::StringToUnicode(msg);
ctrl->AddNode( msg);//L"Node One" );
}

It seems the TreeControl::OnChildBoundsChanged is called many times, and causes the slowdown.

When uncommenting the "m_ScrollControl->UpdateScrollBars();" , it becomes fast, and you can have 10.000 or even 100.000 items in the TreeControl. Obviously, you have to make sure the 'UpdateScrollBars()' is still called, whenever changes happen.

Perhaps GWEN could use lazy evaluation for the UpdateScrollBars?

GWEN OpenGL 3.x compatible renderer

Hello everyone!

I'm started to working on a OpenGL 3.x compatible renderer for GWEN.

Sadly i have some issues with the Alpha blending in my shader (maybe.)

I think, i found the problem. My shader allways try to use the texture's alpha.
I'm looking for a good replacement of the Fixed Function Pipeline's gl_disable( GL_TEXTURE_2D)
(Or maybe i have to use two shaders...)

You can found my branch here : https://github.com/dhodvogner/GWEN

I don't have so much time to work on it, so if someone found mistake(s), or have a good/better idea, feel free to contribute :)

Dragging is not available when the control under the mouse is set to be SetMouseInputEnabled(false)

Hi Garry,

Just noticed that you moved here from google code. It's a really simple and straight forward gui lib. I'm enjoying using it in my game : )

Last week I met a problem which I couldn't find an easy fix for it. For all "pages"(which is a fullscreen node containing everything in one screen frame), I set the page root to be SetMouseInputEnabled(false), so that the return value of Gwen::Input::Windows::ProcessMessage() could be used to determine whether that input event is swallowed by gwen. In this case, any docked control is not draggable because DragAndDrop::HoveredControl is NULL, which prevents the drag&drop from further processing. Do you have any idea about it?

Unicode support.

(Haha yes of course I would talk about this, but this has actually affect people's decisions in using GWEN.)

This isn't one specific issue, but kind of a few but they revolve around a few decisions and implementations.

wchar_t and char usage

So last time I talked about this, I've been an avid wchar_t hater. I still don't use it, but GWEN is designed around it, so it's all fine. What does bother me is how the API uses a mix of wchar_t and char. For instance, in Platform.h we have a mix of String& and UnicodeString&. We have Unicode clipboard text (woo!) but no Unicode window titles. It's not consistent.

I'd suggest moving entirely to wchar_t, and converting internally. The only place I'd see useful for char is UTF-8 APIs like SDL, Allegro which take char* for all their stuff, which is internal.
The alternative is using entirely char UTF-8, which sucks on Windows, but I have heard that BlackPhoenix has an entire UTF-8 port of GWEN.

Current conversion code.

Simply put: The current conversion code is broken. It's easily fixable by pulling in a header-only library and using that. This actually affects things right now like Allegro's UTF-8 API not being used properly when drawing text.

No window visible at all using CrossPlatform sample on Linux

I'm on linux mint 64 bit using gcc 4.7.2 and I built GWEN with this simple SConstruct file:

sources = []
incpath = ["include"]

sources += Glob("src/*.cpp")
sources += Glob("src/Platforms/*.cpp")
sources += Glob("src/Controls/*.cpp")
sources += Glob("src/Controls/Dialog/*.cpp")
sources += Glob("UnitTest/*.cpp")

# OpenGL
sources += Glob("Renderers/OpenGL/*.cpp")
sources += Glob("Renderers/OpenGL/DebugFont/*.cpp")
incpath += ["Renderers/OpenGL/FreeImage"]
incpath += ["Renderers/OpenGL/DebugFont"]

Library(target = 'libgwen', source = sources, CPPPATH = incpath)

And compiled the CrossPlatform sample by cd'ing into the directory and using this command:

g++ CrossPlatform.cpp -I../../include -L../../ -lgwen -lGL -lfreeimage

When running the resulting a.out I get no window, no output or anything, just a programme that isn't finishing.

I may have misunderstood and in fact CrossPlatform means a null renderer, but I was expecting to get a quick look at GWEN and see if it is suitable for my project.

OnPress Callback

hi everyone , i'm have problem with gui callback

pseudo code
void Ret_CallBack(Gwen::Controls::Base *p)
{
//some code
}

Gwen::Controls::Button *pButton = new Gwen::Controls::Button(pCanvas);
//pCanvas == SFML Window
pButton->SetText(L"CLICK ME!");
pButton->OnPress.Add(pCanvas,&_CallBack);

I'm not understand template to CallBack function

Someone can help me , upload own code /
not using UnitTest( with this classes)

sorry bad eng! :)

void Text::RefreshSizeWrap() Memory leak!

Code for example:
for ( int i=1;i < 50000; i++ )
{
Label* label = new Label( pCanvas );
label->SetWrap( true );
label->SetSize( 200, 200 );
label->SetBounds(0,0,i,i);//Calls Text::RefreshSizeWrap()
}

fix it please, thx

Text rendering outside of TextBox when full (SFML2 renderer)

I have spent quite a while trying to find out why this is happening. For now, I'm going to give up and leave this issue here with the intention of fixing it eventually if nobody else does.

Problem: ๐Ÿ‘Ž

grosstext

Look at that left side! What a jerk! Can anyone reproduce this problem?
It only happens when the single-line text boxes are full.

MinGW-w64 compile issue

There is a code issue when compiling with the TDM-GCC variant of MinGW-w64.
It's outlined pretty well by the following:

Current code:
#ifdef _WIN32
            MessageBoxA( NULL, strMsg, "Assert", MB_ICONEXCLAMATION | MB_OK );
            _asm { int 3 };
#endif
Proposed change:
#ifdef _WIN32
            MessageBoxA( NULL, strMsg, "Assert", MB_ICONEXCLAMATION | MB_OK );
#ifdef _MSC_VER
            _asm { int 3 };
#else
            asm("int $3");
#endif
#endif

AltGR

Hi,

first thanks for the great gui.
I have an issue, when an textbox (or similar) is focused a pressing of the "alt gr" key seems to block the input. This happends with gwen unitest or my apps build with codeblock on win7x64

Tabs/windows moving problem

  1. Move Output window on Collapsible List window to create Tabs.
    1
  2. Move Collapsible List window by it's own tab somewhere.
    2
  3. Now we have two Collapsible List windows.
    3

Designer source?

Is the source code for the designer app available somewhere? It needs some fixes and improvements.

Replace Gwen::Event::Packet with void*

If you're trying to store user-defined data, the best type to do it with is a void pointer.
The current implementation does not fit my needs.

Implemented in a local copy.. ask if you want it.

Texture and font paths have no real system to them

Texture paths are just specified relative, but this doesn't actually work. We need to be able to specify some kind of dir to load the textures, then every texture call after that will be relative to that dir.

Currently it just does LoadTexture("someimage.png"), which means it has to be right next to it.

Same thing applies to setting the fonts of a skin, etc.

TreeControl - Nested Nodes Incorrect Positions.

When a nested node with children is toggled it does not invalidate the parent node which causes the node to remain the same size. This can be fixed by adding InvalidateParent() into TreeNode::Open/Close.

But this reveals another error in that the parent node's total height is calculated before the children are given a chance to recalculate their layout size. This means the layout will always be behind one step.

Temporary fix would be to remove the if statement in Base::RecursiveLayout():

if ( NeedsLayout() )
{
    m_bNeedsLayout = false;
    Layout( skin );
}

Though this obviously comes with a performance hit, as every layout will be recalculated every render and may cause flicker.

File.h Including Wrong Header

Gwen\Controls\Property\File.h line 8 is including #include "Gwen/Controls/Dialogs/FolderOpen.h" when it should be including #include "Gwen/Controls/Dialogs/FileOpen.h"

Horz/Vert ScrollBar Nudge Notification

It seems like its impossible currently to get notification of a scrollbar nudge. The update chain leads to:

void VerticalScrollBar::OnBarMoved( Controls::Base* control )
{
    if ( m_Bar->IsDepressed() )
    {
        SetScrolledAmount( CalculateScrolledAmount(), false );
        BaseClass::OnBarMoved(control);
    }
    else
    {
        InvalidateParent();
    }
}

However, a nudge does not depress the bar, and as such no event is ever triggered.

My current solution is to change:

void HorizontalScrollBar::NudgeRight( Base* /*control*/ )
{
    if ( !IsDisabled() )
        SetScrolledAmount( GetScrolledAmount() + GetNudgeAmount(), true);
}

To:

void HorizontalScrollBar::NudgeRight( Base* /*control*/ )
{
    if ( !IsDisabled() )
    {
        bool result = SetScrolledAmount( GetScrolledAmount() + GetNudgeAmount(), true);

        if(result)
            BaseClass::OnBarMoved(this);
    }
}

Which seems to work fine in practice along with changing the NudgeLeft as well (And Nudges for the Vertical bar as well), but perhaps I'm missing something?

I could certainly inherit the scrollbars, and over ride the nudges myself, but that seems a bit wasteful.

Slider line color

Is it possible to override or set in the png template the slider line color?

I noticed it's hard-coded, but I was wondering if this can be changed in a way that makes sense for everybody.

ComboBox open list upward

I have a bunch of combo boxes at the bottom of the screen and when I open the selection the list is being cropped, is it possible to open the list upward?

thanks.

screen shot 2013-08-07 at 11 18 20

Radial Menu?

I might be missing it; does GWEN have a radial or pie style menu?
These are very useful when using a gamepad.

ComboBox selected item name is null

Hi,

I'm trying to use the selected item and eventually select another one.
GetSelectedItem return a label without the name, SelectItemByName then doesn't produce any results.

Gwen::Controls::Label *selectedLabel = mComboBox->GetSelectedItem();
selectedLabel->GetName(); // this is empty

EDIT: I realised that I need to pass label and name when I add the item.

SFML2 sample: add pushGLStates/popGLStates around the GWEN display call

Hi,
The SFML2 sample shows this to render Gwen:

App.clear();
pCanvas->RenderCanvas();
App.display();

It works as long as you don't render anything else than GWEN, otherwise the OpenGL states are screwed-up.
It's ok with pushGLStates/popGLStates around the GWEN display call:

App.clear();
doRenderMy3DWorld();
App.pushGLStates();
pCanvas->RenderCanvas();
App.popGLStates();
App.display();

No big deal anyway.

Button Click Handling

I posted some details about this on the google page, but it seems like that list of issues isn't be updated anymore so I'm re-posting here. Please let me know if this is wrong.

The basic problem is that when you initially click into a button, it gets assigned as the MouseFocus object. Your then able to move the mouse out of the button, while still holding the click down, then release the mouse button.

This results in button performing its clicking action, despite the mouse not actually being over it. You can actually continually click and trigger the button while outside of it doing this, until you move the mouse while the button is not held down.

Otherwise, really liking this framework so far, thanks for building it.

UnitTest/TextBox uses nonfree/not cross platform fonts

This coincides with #11, after we get a generic loader/resource path specifier, then we'll have to switch to some other font (probably ship with one, like DejaVuSans.ttf comes to mind).

EDIT: It uses not only Impact, but Microsoft Sans Serif (in Skins/Simple, TexturedBase as well) as default fonts.

The unit tests use Impact and Comic Sans MS.

Controls::Textbox Spelling Error

Gwen/Controls/TextBox.h line 71 "Carat" is misspelled "MakeCaratVisible" should be "MakeCaretVisible" to match up with other uses of "Caret"

SFML renderer MeasureText issues (width of space character)

SFML2 returns a width of 0 for the space glyph, which end up connecting to issues caused with multi line labels (all text ends up on the same line due to bounds not incrementing correctly). This may apply to SFML as well, though I haven't checked.

A semi hacky solution (tested to solve the multi line problem, but not much beyond that) is the following MeasureText function (the last 4 lines in the else statement being the brunt of the fix):

Gwen::Point Gwen::Renderer::SFML2::MeasureText( Gwen::Font* pFont, const Gwen::UnicodeString& text )
{
    // If the font doesn't exist, or the font size should be changed
    if ( !pFont->data || fabs( pFont->realsize - pFont->size * Scale() ) > 2 )
    {
        FreeFont( pFont );
        LoadFont( pFont );
    }
    
    const sf::Font* pSFFont = reinterpret_cast( pFont->data );
    
    sf::FloatRect sz;
    
    // MULTI LINE FIX: problem was SFML measuring spaces as having no dimensions
    if (text != L" ") {
        sf::Text sfStr;
        sfStr.setString( text );
        sfStr.setFont( *pSFFont );
        sfStr.setScale( Scale(), Scale() );
        sfStr.setCharacterSize( pFont->realsize );
        sz = sfStr.getLocalBounds();
    }
    else {
        sf::Text sfStr;
        sfStr.setString( text );
        sfStr.setFont( *pSFFont );
        sfStr.setScale( Scale(), Scale() );
        sfStr.setCharacterSize( pFont->realsize );
        sz = sfStr.getLocalBounds();
    
        // SFML gives 0 dimensions for a space, use advance and line spacing instead
        sz.left = 0.0f;
        sz.top = 0.0f;
        sz.width = pSFFont->getGlyph(L' ', pFont->realsize, false).advance;
        sz.height = pSFFont->getLineSpacing(pFont->realsize);
    }
    
    return Gwen::Point( sz.left + sz.width, sz.top + sz.height );
}

Slider margin and padding

SetMargin on a slider only move the bar but NOT the handle.

SetPadding instead doesn't affect the slider at all.

screen shot 2013-07-23 at 12 38 31

slider call SetFloatValue without calling onValueChanged

Hi,

I need to set the float value for a slider without calling the onValueChanged handler which should only be called when the value is set by the mouse click on the slider.
I looked at the Slider source code and this seems not possible without changing the SetFloatValue signature to allow an extra parameter "ignoreEvent" or something like that.
This would be my approach, but I want to double check if I'm the only one that needs this feature and if there is a work around with the current api.

thanks.

Scroll control and tree views

The early out block of code in Scrollcontrol::Updatescrollbar prevents scroll bars being available when adding long tree views to dock pages. Commenting this out appears to work as expected but presumably there is a reason for that code that I'm not aware of and there may be need for a proper fix.

UnitTest failures

The unit tests have no way of running properly because they don't include test16.png, or "missingimage.png". These files aren't in the repo from what I could see, so I wasn't sure what they should be.

grep -Ri ".png"
UnitTest/Button.cpp: pButtonC->SetImage( L"test16.png" );
UnitTest/Button.cpp: pButtonD->SetImage( L"test16.png" );
UnitTest/ImagePanel.cpp: img->SetImage( L"gwen.png" );
UnitTest/ImagePanel.cpp: img->SetImage( L"missingimage.png" );
UnitTest/MenuStrip.cpp: pRoot->GetMenu()->AddItem( L"New", L"test16.png", "Ctrl + N" )->SetAction( this, &ThisClass::MenuItemSelect );
UnitTest/MenuStrip.cpp: pRoot->GetMenu()->AddItem( L"Load", L"test16.png", "Ctrl+L" )->SetAction( this, &ThisClass::MenuItemSelect );
UnitTest/MenuStrip.cpp: pRootB->GetMenu()->AddItem( "Two.Nine", "test16.png" );
UnitTest/MenuStrip.cpp: pRootB->GetMenu()->AddItem( "Six.Five", "test16.png" );
UnitTest/TabControl.cpp: pDragMe->AddPage( L"Reorder" )->SetImage( L"test16.png" );

Coding Standards?

I was wondering if there is any coding standard that you'd like us to conform to when making commits to the GWEN code. I noticed some recent code that was merged in had inconsistent if/else statements and had converted tabs into spaces.

Use a platform independent cursor

A platform independent cursor ought to be added to GWEN.
SFML can hide the platform's mouse cursor. With that, another one could be drawn.

SFML2 copy and paste bug

There is a bug with SFML2 input that makes copy and paste not work.
The following fix goes in include/Gwen/Input/SFML.h:

                        case sf::Event::KeyPressed:
                        case sf::Event::KeyReleased:
                            {
#if SFML_VERSION_MAJOR == 2
                                bool bPressed = ( event.type == sf::Event::KeyPressed );
                                char keyCode = event.key.code + 97;
                                bool control = event.key.control;

                                if ( control && bPressed && keyCode >= 'a' && keyCode <= 'z' )
                                {
                                    return m_Canvas->InputCharacter( keyCode );
                                }

                                unsigned char iKey = TranslateKeyCode( event.key.code );
#else
                                bool bPressed = ( event.Type == sf::Event::KeyPressed );
                                char keyCode = event.Key.Code;
                                bool control = event.Key.Control;

                                if ( control && bPressed && keyCode >= 'a' && keyCode <= 'z' )
                                {
                                    return m_Canvas->InputCharacter( keyCode );
                                }

                                unsigned char iKey = TranslateKeyCode( keyCode );
#endif

                                return m_Canvas->InputKey( iKey, bPressed );
                            }

Note the keyCode conversion (adding 97) that turns the event.key.code into an ASCII character.

SFML and SFML2 input fix for dragging windows outside the rendering area

When using SFML for input in windowed mode, dragging things off the window creates some weird behavior. This includes window controls being dragged sticking to the mouse cursor until the left mouse button is pressed again.

I fixed it by giving GWEN mouse button released events when the mouse leaves the window for all the mouse buttons. This fix includes the fixes described in issue #63 and issue #62.
CTRL+F "added"

/*
    GWEN
    Copyright (c) 2011 Facepunch Studios
    See license in Gwen.h
*/

#pragma once
#ifndef GWEN_INPUT_SFML_H
#define GWEN_INPUT_SFML_H

#include "Gwen/InputHandler.h"
#include "Gwen/Gwen.h"
#include "Gwen/Controls/Canvas.h"

#include <SFML/Window/Event.hpp>

namespace Gwen
{
    namespace Input
    {
        class SFML
        {
            public:

                SFML()
                {
                    m_Canvas = NULL;
                    m_MouseX = 0;
                    m_MouseY = 0;
                    /* ADDED */
                    m_LeftMouseDown = false;
                    m_RightMouseDown = false;
                    m_MiddleMouseDown = false;
                    m_XButton1MouseDown = false;
                    m_XButton2MouseDown = false;
                }

                void Initialize( Gwen::Controls::Canvas* c )
                {
                    m_Canvas = c;
                }

                unsigned char TranslateKeyCode( int iKeyCode )
                {
                    switch ( iKeyCode )
                    {
#if SFML_VERSION_MAJOR == 2

                        case sf::Keyboard::BackSpace:
                            return Gwen::Key::Backspace;

                        case sf::Keyboard::Return:
                            return Gwen::Key::Return;

                        case sf::Keyboard::Escape:
                            return Gwen::Key::Escape;

                        case sf::Keyboard::Tab:
                            return Gwen::Key::Tab;

                        case sf::Keyboard::Space:
                            return Gwen::Key::Space;

                        case sf::Keyboard::Up:
                            return Gwen::Key::Up;

                        case sf::Keyboard::Down:
                            return Gwen::Key::Down;

                        case sf::Keyboard::Left:
                            return Gwen::Key::Left;

                        case sf::Keyboard::Right:
                            return Gwen::Key::Right;

                        case sf::Keyboard::Home:
                            return Gwen::Key::Home;

                        case sf::Keyboard::End:
                            return Gwen::Key::End;

                        case sf::Keyboard::Delete:
                            return Gwen::Key::Delete;

                        case sf::Keyboard::LControl:
                            return Gwen::Key::Control;

                        case sf::Keyboard::LAlt:
                            return Gwen::Key::Alt;

                        case sf::Keyboard::LShift:
                            return Gwen::Key::Shift;

                        case sf::Keyboard::RControl:
                            return Gwen::Key::Control;

                        case sf::Keyboard::RAlt:
                            return Gwen::Key::Alt;

                        case sf::Keyboard::RShift:
                            return Gwen::Key::Shift;
#else

                        case sf::Key::Back:
                            return Gwen::Key::Backspace;

                        case sf::Key::Return:
                            return Gwen::Key::Return;

                        case sf::Key::Escape:
                            return Gwen::Key::Escape;

                        case sf::Key::Tab:
                            return Gwen::Key::Tab;

                        case sf::Key::Space:
                            return Gwen::Key::Space;

                        case sf::Key::Up:
                            return Gwen::Key::Up;

                        case sf::Key::Down:
                            return Gwen::Key::Down;

                        case sf::Key::Left:
                            return Gwen::Key::Left;

                        case sf::Key::Right:
                            return Gwen::Key::Right;

                        case sf::Key::Home:
                            return Gwen::Key::Home;

                        case sf::Key::End:
                            return Gwen::Key::End;

                        case sf::Key::Delete:
                            return Gwen::Key::Delete;

                        case sf::Key::LControl:
                            return Gwen::Key::Control;

                        case sf::Key::LAlt:
                            return Gwen::Key::Alt;

                        case sf::Key::LShift:
                            return Gwen::Key::Shift;

                        case sf::Key::RControl:
                            return Gwen::Key::Control;

                        case sf::Key::RAlt:
                            return Gwen::Key::Alt;

                        case sf::Key::RShift:
                            return Gwen::Key::Shift;
#endif
                    }

                    return Gwen::Key::Invalid;
                }

                bool ProcessMessage( sf::Event & event )
                {
                    if ( !m_Canvas ) { return false; }

#if SFML_VERSION_MAJOR == 2

                    switch ( event.type )
#else
                    switch ( event.Type )
#endif
                    {
                        case sf::Event::MouseMoved:
                            {
#if SFML_VERSION_MAJOR == 2
                                int dx = event.mouseMove.x - m_MouseX;
                                int dy = event.mouseMove.y - m_MouseY;
                                m_MouseX = event.mouseMove.x;
                                m_MouseY = event.mouseMove.y;
#else
                                int dx = event.MouseMove.X - m_MouseX;
                                int dy = event.MouseMove.Y - m_MouseY;
                                m_MouseX = event.MouseMove.X;
                                m_MouseY = event.MouseMove.Y;
#endif
                                return m_Canvas->InputMouseMoved( m_MouseX, m_MouseY, dx, dy );
                            }

                        case sf::Event::MouseButtonPressed:
                            {
#if SFML_VERSION_MAJOR == 2
                                sf::Mouse::Button button = event.mouseButton.button;
#else
                                sf::Mouse::Button button = event.MouseButton.Button;
#endif
                                /* ADDED */
                                if      (button == sf::Mouse::Left)     m_LeftMouseDown     = true;
                                else if (button == sf::Mouse::Right)    m_RightMouseDown    = true;
                                else if (button == sf::Mouse::Middle)   m_MiddleMouseDown   = true;
                                else if (button == sf::Mouse::XButton1) m_XButton1MouseDown = true;
                                else if (button == sf::Mouse::XButton2) m_XButton2MouseDown = true;
                                return m_Canvas->InputMouseButton( button, true );
                            }

                        case sf::Event::MouseButtonReleased:
                            {
#if SFML_VERSION_MAJOR == 2
                                sf::Mouse::Button button = event.mouseButton.button;
#else
                                sf::Mouse::Button button = event.MouseButton.Button;
#endif
                                /* ADDED */
                                if      (button == sf::Mouse::Left)     m_LeftMouseDown     = false;
                                else if (button == sf::Mouse::Right)    m_RightMouseDown    = false;
                                else if (button == sf::Mouse::Middle)   m_MiddleMouseDown   = false;
                                else if (button == sf::Mouse::XButton1) m_XButton1MouseDown = false;
                                else if (button == sf::Mouse::XButton2) m_XButton2MouseDown = false;
                                return m_Canvas->InputMouseButton( button, false );
                            }

                        /* ADDED */
                        case sf::Event::MouseLeft:
                            {
                                if (m_LeftMouseDown)     { m_LeftMouseDown     = false; m_Canvas->InputMouseButton( sf::Mouse::Left,     false ); }
                                if (m_RightMouseDown)    { m_RightMouseDown    = false; m_Canvas->InputMouseButton( sf::Mouse::Right,    false ); }
                                if (m_MiddleMouseDown)   { m_MiddleMouseDown   = false; m_Canvas->InputMouseButton( sf::Mouse::Middle,   false ); }
                                if (m_XButton1MouseDown) { m_XButton1MouseDown = false; m_Canvas->InputMouseButton( sf::Mouse::XButton1, false ); }
                                if (m_XButton2MouseDown) { m_XButton2MouseDown = false; m_Canvas->InputMouseButton( sf::Mouse::XButton2, false ); }
                                break;
                            }

                        case sf::Event::MouseWheelMoved:
                            {
#if SFML_VERSION_MAJOR == 2
                                return m_Canvas->InputMouseWheel( event.mouseWheel.delta * 60 );
#else
                                return m_Canvas->InputMouseWheel( event.MouseWheel.Delta * 60 );
#endif
                            }

                        case sf::Event::TextEntered:
                            {
#if SFML_VERSION_MAJOR == 2
                                return m_Canvas->InputCharacter( event.text.unicode );
#else
                                return m_Canvas->InputCharacter( event.Text.Unicode );
#endif
                            }

                        case sf::Event::KeyPressed:
                        case sf::Event::KeyReleased:
                            {
#if SFML_VERSION_MAJOR == 2
                                bool bPressed = ( event.type == sf::Event::KeyPressed );
                                char keyCode = event.key.code + 97;
                                bool control = event.key.control;

                                if ( control && bPressed && keyCode >= 'a' && keyCode <= 'z' )
                                {
                                    return m_Canvas->InputCharacter( keyCode );
                                }

                                unsigned char iKey = TranslateKeyCode( event.key.code );
#else
                                bool bPressed = ( event.Type == sf::Event::KeyPressed );
                                char keyCode = event.Key.Code;
                                bool control = event.Key.Control;

                                if ( control && bPressed && keyCode >= 'a' && keyCode <= 'z' )
                                {
                                    return m_Canvas->InputCharacter( keyCode );
                                }

                                unsigned char iKey = TranslateKeyCode( keyCode );
#endif

                                return m_Canvas->InputKey( iKey, bPressed );
                            }
                        default:
                            break;
                    }

                    return false;
                }

            protected:

                Gwen::Controls::Canvas*    m_Canvas;
                int m_MouseX;
                int m_MouseY;
                /* ADDED */
                bool m_LeftMouseDown;
                bool m_RightMouseDown;
                bool m_MiddleMouseDown;
                bool m_XButton1MouseDown;
                bool m_XButton2MouseDown;

        };
    }
}
#endif

No way the unit test can work on non-Windows platforms

The OpenGL sample uses windows stuff instead of something like GLEW, and the "CrossPlatform" sample uses Gwen::Controls::WindowCanvas, which due to there being no !Windows implementation, other than Null in Platform/*, it will crash.

Specifically, it will attempt to use a Null platform and not return a void* for a method that returns one, which on most compilers will cause an "illegal hardware instruction".

So I'm trying to work through this just to get it (an example, or anything) to run on Linux.

Custom font destructor

When using custom font for elements like Label in UnitTest:
m_Font.facename = L"Comic Sans MS";
m_Font.size = 25;
Gwen::Controls::Label* label = new Gwen::Controls::Label( this );
label->SetText( L"Custom Font (Comic Sans 25)" );
label->SetFont( &m_Font );
label->SizeToContents();
label->SetPos( 10, 170 );

There is no call FreeFont to renderer when m_Font dies. It causes some memory leaks.

ResizableControl::DisableResizing doesn't completely disable resizing

What steps will reproduce the problem?

  1. Create a new WindowControl control.
  2. Call its DisableResizing function
  3. Run the test and move the cursor to any corner

What is the expected output? What do you see instead?
The window shouldn't be resizeable, instead, the cursor turns to diagonal resize, and the window can be resized like normal, also, the unresizeable window title bar looks sightly bigger

What version of the product are you using? On what operating system?
I've tried it using latest Gwen files, dated 20 December 2012, tested on Windows XP Professional x86 and using DirectX9 renderer.

Please provide any additional information below.
GDIPlus_Image1

x64 build - VC2012

64 bit building fails on Gwen.cpp:
error C4235: nonstandard extension used : '_asm' keyword not supported on this architecture

ifdef _WIN32

        MessageBoxA( NULL, strMsg, "Assert", MB_ICONEXCLAMATION | MB_OK );
        _asm { int 3 }

endif

and a lot of warnings like this:
warning C4267: 'return' : conversion from 'size_t' to 'int'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.