本文整理汇总了C#中Game.GLScale方法的典型用法代码示例。如果您正苦于以下问题:C# Game.GLScale方法的具体用法?C# Game.GLScale怎么用?C# Game.GLScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.GLScale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNewFrameDraw3d
public override void OnNewFrameDraw3d(Game game, float deltaTime)
{
float one = 1;
for (int i = 0; i < game.entitiesCount; i++)
{
Entity entity = game.entities[i];
if (entity == null) { continue; }
if (entity.sprite == null) { continue; }
Sprite b = entity.sprite;
game.GLMatrixModeModelView();
game.GLPushMatrix();
game.GLTranslate(b.positionX, b.positionY, b.positionZ);
Billboard(game);
game.GLScale((one * 2 / 100), (one * 2 / 100), (one * 2 / 100));
game.GLTranslate(0 - b.size / 2, 0 - b.size / 2, 0);
//d_Draw2d.Draw2dTexture(night ? moontexture : suntexture, 0, 0, ImageSize, ImageSize, null, Color.White);
IntRef n = null;
if (b.animationcount > 0)
{
float progress = one - (entity.expires.timeLeft / entity.expires.totalTime);
n = IntRef.Create(game.platform.FloatToInt(progress * (b.animationcount * b.animationcount - 1)));
}
game.Draw2dTexture(game.GetTexture(b.image), 0, 0, b.size, b.size, n, b.animationcount, Game.ColorFromArgb(255, 255, 255, 255), true);
game.GLPopMatrix();
}
}
示例2: OnNewFrameDraw3d
public override void OnNewFrameDraw3d(Game game, float deltaTime)
{
for (int i = 0; i < game.entitiesCount; i++)
{
Entity e = game.entities[i];
if (e == null)
{
continue;
}
if (e.drawText == null)
{
continue;
}
if (e.networkPosition != null && (!e.networkPosition.PositionLoaded))
{
continue;
}
int kKey = i;
EntityDrawText p = game.entities[i].drawText;
float posX = - game.platform.MathSin(e.position.roty) * p.dx + e.position.x;
float posY = p.dy + e.position.y;
float posZ = game.platform.MathCos(e.position.roty) * p.dz + e.position.z;
//todo if picking
if ((game.Dist(game.player.position.x, game.player.position.y, game.player.position.z, posX, posY, posZ) < 20)
|| game.keyboardState[Game.KeyAltLeft] || game.keyboardState[Game.KeyAltRight])
{
string text = p.text;
{
float shadow = (game.one * game.GetLight(game.platform.FloatToInt(posX), game.platform.FloatToInt(posZ), game.platform.FloatToInt(posY))) / Game.maxlight;
game.GLPushMatrix();
game.GLTranslate(posX, posY, posZ);
game.GLRotate(180, 1, 0, 0);
game.GLRotate(e.position.roty * 360 / (2 * Game.GetPi()), 0, 1, 0);
float scale = game.one * 5 / 1000;
game.GLScale(scale, scale, scale);
FontCi font = new FontCi();
font.family = "Arial";
font.size = 14;
game.Draw2dText(text, font, -game.TextSizeWidth(text, 14) / 2, 0, IntRef.Create(Game.ColorFromArgb(255, 255, 255, 255)), true);
game.GLPopMatrix();
}
}
}
}
示例3: DrawWireframeCube_
public void DrawWireframeCube_(Game game, float posx, float posy, float posz, float scalex, float scaley, float scalez)
{
game.platform.GLLineWidth(2);
game.platform.BindTexture2d(0);
if (wireframeCube == null)
{
ModelData data = WireframeCube.Get();
wireframeCube = game.platform.CreateModel(data);
}
game.GLPushMatrix();
game.GLTranslate(posx, posy, posz);
float half = one / 2;
game.GLScale(scalex * half, scaley * half, scalez * half);
game.DrawModel(wireframeCube);
game.GLPopMatrix();
}
示例4: OnNewFrameDraw3d
public override void OnNewFrameDraw3d(Game game, float dt)
{
GamePlatform platform = game.platform;
game.GLMatrixModeModelView();
if (suntexture == -1)
{
suntexture = game.GetTexture("sun.png");
moontexture = game.GetTexture("moon.png");
}
UpdateSunMoonPosition(game, dt);
float posX;
float posY;
float posZ;
if (!game.isNight)
{
posX = game.sunPositionX;
posY = game.sunPositionY;
posZ = game.sunPositionZ;
}
else
{
posX = game.moonPositionX;
posY = game.moonPositionY;
posZ = game.moonPositionZ;
}
posX += game.player.position.x;
posY += game.player.position.y;
posZ += game.player.position.z;
game.GLPushMatrix();
game.GLTranslate(posX, posY, posZ);
ModDrawSprites.Billboard(game);
game.GLScale(one * 2 / 100, one * 2 / 100, one * 2 / 100);
//GL.Translate(-ImageSize / 2, -ImageSize / 2, 0);
game.Draw2dTexture(game.isNight ? moontexture : suntexture, 0, 0, ImageSize, ImageSize, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false);
game.GLPopMatrix();
}
示例5: OnNewFrameDraw3d
public override void OnNewFrameDraw3d(Game game, float deltaTime)
{
for (int i = 0; i < game.entitiesCount; i++)
{
Entity e = game.entities[i];
if (e == null)
{
continue;
}
if (e.drawName == null)
{
continue;
}
if (i == game.LocalPlayerId)
{
continue;
}
if (e.networkPosition != null && (!e.networkPosition.PositionLoaded))
{
continue;
}
int kKey = i;
DrawName p = game.entities[i].drawName;
if (p.OnlyWhenSelected)
{
continue;
}
float posX = p.TextX + e.position.x;
float posY = p.TextY + e.position.y + e.drawModel.ModelHeight + game.one * 7 / 10;
float posZ = p.TextZ + e.position.z;
//todo if picking
if ((game.Dist(game.player.position.x, game.player.position.y, game.player.position.z, posX, posY, posZ) < 20)
|| game.keyboardState[Game.KeyAltLeft] || game.keyboardState[Game.KeyAltRight])
{
string name = p.Name;
{
float shadow = (game.one * game.GetLight(game.platform.FloatToInt(posX), game.platform.FloatToInt(posZ), game.platform.FloatToInt(posY))) / Game.maxlight;
//do not interpolate player position if player is controlled by game world
//if (EnablePlayerUpdatePositionContainsKey(kKey) && !EnablePlayerUpdatePosition(kKey))
//{
// posX = p.NetworkX;
// posY = p.NetworkY;
// posZ = p.NetworkZ;
//}
game.GLPushMatrix();
game.GLTranslate(posX, posY, posZ);
//if (p.Type == PlayerType.Monster)
//{
// GLTranslate(0, 1, 0);
//}
ModDrawSprites.Billboard(game);
float scale = game.one * 2 / 100;
game.GLScale(scale, scale, scale);
//Color c = Color.FromArgb((int)(shadow * 255), (int)(shadow * 255), (int)(shadow * 255));
//Todo: Can't change text color because text has outline anyway.
if (p.DrawHealth)
{
game.Draw2dTexture(game.WhiteTexture(), -26, -11, 52, 12, null, 0, Game.ColorFromArgb(255, 0, 0, 0), false);
game.Draw2dTexture(game.WhiteTexture(), -25, -10, 50 * (game.one * p.Health), 10, null, 0, Game.ColorFromArgb(255, 255, 0, 0), false);
}
FontCi font = new FontCi();
font.family = "Arial";
font.size = 14;
game.Draw2dText(name, font, -game.TextSizeWidth(name, 14) / 2, 0, IntRef.Create(Game.ColorFromArgb(255, 255, 255, 255)), true);
// GL.Translate(0, 1, 0);
game.GLPopMatrix();
}
}
}
}