garrynewman / gwen Goto Github PK
View Code? Open in Web Editor NEWAbandoned: GWEN - GUI Without Extravagant Nonsense.
License: MIT License
Abandoned: GWEN - GUI Without Extravagant Nonsense.
License: MIT License
Appears to already be in the list
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.
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.
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 );
}
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?
There is a code issue when compiling with the TDM-GCC variant of MinGW-w64.
It's outlined pretty well by the following:
#ifdef _WIN32
MessageBoxA( NULL, strMsg, "Assert", MB_ICONEXCLAMATION | MB_OK );
_asm { int 3 };
#endif
#ifdef _WIN32
MessageBoxA( NULL, strMsg, "Assert", MB_ICONEXCLAMATION | MB_OK );
#ifdef _MSC_VER
_asm { int 3 };
#else
asm("int $3");
#endif
#endif
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: ๐
Look at that left side! What a jerk! Can anyone reproduce this problem?
It only happens when the single-line text boxes are full.
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.
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.
Just added a default case to the switch and its all fixed!
Calling DisableResizing() on a WindowControl still allows you to resize the control from the bottom left and right corners.
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.
What steps will reproduce the problem?
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.
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 :)
One of the recent commit impacting Utility.cpp break the compatibiltiy with visual studio
(at least for 2008) :(
The fact is that va_copy is a C99 thing and therefore not present in Visual studio...
http://stackoverflow.com/questions/558223/va-copy-porting-to-visual-c
Uses POSIX stat() to get it, so should work on all systems (even windows).
(posted, because github can't even do a revision range, and has no option of embedding patches in issues..gosh, you'd think they'd have that).
https://gist.github.com/4588750
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.
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.
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.
Line 216 of Controls/Layout/Table.h unsigned int RowCount( int i ) does not use the int i argument.
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.
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?
Is the source code for the designer app available somewhere? It needs some fixes and improvements.
It is not currently possible to access the event callbacks on the CrossSplitter, onZoomed, onUnZoomed, and onZoomChange.
There are memory leaks somewhere in UnitTest.
I see many "new" but not "delete".
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
Expose the ability to get a Gwen::Button
's Gwen::ImagePanel
which would allow the ability to better utilize a button's SetImage
method.
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.
I might be missing it; does GWEN have a radial or pie style menu?
These are very useful when using a gamepad.
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.
Gwen/Controls/TextBox.h line 71 "Carat" is misspelled "MakeCaratVisible" should be "MakeCaretVisible" to match up with other uses of "Caret"
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.
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
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.
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" );
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
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.
The FreeImage renderer fails for some reason, in OpenGL::LoadTexture by default. But if I change all the FreeImage_...U() methods to without the U, and pass in pTexture->name.Get().c_str(), it seems to load it fine.
No idea what's going on with that, I've never dealt with wchar, etc.
64 bit building fails on Gwen.cpp:
error C4235: nonstandard extension used : '_asm' keyword not supported on this architecture
MessageBoxA( NULL, strMsg, "Assert", MB_ICONEXCLAMATION | MB_OK );
_asm { int 3 }
and a lot of warnings like this:
warning C4267: 'return' : conversion from 'size_t' to 'int'
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.
(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.
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.
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.
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.
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.
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"
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.
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! :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.