Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFGUI (0.4.0 released)  (Read 383613 times)

0 Members and 7 Guests are viewing this topic.

Cpl.Bator

  • Hero Member
  • *****
  • Posts: 540
    • View Profile
SFGUI
« Reply #195 on: December 18, 2011, 01:19:15 pm »
Thank tank , do you explain how to make our own custom gadget ?

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI
« Reply #196 on: December 18, 2011, 02:22:27 pm »
That will be covered in the user manual when it's written. ;)

For now you have to learn from source code. You can start by looking at sfg::Label or sfg::Button.

Keep in mind that if you throw in own widgets, you can't use the rendering engine for rendering. Instead you have to hardcore the rendering code in InvalidateImpl().

May I ask what kind of widget you need? Maybe it's better to implement it directly in SFGUI.

Cpl.Bator

  • Hero Member
  • *****
  • Posts: 540
    • View Profile
SFGUI
« Reply #197 on: December 18, 2011, 04:47:36 pm »
Custom widget can be graph , tree node , video widget , etc...
i go to see the source for learn. ;)

thx.

xethm55

  • Newbie
  • *
  • Posts: 11
    • View Profile
Debug Build Problems
« Reply #198 on: January 04, 2012, 07:25:13 pm »
I am using one of the nightly builds from a few weeks ago (I tested with an updated version and still have the same problem) and when I try to debug, I get an access violation.  However, when I run in release mode, it works fine.

I am running on Windows 7 32bit with VS2010.

The exact error I get is below:
Code: [Select]

First-chance exception at 0x0f8b980b in ButtonTestd.exe: 0xC0000005: Access violation reading location 0xbaadf011.
Unhandled exception at 0x0f8b980b in ButtonTestd.exe: 0xC0000005: Access violation reading location 0xbaadf011.
The program '[2776] ButtonTestd.exe: Native' has exited with code -1073741819 (0xc0000005).


My project is located here: http://dl.dropbox.com/u/8892717/ButtonTest.zip
It uses premake, you'll need to run:
Code: [Select]
premake4 vs2010

Do I have some linker directive wrong?  I was thinking it might be possibly the string encoding.

[Edit]
Digging further, my problem appears to be that a private member variable, m_delegates, of the public member OnClick in the button class is non Null after the create method call on line 42 in ButtonTest.cpp - only when debugging.  Creating a different signal and assigning it to the OnClick variable results in the test app working.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI
« Reply #199 on: January 04, 2012, 11:43:08 pm »
Please post a complete minimal example (just one .cpp file) and the backtrace of your debugger when the problem happens. Also update your nightly build is applicable.

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
SFGUI
« Reply #200 on: January 05, 2012, 12:20:04 am »
Looks great, Had librocket working well, but going to drop it to try this,


How about a slider widget?


will try it when I have free time, looks great though.










also GUI wise, if anyone needs simple simple, this has got to be the best UI and UI system I have ever seen..

http://www.antisphere.com/Wiki/tools:anttweakbar

works so well. amazing...fast and I like that its C style on top of C++ actually....

love how you can move it about, scale and reacts so well. (I knw how others can also do this , but it just seems smoother.

shame it has no user input/text box + images .

but for in game tools would be great..

xethm55

  • Newbie
  • *
  • Posts: 11
    • View Profile
SFGUI
« Reply #201 on: January 05, 2012, 04:32:52 am »
Here is ButtonTest.cpp (the only cpp file in the above archive)
Code: [Select]

#include <SFGUI/Window.hpp>
#include <SFGUI/Desktop.hpp>
#include <SFGUI/Box.hpp>
#include <SFGUI/Table.hpp>
#include <SFGUI/Label.hpp>
#include <SFGUI/Entry.hpp>
#include <SFGUI/Button.hpp>
#include <SFGUI/Context.hpp>
#include <SFGUI/Engine.hpp>
#include <SFML/Graphics.hpp>

#include <string>
#include <sstream>
#include <cstdlib>


sf::RenderWindow* screen;


void OnButtonClicked()
{
}


int main(int argc, char* argv[])
{

// Initialize the time
screen = new sf::RenderWindow();
screen->Create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP), "Button Test");

// Create two buttons, one Client and one Server
sfg::Button::Ptr cbutton( sfg::Button::Create( "Test" ) );
cbutton->OnClick.Connect( &OnButtonClicked );


// Create a vertical box layout width 5 pixels spacing and add the label
// and button to it.
sfg::Box::Ptr box( sfg::Box::Create( sfg::Box::VERTICAL, 5.f ) );
box->Pack( cbutton, false );

// Create a window and add the box layouter to it. Also set some properties.
sfg::Window::Ptr window( sfg::Window::Create() );
window->Add( box );
window->SetTitle( "Testing" );
window->SetStyle( 3 ); // Title and Background

window->SetPosition(
sf::Vector2f(
static_cast<float>( screen->GetWidth() / 2 ) - window->GetAllocation().Width / 2.f,
static_cast<float>( screen->GetHeight() / 2 ) - window->GetAllocation().Height / 2.f
)
);

// Create a desktop and add the window to it. We need to specify the desktop
// area we want to use. In this case we use SFML window's whole area and
// therefore give it our render window to use its size.
sfg::Desktop desktop( *screen );

desktop.Add( window );

// Main loop!
sf::Event event;

while( ButtonClicked == 0 )
{
// Event processing.
while( screen->PollEvent( event ) )
{
desktop.HandleEvent( event );

// If window is about to be closed, leave program.
if( event.Type == sf::Event::Closed )
{
screen->Close();
}
}

// Rendering.
screen->Clear();
desktop.Expose( *screen );
screen->Display();
}

screen->Clear();

return 0;
}


This is the output of the debugger:
Code: [Select]

'ButtonTestd.exe': Loaded 'C:\Users\Terohnon\Downloads\ButtonTest\bin\ButtonTestd.exe', Symbols loaded.
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Users\Terohnon\Downloads\ButtonTest\bin\sfml-graphics-2.dll', Binary was not built with debug information.
'ButtonTestd.exe': Loaded 'C:\Users\Terohnon\Downloads\ButtonTest\bin\sfml-window-2.dll', Binary was not built with debug information.
'ButtonTestd.exe': Loaded 'C:\Users\Terohnon\Downloads\ButtonTest\bin\sfml-system-2.dll', Binary was not built with debug information.
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Users\Terohnon\Downloads\ButtonTest\bin\sfgui.dll', Binary was not built with debug information.
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\mpr.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\atiglpxx.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\atioglxx.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\atigktxx.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\atiadlxy.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\wtsapi32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Unloaded 'C:\Windows\SysWOW64\atigktxx.dll'
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\atigktxx.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'ButtonTestd.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
First-chance exception at 0x61ea980b in ButtonTestd.exe: 0xC0000005: Access violation reading location 0xbaadf011.
Unhandled exception at 0x77a115ee in ButtonTestd.exe: 0xC0000005: Access violation reading location 0xbaadf011.
The program '[2420] ButtonTestd.exe: Native' has exited with code -1073741819 (0xc0000005).


Note:  This was done on a 64bit Windows 7 System, but the error is the same as the 32 bit system.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
SFGUI
« Reply #202 on: January 05, 2012, 04:30:55 pm »
Recompile all library files yourself (SFML + SFGUI). I think you're trying to mix up Visual Studio versions here.

xethm55

  • Newbie
  • *
  • Posts: 11
    • View Profile
SFGUI
« Reply #203 on: January 05, 2012, 04:46:57 pm »
I am using VC++ 2010 Version 10.0.30319.1 RTMRel.

I was under the impression that all libs build with VS2010 would work with any version of VS2010.  Is that wrong?

What version was used to build the libs supplied in the nightly builds?

[Edit 1]
I built SFML and SFGUI myself and linked them against my ButtonTest application.  I still get the same problems in debug mode.

[Edit 2]
When I link against the sfgui debug libs (build with the Debug target in the SFGUI solution), the test program works just fine.

xethm55

  • Newbie
  • *
  • Posts: 11
    • View Profile
SFGUI
« Reply #204 on: January 05, 2012, 10:10:54 pm »
Linking to the debug libs appears to be a misdirection as I still have problems in other parts of SFGUI - specifically the Entry::GetPositionFromMouseX causes a segfault on line 70, where the m_visible_string is checked (this internally fails at the _Compare() function since the _Ptr points to 0xFFFFFFFF).

All my searches for the problems I am having indicate that the variables are not initialized.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI
« Reply #205 on: January 05, 2012, 10:42:33 pm »
Quote from: "xethm55"
Linking to the debug libs appears to be a misdirection as I still have problems in other parts of SFGUI - specifically the Entry::GetPositionFromMouseX causes a segfault on line 70, where the m_visible_string is checked (this internally fails at the _Compare() function since the _Ptr points to 0xFFFFFFFF).

All my searches for the problems I am having indicate that the variables are not initialized.


GetPositionFromMouseX can't be called before all the members of Entry (including m_visible_string) are properly initialized in Entry's constructor. We also do periodic checks with valgrind to eliminate such programming errors. If m_visible_string isn't constructed properly the only reason would be because SFML didn't do it properly when told by SFGUI. Posting a minimal example as you did before to reproduce this error would be helpful. To reduce the clutter you might want to resort to using http://pastebin.com/ for that.

You said you link to the debug libs. I take it you also build your app in debug mode? If so run the app in your debugger and cause it to crash. Then you can post the full callstack/backtrace here for us to analyze. It is the most helpful piece of information to solve errors such as these.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

xethm55

  • Newbie
  • *
  • Posts: 11
    • View Profile
SFGUI
« Reply #206 on: January 05, 2012, 11:32:02 pm »
I managed to fix all of my debugging problems.  I am able to link to the released dynamic libs from the nightly build as well - and still be able to debug.  The solution was to use the following define:
Code: [Select]

_HAS_ITERATOR_DEBUGGING=0

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
SFGUI
« Reply #207 on: January 07, 2012, 09:02:05 pm »
I get access violation errors for

Code: [Select]


sfg::Label::Ptr _label( sfg::Label::Create( "Hello world!" ) );


Trying the hello world, in a non empty app.


using
Windows 32 Bit, Visual Studio 10 (SFML2 included)

from
http://sfgui.sfml-dev.de/download

Any pointers...no idea where I would go from here?




I am trying to compile from Git, but having massive trouble with Cmake and SFMLDIR...I hate cmake :(,. I point it to a folder where I have  compiled SFML 2..maybe debug/release issue? don't know...it says cant find. if I compile sfml into the same dir as the source from which I build it (using cmake and vs2k8). same issues.......but only trying to compile to see if it fixes the above


I would use the SF forums...but I cant register...I just cant get the captcha right...(I am nearly blind, PS the sound ones are horrible always,)...I can use magnifier, but the captcha is soo faded.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI
« Reply #208 on: January 07, 2012, 09:17:42 pm »
Try creating the Label without passing a string to Create() and setting the text with SetText() after that. This might be related to another quirk I discovered recently.

Quote from: "Elgan"
I get access violation errors for
I would use the SF forums...but I cant register...I just cant get the captcha right...(I am nearly blind, PS the sound ones are horrible always,)...I can use magnifier, but the captcha is soo faded.


This is the sad result of being visited by a massive amount of spammers. Sadly if we make the Captcha any easier they will start showing up en masse again. Maybe Tank can figure something out...
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Elgan

  • Jr. Member
  • **
  • Posts: 77
    • AOL Instant Messenger - Flat+1,+17+st+Cl
    • View Profile
SFGUI
« Reply #209 on: January 07, 2012, 10:06:35 pm »
Okei thanx,

alright:

I made a whole new app, win, console and used the "Hello world" tutorial code.

http://sfgui.sfml-dev.de/guide/getting_started/hello_world


same ,
Code: [Select]


sfg::Label::Ptr _label( sfg::Label::Create( ) );



Quote

Unhandled exception at 0x74efb9bc in sftest.exe: Microsoft C++ exception: std::length_error at memory location 0x0043fce8..