The window script(wra) syntax

The wra syntax

a wra is composed of two main blocks.

  • The window definition block

  • Control definition blocks

Always , window definition block comes to the top. Following that, there is a control definition block. The window-ID is required to be MulID.

// window define block
WINDOW(Window ID) {
   Property 0;
   Property 1;
       :
   Property n;
};

// control define blocks
ControlKind(name 0) {
   Property 0;
   Property 1;
       :
   Property n;
};
ControlKind(name 1) {
   Property 0;
   Property 1;
       :
   Property n;
};
      :
ControlKind(name n) {
   Property 0;
   Property 1;
       :
   Property n;
};
#include "wr.h"
$y = 160;
#pragma RESOURCE ON

WINDOW(250_000_00010) {
    RESOURCE;
    PATH = NETWORKPATH;
    ID = 001_000_00000;
    TEX_ID = 100_000_00000;
    CAPTION = 000_000_0000;
    STYLE = NOTITLEBAR|NOFRAME|ANCHOR_CENTER|TOP;
    SIZE = {100},{100};
    PRIORITY = PROGRESSBAR_PRIORITY;
};
METER(ProgressTotal) {
    ID = 000_001_00000;
    STYLE = ANCHOR_BOTTOM;
    SIZE = -128{100};
    POSITION = 0,$y;
    TEX_ID = 0,"MTRB";
    COLOR = COLOR32(255.0,255.0,255.0,255.0);
    TEX_ID1 = 0,"MTR";
    COLOR1 = COLOR32(255.0,255.0,255.0,255.0);
};
$y -=64;
METER(ProgressPart) {
   ID = 000_001_00010;
   STYLE = ANCHOR_BOTTOM;
   SIZE = -128{100},32;
   SIZE = -128{100},32;
   POSITION = 0,$y;
   TEX_ID = 0,"MTRB";
   COLOR = COLOR32(255.0,255.0,255.0,255.0);
   TEX_ID1 = 0,"MTR";
   COLOR1 = COLOR32(255.0,255.0,255.0,255.0);
};

Variables and expressions

You can use the variables and the expression on the wra file. Those that begin from $ is a variable. The type of the variable is real. It is possible to write an expression in the property.

ID = 000_000_00010 + (3 * $val);

The declaration of variables

When you use a variable , it is necessary to always have an initial value. Uninitialized variables are errors.

$i = 3;             //integer(Decimal number)
$h = 0xfff123;      //integer(Hexadecimal number)
$f = 3.14;          //real number
$m = 001_002_00003; //Multi (8bit,8bit,16bit)

Operators that can be used in the expression.

Operators

Description

+,-,*,/

Four arithmetic operations.

%

Surplus

|,&,^,~

Bit operations(or,and,xor,not)

<<,>>

Shift operations

**

Exponentiation

The constant representation of the expression

Constants Examples

Description

14

Decimal integer

0x12ffffff

Hexadecimal integer

000_001_00010

MultiID(format is 8bit,8bit,16bit)

0.345

Floating point

Calculation of string

a variable can’t store a string. But,the operation for connecting the strings can be used.

  • string + string

  • string . string

PATH = "test/" + "folder/";

Preprocessor

You can use the same as C language preprocessor.

Preprocessor

Description

// Comment

Line comment

/* Comment */

Block comment

#include “file name”

Include the file

#define constant

Definition of a symbolic constant

#define Function macro

Function macro

#if defined(symbol definition) … #endif

Conditional compilation

#ifdef … #endif

Conditional compilation

#ifndef … #endif

Conditional compilation

#pragma once

Multiple include prevention

Next, list the preprocessor definitions of wra.

Preprocessor

Description

#pragma RESOURCE MulID

output as an asset bundles

Example

#pragma RESOURCE 000_014_000000

#pragma RESOURCE path

Output it to the specified path as resource data.

Example

#pragma RESOURCE = Resources/windows.asset

#pragma PATH “export path”

You want to change the output path.

By default , the following folder.

#pragma PATH ../wrc/base

#pragma BASECLASS Base class name

You want to change the base class

By default , the following class

#pragma BASECALSS CWindowBase