Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] Re: (PR#7123) Metaissue for FS
Home

[Freeciv-Dev] Re: (PR#7123) Metaissue for FS

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#7123) Metaissue for FS
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Tue, 23 Dec 2003 01:16:19 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7123 >

On Mon, Dec 22, 2003 at 11:37:54AM -0800, Raimar Falke wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7123 >
> 
> On Sat, Dec 20, 2003 at 07:43:56AM -0800, Raimar Falke wrote:
> > 
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7123 >
> > 
> > 
> > Overview
> > ========
> > 
> > This is an issue which should track the development of a new client
> > called FS. Lacking a better name I named it gui-fs. FS stands for
> > fixed size or full screen. The idea:
> >  - OS and graphical API independent client
> >  - fixed size (one of 640x480, 800x600, 1024x768, 1280x1024), but
> >  multiple possible
> >  - own widget set to get all the features we want (borders, skins,
> >  transparency, tooltips, ...)
> > 
> > gui-fs is similar to gui-sdl but not limited to SDL. It currently
> > supports plain X11. Planned/possible is also DirectX (or some other
> > Win API), Amiga, SDL, BeOS,...
> > 
> > You can view screenshots at http://www.freeciv.org/~rfalke/fs_pics/
> 
> I updated the code to the current CVS and fixed some errors.
> 
> I copied the start screens of http://arianne.sourceforge.net/ and
> http://www.ospace.net/ to see how difficult the creation is and to
> adapt the code.

I think I found a nice model here which I will implement new year.

You have a background image. You have a set of elements. Each element
has a set of measures (x,y,width,height). Each element has depending
on the type other attributes partly optional and partly not. There are
general attributes like "tooltip", "halign", "valign".

Extra attributes are:
 - label (static text): "text" and general text attributes
 - info (dynamic text): "id" and general text attributes
 - button: "id", "background", "text" and and general text attributes
 - ...

The "id" attribute is used to connect the graphical element to the
program code. So an info element for the main screen with the id
"population" will show the total population of your empire. And a
button in the connect screen with the id "connect" will call the
connect function in the freeciv code.

So instead of writing 

  sw_widget_set_background_sprite(connect_window, theme.intro);

  //
  string =
      ct_string_create(STYLE_NORMAL, 14, COLOR_STD_BLACK, COLOR_STD_RED,
                       _("User Name"));
  bounds.x = 60;
  bounds.y = 140;
  bounds.width = 65;
  bounds.height = 20;

  label = sw_label_create_text_bounded(connect_window, string, &bounds);
  //
  string = ct_string_create(STYLE_NORMAL, 14,
                            ct_extend_std_color(COLOR_STD_BLACK),
                            COLOR_EXT_GRAY, user_name);
  bounds.x = 150;
  bounds.y = 140;
  bounds.width = 100;
  bounds.height = 30;
  edit_user_name = sw_edit_create_bounded(connect_window, 10, string,&bounds);

you write in a config file:

  [login_screen]
  background="loginscreen.png"

  label1.x=60
  label1.y=140
  label1.width=65
  label1.height=20
  label1.text="User Name"
  label1.font-size=14
  label1.color="black"
  label1.valign="center"
  
  edit1.id="user_name"
  edit1.x=150
  edit1.y=140
  edit1.width=100
  edit1.height=30
  edit1.font-size=14
  edit1.color="#30e030"
  edit1.background="#204020"
  edit1.max-size=10

I'm still unsure in what format this config file should be. INI, CSS,
XML or some other.

Also it should be possible to define styles to avoid repeatings. So
instead of

  edit1.id="user_name"
  edit1.x=150
  edit1.y=140
  edit1.width=100
  edit1.height=30
  edit1.font-size=14
  edit1.color="#30e030"
  edit1.background="#204020"
  edit1.max-size=10

you write:

  [styles]
  style1.name="s1"
  style1.font-size=14
  style1.color="#30e030"
  style1.background="#204020"
  ...
  [login_screen]
  edit1.inherit="s1"
  edit1.id="user_name"
  edit1.x=150
  edit1.y=140
  edit1.width=100
  edit1.height=30
  edit1.max-size=10

Styles here are just a general value replacement feature.

This is a very nice solution as it separates code from data. I'm sure
that all data can be extracted out of the code this way. However note
that this is only for fixes size layout. No "center element vertically
in its parent" or similar.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "The Internet is really just a series of bottlenecks 
  joined by high speed networks."
    -- Sam Wilson




[Prev in Thread] Current Thread [Next in Thread]