Пример #1
0
value setLeftCreatureTexture(str)
{
	char* texture = (char*)(String_val(str));
	sfSprite_SetImage(fi.leftCreature, TexturesManager_getTexture(game.texturesManager, texture));
	//sfSprite_FlipX(fi.leftCreature);
	return Val_unit;
}
Пример #2
0
value clearLeftFightWindow()
{
	sfSprite_SetImage(fi.leftCreature, TexturesManager_getTexture(game.texturesManager, "media/creatures/Empty.png"));
	setLeftCreatureLevel(0);
	setLeftCreatureName("");
	setLeftMana(0);
	setLeftManaMax(0);
	setLeftLife(0);
	setLeftLifeMax(0);
}
Пример #3
0
bool TCOD_sys_init(int w,int h, char_t *buf, char_t *oldbuf, bool fullscreen) {
	consoleWidth=w;
	consoleHeight=h;
	
	if ( fullscreen ) {
		find_resolution();
		sfWindowSettings Settings = {0, 0, 0};
		sfVideoMode Mode = {actual_fullscreen_width, actual_fullscreen_height, 32};
		renderWindow=sfRenderWindow_Create(Mode,window_title,sfFullscreen,Settings);
		TCOD_mouse_show_cursor(false);
		actual_fullscreen_width=sfRenderWindow_GetWidth(renderWindow);
		actual_fullscreen_height=sfRenderWindow_GetHeight(renderWindow);
		fullscreen_offsetx=(actual_fullscreen_width-consoleWidth*fontWidth)/2;
		fullscreen_offsety=(actual_fullscreen_height-consoleHeight*fontHeight)/2;
	} else {
		sfWindowSettings Settings = {0, 0, 0};
		sfVideoMode Mode = {w*fontWidth, h*fontHeight, 32};
		renderWindow=sfRenderWindow_Create(Mode,window_title,sfClose,Settings);
		TCOD_mouse_show_cursor(true);
	}
	charmap=sfImage_CreateFromFile(font_file);
	if (charmap == NULL ) TCOD_fatal("SFML : cannot load %s",font_file);
	if ( sfImage_GetWidth(charmap) < fontNbCharHoriz * fontWidth 
		|| sfImage_GetHeight(charmap) < fontNbCharVertic * fontHeight ) TCOD_fatal("bitmap %s too small for %dx%d, %dx%d characters\n",
		font_file,fontWidth,fontHeight,fontNbCharHoriz,fontNbCharVertic);
	sfColor colorKey={fontKeyCol.r,fontKeyCol.g,fontKeyCol.b,255};
	sfImage_CreateMaskFromColor(charmap, colorKey, 0);
	sfImage_SetSmooth(charmap, sfFalse);
	sfImage_Bind(charmap);
	charmapSprite=sfSprite_Create();
	sfSprite_SetImage(charmapSprite,charmap);
	sfSprite_SetBlendMode(charmapSprite,sfBlendNone);
	consoleBuffer=buf;
	prevConsoleBuffer=oldbuf;
	fullscreen_on=fullscreen;
	memset(key_status,0,sizeof(bool)*(TCODK_CHAR+1));
	return true;
}
Пример #4
0
value setRightCreatureTexture(str)
{
	char* texture = (char*)(String_val(str));
	sfSprite_SetImage(fi.rightCreature, TexturesManager_getTexture(game.texturesManager, texture));
	return Val_unit;
}
Пример #5
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;
}