Example #1
0
value initFightInterface()
{
	fi.background = sfSprite_Create();
	sfSprite_SetImage(fi.background, TexturesManager_getTexture(game.texturesManager, "media/ui/fightBackground1.png"));
	sfSprite_SetPosition(fi.background, 0,0);

	fi.headerBackground = sfSprite_Create();
	sfSprite_SetImage(fi.headerBackground, TexturesManager_getTexture(game.texturesManager, "media/ui/headerBackground.png"));
	sfSprite_SetPosition(fi.headerBackground, 0,0);

	fi.leftLifeBarContainer = sfSprite_Create();
	sfSprite_SetImage(fi.leftLifeBarContainer, TexturesManager_getTexture(game.texturesManager, "media/ui/barsContainer.png"));
	sfSprite_SetPosition(fi.leftLifeBarContainer, 90,108);

	fi.leftManaBarContainer = sfSprite_Create();
	sfSprite_SetImage(fi.leftManaBarContainer, TexturesManager_getTexture(game.texturesManager, "media/ui/barsContainer.png"));
	sfSprite_SetPosition(fi.leftManaBarContainer, 90,140);

	fi.rightLifeBarContainer = sfSprite_Create();
	sfSprite_SetImage(fi.rightLifeBarContainer, TexturesManager_getTexture(game.texturesManager, "media/ui/barsContainer.png"));
	sfSprite_SetPosition(fi.rightLifeBarContainer, 764,108);

	fi.rightManaBarContainer = sfSprite_Create();
	sfSprite_SetImage(fi.rightManaBarContainer, TexturesManager_getTexture(game.texturesManager, "media/ui/barsContainer.png"));
	sfSprite_SetPosition(fi.rightManaBarContainer, 764,140);

	fi.leftLifeBar = sfSprite_Create();
	sfSprite_SetImage(fi.leftLifeBar, TexturesManager_getTexture(game.texturesManager, "media/ui/lifeBar.png"));
	sfSprite_SetPosition(fi.leftLifeBar, 95,112);

	fi.leftManaBar = sfSprite_Create();
	sfSprite_SetImage(fi.leftManaBar, TexturesManager_getTexture(game.texturesManager, "media/ui/manaBar.png"));
	sfSprite_SetPosition(fi.leftManaBar, 95,144);

	fi.rightLifeBar = sfSprite_Create();
	sfSprite_SetImage(fi.rightLifeBar, TexturesManager_getTexture(game.texturesManager, "media/ui/lifeBar.png"));
	sfSprite_SetPosition(fi.rightLifeBar, 769,112);

	fi.rightManaBar = sfSprite_Create();
	sfSprite_SetImage(fi.rightManaBar, TexturesManager_getTexture(game.texturesManager, "media/ui/manaBar.png"));
	sfSprite_SetPosition(fi.rightManaBar, 769,144);

	fi.leftCreature = sfSprite_Create();
	sfSprite_FlipX(fi.leftCreature, 1);
	/*sfSprite_SetImage(fi.leftCreature, TexturesManager_getTexture(game.texturesManager, "media/creatures/.png"));*/
	sfSprite_SetPosition(fi.leftCreature, 60,250);
	

	fi.rightCreature = sfSprite_Create();
	/*sfSprite_SetImage(fi.rightCreature, TexturesManager_getTexture(game.texturesManager, "media/creatures/Galouf.png"));*/
	sfSprite_SetPosition(fi.rightCreature, 740,250);

	setSelectorPos(game.dialogPanel, 0);


	// initialize creature labels :
	fi.leftName = "";
	fi.leftCreatureName = sfString_Create();
    sfString_SetText(fi.leftCreatureName, "Payssa");
    sfString_SetFont(fi.leftCreatureName, game.font);
	sfString_SetSize(fi.leftCreatureName, 20);
	sfString_SetColor(fi.leftCreatureName, sfBlack);
	sfString_SetPosition(fi.leftCreatureName, 95, 65);

	fi.leftLevel = 0;
	fi.leftCreatureLevel = sfString_Create();
    sfString_SetText(fi.leftCreatureLevel, "Lvl:66");
    sfString_SetFont(fi.leftCreatureLevel, game.font);
	sfString_SetSize(fi.leftCreatureLevel, 20);
	sfString_SetColor(fi.leftCreatureLevel, sfBlack);
	sfString_SetPosition(fi.leftCreatureLevel, 265, 65);

	fi.rightName = "Galouf";
	fi.rightCreatureName = sfString_Create();
    sfString_SetText(fi.rightCreatureName, "Galouf");
    sfString_SetFont(fi.rightCreatureName, game.font);
	sfString_SetSize(fi.rightCreatureName, 20);
	sfString_SetColor(fi.rightCreatureName, sfBlack);
	sfString_SetPosition(fi.rightCreatureName, 766, 65);

	fi.rightLevel = 2;
	fi.rightCreatureLevel = sfString_Create();
    sfString_SetText(fi.rightCreatureLevel, "Lvl:2");
    sfString_SetFont(fi.rightCreatureLevel, game.font);
	sfString_SetSize(fi.rightCreatureLevel, 20);
	sfString_SetColor(fi.rightCreatureLevel, sfBlack);
	sfString_SetPosition(fi.rightCreatureLevel, 936, 65);

	// life/mana labels

    fi.leftLife = 0;
	fi.leftLifeMax = 0;
	fi.leftMana = 0;
	fi.leftManaMax = 0;
    fi.rightLife = 30;
	fi.rightLifeMax = 30;
	fi.rightMana = 10;
	fi.rightManaMax = 10;

	fi.leftLifeBarText = sfString_Create();
    sfString_SetFont(fi.leftLifeBarText, game.font);
	sfString_SetSize(fi.leftLifeBarText, 12);
	sfString_SetColor(fi.leftLifeBarText, sfBlack);
	sfFloatRect leftLifeBarTextPos = sfString_GetRect(fi.leftLifeBarText);
	sfString_SetCenter(fi.leftLifeBarText, (leftLifeBarTextPos.Right - leftLifeBarTextPos.Left)/2, 0); 
	sfString_SetPosition(fi.leftLifeBarText, 205, 112);

	fi.leftManaBarText = sfString_Create();
    sfString_SetFont(fi.leftManaBarText, game.font);
	sfString_SetSize(fi.leftManaBarText, 12);
	sfString_SetColor(fi.leftManaBarText, sfBlack);
	sfFloatRect leftManaBarTextPos = sfString_GetRect(fi.leftManaBarText);
	sfString_SetCenter(fi.leftManaBarText, (leftManaBarTextPos.Right - leftManaBarTextPos.Left)/2, 0);
	sfString_SetPosition(fi.leftManaBarText, 205, 144);

	fi.rightLifeBarText = sfString_Create();
    sfString_SetFont(fi.rightLifeBarText, game.font);
	sfString_SetSize(fi.rightLifeBarText, 12);
	sfString_SetColor(fi.rightLifeBarText, sfBlack);
	sfFloatRect rightLifeBarTextPos = sfString_GetRect(fi.rightLifeBarText);
	sfString_SetCenter(fi.rightLifeBarText, (rightLifeBarTextPos.Right - rightLifeBarTextPos.Left)/2, 0); 
	sfString_SetPosition(fi.rightLifeBarText, 879, 112);

	fi.rightManaBarText = sfString_Create();
    sfString_SetFont(fi.rightManaBarText, game.font);
	sfString_SetSize(fi.rightManaBarText, 12);
	sfString_SetColor(fi.rightManaBarText, sfBlack);
	sfFloatRect rightManaBarTextPos = sfString_GetRect(fi.rightManaBarText);
	sfString_SetCenter(fi.rightManaBarText, (rightManaBarTextPos.Right - rightManaBarTextPos.Left)/2, 0); 
	sfString_SetPosition(fi.rightManaBarText, 879, 144);

	updateBarsStrings();

	return Val_unit;
}
void string_setsize(avm *vm)
{
    sfString_SetSize(getint(vm, 0), getfloat(vm, 1));
}