This section specifies the default values for window properties.
This section must begin with begin class class_name and end with end class.
The class section is used to set default values for the window properties defined within the section; these properties are specified through parameters applied to framebuffers and application windows.
The number of class sections that can be defined for framebuffers depends on the number of pipelines available. Generally, one framebuffer is defined per pipeline.
framebuffer<unique_string>
The class_name of the class
section must start with the string framebuffer followed
by any unique string to identify the class. For example, some valid
<class name> strings are:
begin class framebuffer1 display = 1 pipeline = 1 format = rgba8888 usage = pvr2d id_string = fb1 end class begin class framebuffer2 display = 2 pipeline = 2 format = rgba8888 usage = pvr2d id_string = fb2 end class
There's no explicit limit on the number of class sections that can be defined for configuring application windows.
To specify that a class section is used to configure default values for an application window, the class_name of the class section must be a unique string. This string needs to match the window property, SCREEN_PROPERTY_CLASS, you set in your application.
begin class my_app_win visible = true surface-size = 640x480 source-position = 0,0 source-size = 640x480 window-position = 0,0 window-size = 640x480 id_string = MY_APP_WINDOW end class
If you use the above class section in your configuration file, then you can simply set the SCREEN_PROPERTY_CLASS window property in your application code. The setting of this property will trigger Screen to apply the configured values that are associated with that class to your application window.
... const char my_win_class = "my_app_win"; const int len = strlen(my_win_class); screen_set_window_property_cv(screen_win, SCREEN_PROPERTY_CLASS, len, my_win_class); ...
instead of this:
... const int visible = 1 const char id_string = "MY_APP_WINDOW"; const int len = strlen(id_string); const int buffer_size[2] = { 640, 480}; const int src_pos[2] = { 0, 0}; const int src_size[2] = { 640, 480}; const int win_pos[2] = { 0, 0}; const int win_size[2] = { 640, 480}; screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_VISIBLE, &visible); screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size); screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_POSITION, src_pos); screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_SIZE, src_size); screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_POSITION, win_pos); screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SIZE, win_size); screen_set_window_property_cv(screen_win, SCREEN_PROPERTY_ID_STRING, len, id_string); ...
to set your window properties.