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

Author Topic: SFGUI (old thread)  (Read 79993 times)

0 Members and 2 Guests are viewing this topic.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #105 on: October 21, 2010, 12:27:25 am »
Probably Carmack, but best known from the Duke Nukem: Forever guys. ;)

Release date? Don't even think of it in a short time. :) That beast needs a lot of testing by hopefully a couple of developers. But I guess that the source code repository will be published soon.

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
SFGUI (old thread)
« Reply #106 on: October 21, 2010, 01:25:39 am »
Quote from: "Tank"
Probably Carmack, but best known from the Duke Nukem: Forever guys. ;)

Now you mention it... right :D

Quote from: "Tank"
Release date? Don't even think of it in a short time. :) That beast needs a lot of testing by hopefully a couple of developers. But I guess that the source code repository will be published soon.

Looking forward to it :D Keep up the (hopefully) good work ;)

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
SFGUI (old thread)
« Reply #107 on: October 21, 2010, 04:03:16 am »
I wouldn't mind helping out testing it, I need a proper GUI so bad its not even funny. :?

working on a tower defense so i really don't want to roll my own when it comes to buying/upgrading menus and the interface for all that stuff.

I've been procrastinating it for months! (though I got a lot of work done on the game because of it!)


As such I'm most definitely willing to help out any way I can!
John Carmack can Divide by zer0.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #108 on: October 21, 2010, 09:44:56 am »
Quote from: "WitchD0ctor"
working on a tower defense so i really don't want to roll my own when it comes to buying/upgrading menus and the interface for all that stuff.
As such I'm most definitely willing to help out any way I can!

Thank you. The problem I see is at least that when the first bunch of work is complete for SFGUI, you'll get a library with...

a) maybe bugs,
b) maybe a changing interface and
c) a default renderer for the beginning.

The default renderer (BREW) uses sf::Shapes for visuals, and you probably want your user interface to be of a better looking than that. ;) Nevertheless a second rendering engine, that uses sf::Sprites for the visuals (and therefore images), has already been planned, but of course it will take some time.

I'm happy that at least two developers are willing to help testing the library, that's great! But please keep always in mind that SFGUI is under heavy(!) development, and the chance that things will be changed massively is there (of course I try to avoid that by designing SFGUI properly before implementing, but problems arise everywhere ;)).

Some words regarding the progress:
The box sizer is completely finished now. It supports vertical and horizontal alignment, padding between packed widgets, a border width and the flags 'expand' (use as much space as possible) and 'fill' (fill out the complete assigned size). It's tested and behaves good so far. :)

The next steps are:
- sfg::Workspace: A class that manages an SFGUI context (to activate different renderers) but is also a container for sfg::Windows (mostly you'll start by creating a workspace and adding windows to it).
- SFML event handling: Theoretically completed, needs to be implemented now. It will happen in a way where you don't have to care about SFML events at all, but just use the widget's signals to connect your functionality.

When those two fat todos are done, I'll continue by writing a theme loader for loading renderer-specific properties, 1-2 more widgets and will then publish the repository.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #109 on: October 26, 2010, 07:25:35 pm »
A little sneak preview of the box sizers and buttons together with BREW rendering and first draft of SFML event handling in combination with SFGUI's signalling system:

The most stuff is of course happening internally and you might think: "What the hell, that looked better the last time!" Yep, true, but it won't in some weeks. ;)

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
SFGUI (old thread)
« Reply #110 on: October 26, 2010, 08:26:18 pm »
I just watched. And I want it. NOW! :D Really, I like that. Nice and neat. Congrat, and keep up the good work, Tank ;) (Except when the window oversized the screen... a part of me died then :))

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #111 on: October 26, 2010, 08:44:49 pm »
You hopefully will never have so many widgets that a window doesn't fit onto the screen. :)

pierreyoda

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://pierreyoda.pagesperso-orange.fr/
SFGUI (old thread)
« Reply #112 on: October 27, 2010, 10:50:02 am »
Amazing! Can't wait for!  :D
Projects:
- Open Rodent's Revenge (rewriting in progress)
- Open Advanced War (paused)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #113 on: October 27, 2010, 04:19:24 pm »
- Draggable widgets implemented (up to now sfg::Window for moving it around).
- Reworked eventing for container widgets (especially event hooking that took place in sfg::Widget before).
- Basic window style/behaviour flags (titlebar, background, resizable)

I can't believe how smooth the progress is going on. If it continues like it does now, then I think I'll get something ready to test for you in a not too far future.

I will post a new screencast when per-widget style properties and proper font management is implemented. You have maybe already recognized that the buttons look rather huge because they have no clue about how large the font is set in the style properties, so they use sf::Font::GetDefaultFont() to get the text metrics. So still some design questions to solve. ;)

nfries88

  • Newbie
  • *
  • Posts: 42
    • View Profile
SFGUI (old thread)
« Reply #114 on: October 27, 2010, 10:22:26 pm »
"SFGUI is released under the terms and conditions of the GNU LGPL."

O:

I was expecting BSD licensed, since SFML is also BSD licensed. Oh well.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFGUI (old thread)
« Reply #115 on: October 27, 2010, 10:48:02 pm »
Quote
I was expecting BSD licensed, since SFML is also BSD licensed

SFML uses the zlib/png license ;)
Laurent Gomila - SFML developer

nfries88

  • Newbie
  • *
  • Posts: 42
    • View Profile
SFGUI (old thread)
« Reply #116 on: October 27, 2010, 11:23:19 pm »
Quote from: "Laurent"
Quote
I was expecting BSD licensed, since SFML is also BSD licensed

SFML uses the zlib/png license ;)


Oh. Well, I tend to think of everything as BSD-style vs GPL-style, since those are the two big ones. My bad.
zlib is just as well. The big thing for me is being able to ship it with BSD-licensed systems and being able to statically link to it in a closed-source application.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #117 on: October 28, 2010, 12:47:55 am »
"SFGUI is released under the terms and conditions of the GNU LGPL."
Since SFGUI hasn't been released yet, it's subject to change. :)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #118 on: November 06, 2010, 08:03:03 pm »
Update, additions:
- Window movement (made possible by implementing most of the eventing stuff, hooking etc. pp.)
- Per-widget properties to override the render engine's (or theme's) properties to make single widget look differently.
- Lazy update of requisition and allocation sizes to improve performance (reducing calls to render engine and other objects).
- Window styles (titlebar, movable, resizable, transparent).
- A loooot of internal modifications and additions.

For your eyes:

The code used for the example (neither clean nor beautiful, be warned):
Code: [Select]
#include <SFGUI/Window.hpp>
#include <SFGUI/Button.hpp>
#include <SFGUI/Box.hpp>
#include <SFGUI/Engines/BREW.hpp>
#include <SFML/Graphics.hpp>

class SampleApp {
public:
void Run();

private:
void OnAddButtonHClick( sfg::Widget::Ptr widget );
void OnAddButtonVClick( sfg::Widget::Ptr widget );
void OnNewButtonClick( sfg::Widget::Ptr widget );
void OnToggleTitlebarClick( sfg::Widget::Ptr widget );
void OnHideWindowClicked( sfg::Widget::Ptr widget );

sfg::Window::Ptr  m_wndmain;
sfg::Box::Ptr  m_boxbuttonsh;
sfg::Box::Ptr  m_boxbuttonsv;
};

void SampleApp::Run() {
sf::RenderWindow  window( sf::VideoMode( 1024, 768, 32 ), "SFGUI test" );
sf::Event  event;

//window.UseVerticalSync( true );

// Create widgets.
m_wndmain = sfg::Window::Create();
m_wndmain->SetName( "wndmain" );
m_wndmain->SetTitle( L"Example application" );
m_wndmain->SetBorderWidth( 10.f );

sfg::Button::Ptr  btnaddbuttonh( sfg::Button::Create( L"Add button horizontally" ) );
sfg::Button::Ptr  btnaddbuttonv( sfg::Button::Create( L"Add button vertically" ) );
sfg::Button::Ptr  btntoggletitlebar( sfg::Button::Create( L"Toggle titlebar" ) );
sfg::Button::Ptr  btnhidewindow( sfg::Button::Create( L"Close window" ) );

btnaddbuttonh->SetProperty<std::string>( "Button.background-color", "#ff0000" );
btnaddbuttonh->SetProperty<std::string>( "Button:prelight.background-color", "#ff9999" );
btnaddbuttonv->SetProperty<std::string>( "Button.background-color", "#000055" );
btnaddbuttonv->SetProperty<std::string>( "Button:prelight.background-color", "#5555bb" );

btnaddbuttonh->GetChild()->SetProperty<unsigned int>( "Label.font-size", 20 );
btntoggletitlebar->GetChild()->SetProperty<unsigned int>( "Label.font-size", 28 );
btntoggletitlebar->SetPadding( 15.f );

// Layout.
sfg::Box::Ptr  boxtoolbar( sfg::Box::Create( sfg::Box::Horizontal ) );
boxtoolbar->SetName( "boxtoolbar" );
boxtoolbar->SetSpacing( 5.f );
boxtoolbar->Pack( btnaddbuttonh, false );
boxtoolbar->Pack( btnaddbuttonv, false );
boxtoolbar->Pack( btntoggletitlebar, false );
boxtoolbar->Pack( btnhidewindow, false );

m_boxbuttonsh = sfg::Box::Create( sfg::Box::Horizontal );
m_boxbuttonsh->SetSpacing( 5.f );

m_boxbuttonsv = sfg::Box::Create( sfg::Box::Vertical );
m_boxbuttonsv->SetSpacing( 5.f );

sfg::Box::Ptr  boxmain( sfg::Box::Create( sfg::Box::Vertical ) );
boxmain->SetSpacing( 5.f );
boxmain->Pack( boxtoolbar, false );
boxmain->Pack( m_boxbuttonsh, false );
boxmain->Pack( m_boxbuttonsv, false );

m_wndmain->Add( boxmain );

// Signals.
btnaddbuttonh->OnClick.Connect( &SampleApp::OnAddButtonHClick, this );
btnaddbuttonv->OnClick.Connect( &SampleApp::OnAddButtonVClick, this );
btntoggletitlebar->OnClick.Connect( &SampleApp::OnToggleTitlebarClick, this );
btnhidewindow->OnClick.Connect( &SampleApp::OnHideWindowClicked, this );

while( window.IsOpened() ) {
while( window.GetEvent( event ) ) {
if( m_wndmain->HandleEvent( event ) == sfg::Widget::EatEvent ) {
continue;
}

if( event.Type == sf::Event::Closed ) {
window.Close();
}
}

window.Clear( sf::Color( 80, 80, 80 ) );
m_wndmain->Expose( window );
window.Display();
}
}

void SampleApp::OnAddButtonHClick( sfg::Widget::Ptr /*widget*/ ) {
sfg::Button::Ptr  button( sfg::Button::Create( L"New ->" ) );

boost::shared_dynamic_cast<sfg::Label>( button->GetChild() )->SetAlignment( sf::Vector2f( 1.f, .5f ) );
button->OnClick.Connect( &SampleApp::OnNewButtonClick, this );

m_boxbuttonsh->Pack( button, true );
}

void SampleApp::OnAddButtonVClick( sfg::Widget::Ptr /*widget*/ ) {
sfg::Button::Ptr  button( sfg::Button::Create( L"<- New" ) );

boost::shared_dynamic_cast<sfg::Label>( button->GetChild() )->SetAlignment( sf::Vector2f( 0.f, .5f ) );
button->OnClick.Connect( &SampleApp::OnNewButtonClick, this );

m_boxbuttonsv->Pack( button, false );
}

void SampleApp::OnNewButtonClick( sfg::Widget::Ptr widget ) {
sfg::Button::Ptr  button( boost::shared_dynamic_cast<sfg::Button>( widget ) );

button->SetLabel( "Ouch" );
}

void SampleApp::OnToggleTitlebarClick( sfg::Widget::Ptr /*widget*/ ) {
m_wndmain->SetStyle( m_wndmain->GetStyle() ^ sfg::Window::Titlebar );
}

void SampleApp::OnHideWindowClicked( sfg::Widget::Ptr /*widget*/ ) {
m_wndmain->Show( !m_wndmain->IsVisible() );
}

int main() {
SampleApp  app;
app.Run();
return 0;
}

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #119 on: January 13, 2011, 01:15:08 pm »
Hellooo,

Do you have some news about SFGUI Tank ?
Want to play movies in your SFML application? Check out sfeMovie!