本文整理汇总了C#中TextureLoader类的典型用法代码示例。如果您正苦于以下问题:C# TextureLoader类的具体用法?C# TextureLoader怎么用?C# TextureLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextureLoader类属于命名空间,在下文中一共展示了TextureLoader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw( CanvasDrawingSession ds, CanvasSpriteBatch SBatch, TextureLoader Textures )
{
lock ( PFSim )
{
var Snapshot = PFSim.Snapshot();
while ( Snapshot.MoveNext() )
{
Particle P = Snapshot.Current;
float A = Vector2.Transform( new Vector2( 0, 1 ), Matrix3x2.CreateRotation( P.ttl * 0.01f ) ).X;
Vector4 Tint = new Vector4(
P.Tint.M11 + P.Tint.M21 + P.Tint.M31 + P.Tint.M41 + P.Tint.M51,
P.Tint.M12 + P.Tint.M22 + P.Tint.M32 + P.Tint.M42 + P.Tint.M52,
P.Tint.M13 + P.Tint.M23 + P.Tint.M33 + P.Tint.M43 + P.Tint.M53,
P.Tint.M14 + P.Tint.M24 + P.Tint.M34 + P.Tint.M44 + P.Tint.M54
);
Tint.W *= A;
ScrollWind.Strength *= 0.5f;
SBatch.Draw(
Textures[ P.TextureId ]
, P.Pos, Tint
, Textures.Center[ P.TextureId ], 0, P.Scale
, CanvasSpriteFlip.None );
}
DrawWireFrames( ds );
}
}
开发者ID:tgckpg,项目名称:wenku10,代码行数:31,代码来源:Glitter.cs
示例2: SvgSquaresMode
/// <summary>
/// Initializes a new instance of the <see cref="RectangleMode"/> class.
/// </summary>
public SvgSquaresMode()
{
// Create a list of gem images.
SceneNodeLinkedList<float> nodes = new SceneNodeLinkedList<float>();
RootSceneNode = nodes;
// Load the image into memory.
svgLoader = new SvgLoader(new FileInfo("Images/1cm.svg"));
float screenScale = Platform.Instance.Window.Resolution.Height / 16f;
svgLoader.Scale = screenScale * SvgImageLoader.Meter100px;
TextureLoader textureLoader = new TextureLoader(svgLoader);
// Create squares across the board.
rows = (int) (440 / screenScale);
columns = (int) (600 / (2 * screenScale));
for (int i = 0; i < columns; i++)
{
for (int j = 0; j < rows; j++)
{
ImageNode<float> image = new ImageNode<float>(textureLoader);
image.Point = new Point2<float>((j % 2) * screenScale + i * 2 * screenScale, j * screenScale);
if (i % 4 == 0)
image.Tint = new Color<float>(1, 1, 0, 0);
if (j % 4 == 0)
image.Tint = new Color<float>(1, 0, 1, 0);
nodes.Add(image);
}
}
}
开发者ID:dmoonfire,项目名称:boogame-cil,代码行数:36,代码来源:SvgSquaresMode.cs
示例3: Factory
public Factory(Data d, GameObject gObj,
float zOff = 0, float zR = 1, int rQOff = 0, Camera cam = null,
string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null,
TextureUnloader textureUnldr = null)
: base(gObj, zOff, zR, rQOff,
cam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
{
data = d;
mesh = new Mesh();
meshFilter = gameObject.AddComponent<MeshFilter>();
meshFilter.sharedMesh = mesh;
meshRenderer = gameObject.AddComponent<UnityEngine.MeshRenderer>();
meshRenderer.castShadows = false;
meshRenderer.receiveShadows = false;
textureName = texturePrefix + data.textures[0].filename;
meshRenderer.sharedMaterial =
ResourceCache.SharedInstance().LoadTexture(
data.name, textureName, data.textures[0].format,
textureLoader, textureUnloader);
if (renderQueueOffset != 0)
meshRenderer.sharedMaterial.renderQueue += renderQueueOffset;
premultipliedAlpha = (data.textures[0].format ==
(int)Format.Constant.TEXTUREFORMAT_PREMULTIPLIEDALPHA);
buffer = new CombinedMeshBuffer();
CreateBitmapContexts(data);
CreateTextContexts(data);
}
开发者ID:99corps,项目名称:lwf,代码行数:34,代码来源:lwf_combinedmesh_factory.cs
示例4: Draw
public void Draw( CanvasDrawingSession ds, CanvasSpriteBatch SBatch, TextureLoader Textures )
{
lock ( PFSim )
{
var Snapshot = PFSim.Snapshot();
while ( Snapshot.MoveNext() )
{
Particle P = Snapshot.Current;
float A = ( P.Trait & PFTrait.IMMORTAL ) == 0 ? P.ttl * 0.033f : 1;
P.Tint.M12 = 4 * ( 1 - A );
P.Tint.M21 = 3 * A;
Vector4 Tint = new Vector4(
P.Tint.M11 + P.Tint.M21 + P.Tint.M31 + P.Tint.M41 + P.Tint.M51,
P.Tint.M12 + P.Tint.M22 + P.Tint.M32 + P.Tint.M42 + P.Tint.M52,
P.Tint.M13 + P.Tint.M23 + P.Tint.M33 + P.Tint.M43 + P.Tint.M53,
P.Tint.M14 + P.Tint.M24 + P.Tint.M34 + P.Tint.M44 + P.Tint.M54
) * 2;
Tint.W *= A * 0.125f;
SBatch.Draw( Textures[ P.TextureId ], P.Pos, Tint, Textures.Center[ P.TextureId ], 0, P.Scale * A, CanvasSpriteFlip.None );
}
DrawWireFrames( ds );
}
}
开发者ID:tgckpg,项目名称:wenku10,代码行数:29,代码来源:Fireworks.cs
示例5: OnLoadImageKey
/// <summary>
/// Called when the load image key event is called.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="args">The <see cref="MfGames.Scene2.Images.LoadImageKeyEventArgs"/> instance containing the event data.</param>
private void OnLoadImageKey(object sender, LoadImageKeyEventArgs args)
{
BitmapLoader systemLoader = new BitmapLoader(new FileInfo("Images/" + args.Path + ".png"));
TextureLoader textureLoader = new TextureLoader(systemLoader);
args.ImageKeyLoader = textureLoader;
}
开发者ID:dmoonfire,项目名称:boogame-cil,代码行数:12,代码来源:GemsMode.cs
示例6: Atlas
public Atlas (String path, TextureLoader textureLoader) {
using (StreamReader reader = new StreamReader(path)) {
try {
Load(reader, Path.GetDirectoryName(path), textureLoader);
} catch (Exception ex) {
throw new Exception("Error reading atlas file: " + path, ex);
}
}
}
开发者ID:nicksergeev,项目名称:spine-runtimes,代码行数:9,代码来源:Atlas.cs
示例7: Factory
public Factory(Data data, GameObject gObj,
float zOff = 0, float zR = 1, int rQOff = 0, Camera cam = null,
string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null,
TextureUnloader textureUnldr = null)
: base(gObj, zOff, zR, rQOff,
cam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
{
CreateBitmapContexts(data);
}
开发者ID:explodingbarrel,项目名称:lwf,代码行数:10,代码来源:lwf_drawmesh_factory.cs
示例8: ReadFile
private async Task ReadFile(string path, TextureLoader textureLoader) {
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var file = await folder.GetFileAsync(path).AsTask().ConfigureAwait(false);
using (var reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false))) {
try {
Load(reader, Path.GetDirectoryName(path), textureLoader);
} catch (Exception ex) {
throw new Exception("Error reading atlas file: " + path, ex);
}
}
}
开发者ID:dev-celvin,项目名称:DK,代码行数:11,代码来源:Atlas.cs
示例9: Factory
public Factory(Data d, GameObject gObj,
float zOff = 0, float zR = 1, int rQOff = 0,
string sLayerName = null, int sOrder = 0, bool uAC = false,
Camera renderCam = null, Camera inputCam = null,
string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null,
TextureUnloader textureUnldr = null)
: base(d, gObj, zOff, zR, rQOff, sLayerName, sOrder, uAC, renderCam,
inputCam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
{
CreateBitmapContexts();
CreateTextContexts();
}
开发者ID:rayyee,项目名称:lwf,代码行数:13,代码来源:lwf_drawmesh_factory.cs
示例10: RegisterTexture
public Texture RegisterTexture(ref Texture texture, ref TextureLoader<Texture> textureLoader) {
if(_textureList.Contains(texture)) {
throw new Exception(string.Format("Texture {0} already registered.", texture));
}
if(_textureCatalog.ContainsKey(texture.Name)) {
throw new Exception(string.Format("A Texture with the Name {0} already exists in this catalog. Cannot insert {1}.", texture.Name, texture));
}
_textureList.Add(texture);
_textureCatalog.Add(
texture.Name,
new CatalogEntry<Texture, TextureLoader<Texture>>(texture, textureLoader)
);
return texture;
}
开发者ID:jwmarsden,项目名称:Kinetic3,代码行数:14,代码来源:Catalog.cs
示例11: CanvasStage
public CanvasStage( CanvasAnimatedControl Stage )
{
_stage = Stage;
Scenes = new List<IScene>();
Textures = new TextureLoader();
Stage.CreateResources += Stage_CreateResources;
Stage.GameLoopStarting += Stage_GameLoopStarting;
Stage.GameLoopStopped += Stage_GameLoopStopped;
Stage.SizeChanged += Stage_SizeChanged;
Stage.Unloaded += Stage_Unloaded;
}
开发者ID:tgckpg,项目名称:wenku10,代码行数:15,代码来源:CanvasStage.cs
示例12: Atlas
public Atlas (String path, TextureLoader textureLoader) {
#if WINDOWS_PHONE
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
using (StreamReader reader = new StreamReader(stream))
{
#else
using (StreamReader reader = new StreamReader(path)) {
#endif
try {
Load(reader, Path.GetDirectoryName(path), textureLoader);
} catch (Exception ex) {
throw new Exception("Error reading atlas file: " + path, ex);
}
}
}
开发者ID:dev-celvin,项目名称:DK,代码行数:16,代码来源:Atlas.cs
示例13: Factory
protected Factory(GameObject gObj,
float zOff, float zR, int rQOff, Camera cam,
string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null,
TextureUnloader textureUnldr = null)
{
gameObject = gObj;
zOffset = zOff;
zRate = zR;
renderQueueOffset = rQOff;
camera = cam;
texturePrefix = texturePrfx;
fontPrefix = fontPrfx;
textureLoader = textureLdr;
textureUnloader = textureUnldr;
matrix = Matrix4x4.identity;
}
开发者ID:neojjang,项目名称:lwf,代码行数:17,代码来源:lwf_unity_factory.cs
示例14: GemsMode
/// <summary>
/// Initializes a new instance of the <see cref="RectangleMode"/> class.
/// </summary>
public GemsMode()
{
// Create a list of gem images.
SceneNodeLinkedList<float> nodes = new SceneNodeLinkedList<float>();
RootSceneNode = nodes;
// Create the blue gem.
BitmapLoader systemLoader = new BitmapLoader(new FileInfo("Images/Gem Blue.png"));
TextureLoader textureLoader = new TextureLoader(systemLoader);
ImageNode<float> image = new ImageNode<float>(textureLoader);
image.Point = new Point2<float>(10, 10);
image.DrawableRenderAnimators.Add(
new DisappearingFlickerDrawableAnimation<float>());
image.DrawableRenderAnimators.Add(
new UnsteadyFlickerDrawableAnimation<float>()
{
OpacityScale = 0.2,
TimeScale = 1,
});
Updating += image.OnUpdate;
nodes.Add(image);
// Create the green gem.
systemLoader = new BitmapLoader(new FileInfo("Images/Gem Green.png"));
textureLoader = new TextureLoader(systemLoader);
image = new ImageNode<float>(textureLoader);
image.Point = new Point2<float>(60, 90);
nodes.Add(image);
// Create the translucent orange.
systemLoader = new BitmapLoader(new FileInfo("Images/Gem Orange.png"));
textureLoader = new TextureLoader(systemLoader);
image = new ImageNode<float>(textureLoader);
image.Tint = new Color<float>(0.5f, 1f, 1f, 1f);
image.Point = new Point2<float>(110, 10);
nodes.Add(image);
// Create an animated image.
AnimatedImageNodeController<float> animatedController = new AnimatedImageNodeController<float>();
animatedController.NeedImageKey += OnLoadImageKey;
animatedController.Load(new FileInfo("Images/Gem Animation.xml"));
AnimatedImageNode<float> animatedImage = new AnimatedImageNode<float>(animatedController);
animatedImage.Point = new Point2<float>(10, 200);
Updating += animatedImage.OnUpdate;
nodes.Add(animatedImage);
}
开发者ID:dmoonfire,项目名称:boogame-cil,代码行数:49,代码来源:GemsMode.cs
示例15: Factory
protected Factory(GameObject gObj,
float zOff, float zR, int rQOff, Camera cam,
string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null,
TextureUnloader textureUnldr = null)
{
gameObject = gObj;
zOffset = zOff;
zRate = zR;
renderQueueOffset = rQOff;
camera = cam;
texturePrefix = texturePrfx;
fontPrefix = fontPrfx;
textureLoader = textureLdr;
textureUnloader = textureUnldr;
matrix = Matrix4x4.identity;
blendMode = (int)Format.Constant.BLEND_MODE_NORMAL;
maskMode = (int)Format.Constant.BLEND_MODE_NORMAL;
}
开发者ID:explodingbarrel,项目名称:lwf,代码行数:19,代码来源:lwf_unity_factory.cs
示例16: Factory
protected Factory(Data d, GameObject gObj, float zOff, float zR, int rQOff,
string sLayerName, int sOrder, bool uAC, Camera renderCam,
Camera inputCam, string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null, TextureUnloader textureUnldr = null)
{
data = d;
gameObject = gObj;
zOffset = zOff;
zRate = zR;
renderQueueOffset = rQOff;
sortingLayerName = sLayerName;
sortingOrder = sOrder;
useAdditionalColor = uAC;
renderCamera = renderCam;
inputCamera = inputCam;
texturePrefix = texturePrfx;
fontPrefix = fontPrfx;
textureLoader = textureLdr;
textureUnloader = textureUnldr;
matrix = Matrix4x4.identity;
blendMode = (int)Format.Constant.BLEND_MODE_NORMAL;
maskMode = (int)Format.Constant.BLEND_MODE_NORMAL;
}
开发者ID:rayyee,项目名称:lwf,代码行数:23,代码来源:lwf_unity_factory.cs
示例17: Factory
public Factory(Data d, GameObject gObj,
float zOff = 0, float zR = 1, int rQOff = 0,
string sLayerName = null, int sOrder = 0, bool uAC = false,
Camera renderCam = null, Camera inputCam = null,
string texturePrfx = "", string fontPrfx = "",
TextureLoader textureLdr = null,
TextureUnloader textureUnldr = null,
bool attaching = false)
: base(d, gObj, zOff, zR, rQOff, sLayerName, sOrder, uAC, renderCam,
inputCam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
{
CreateBitmapContexts();
CreateTextContexts();
meshComponents = new List<CombinedMeshComponent>();
if (!attaching)
AddMeshComponent();
usedMeshComponentNo = -1;
updateCount = -1;
}
开发者ID:rayyee,项目名称:lwf,代码行数:21,代码来源:lwf_combinedmesh_factory.cs
示例18: Load
private void Load (TextReader reader, String imagesDir, TextureLoader textureLoader) {
if (textureLoader == null) throw new ArgumentNullException("textureLoader cannot be null.");
this.textureLoader = textureLoader;
String[] tuple = new String[4];
AtlasPage page = null;
while (true) {
String line = reader.ReadLine();
if (line == null) break;
if (line.Trim().Length == 0)
page = null;
else if (page == null) {
page = new AtlasPage();
page.name = line;
if (readTuple(reader, tuple) == 2) { // size is only optional for an atlas packed with an old TexturePacker.
page.width = int.Parse(tuple[0]);
page.height = int.Parse(tuple[1]);
readTuple(reader, tuple);
}
page.format = (Format)Enum.Parse(typeof(Format), tuple[0], false);
readTuple(reader, tuple);
page.minFilter = (TextureFilter)Enum.Parse(typeof(TextureFilter), tuple[0], false);
page.magFilter = (TextureFilter)Enum.Parse(typeof(TextureFilter), tuple[1], false);
String direction = readValue(reader);
page.uWrap = TextureWrap.ClampToEdge;
page.vWrap = TextureWrap.ClampToEdge;
if (direction == "x")
page.uWrap = TextureWrap.Repeat;
else if (direction == "y")
page.vWrap = TextureWrap.Repeat;
else if (direction == "xy")
page.uWrap = page.vWrap = TextureWrap.Repeat;
textureLoader.Load(page, Path.Combine(imagesDir, line));
pages.Add(page);
} else {
AtlasRegion region = new AtlasRegion();
region.name = line;
region.page = page;
region.rotate = Boolean.Parse(readValue(reader));
readTuple(reader, tuple);
int x = int.Parse(tuple[0]);
int y = int.Parse(tuple[1]);
readTuple(reader, tuple);
int width = int.Parse(tuple[0]);
int height = int.Parse(tuple[1]);
region.u = x / (float)page.width;
region.v = y / (float)page.height;
if (region.rotate) {
region.u2 = (x + height) / (float)page.width;
region.v2 = (y + width) / (float)page.height;
} else {
region.u2 = (x + width) / (float)page.width;
region.v2 = (y + height) / (float)page.height;
}
region.x = x;
region.y = y;
region.width = Math.Abs(width);
region.height = Math.Abs(height);
if (readTuple(reader, tuple) == 4) { // split is optional
region.splits = new int[] {int.Parse(tuple[0]), int.Parse(tuple[1]),
int.Parse(tuple[2]), int.Parse(tuple[3])};
if (readTuple(reader, tuple) == 4) { // pad is optional, but only present with splits
region.pads = new int[] {int.Parse(tuple[0]), int.Parse(tuple[1]),
int.Parse(tuple[2]), int.Parse(tuple[3])};
readTuple(reader, tuple);
}
}
region.originalWidth = int.Parse(tuple[0]);
region.originalHeight = int.Parse(tuple[1]);
readTuple(reader, tuple);
region.offsetX = int.Parse(tuple[0]);
region.offsetY = int.Parse(tuple[1]);
region.index = int.Parse(readValue(reader));
regions.Add(region);
}
}
}
开发者ID:dev-celvin,项目名称:DK,代码行数:94,代码来源:Atlas.cs
示例19: Initialize
public void Initialize()
{
if (Buttonareas.Count() == 0)
{
Rectangle djastinButtonArea = new Rectangle(0, 0, 400, 300);
Rectangle rutgerButtonArea = new Rectangle(0, 300, 400, 300);
Rectangle gideonButtonArea = new Rectangle(400, 0, 400, 300);
Rectangle danielButtonArea = new Rectangle(400, 300, 400, 300);
Rectangle gameOverButtonArea = new Rectangle(300, 300, 200, 100);
Buttonareas.Add("djastinButton", djastinButtonArea);
Buttonareas.Add("rutgerButton", rutgerButtonArea);
Buttonareas.Add("gideonButton", gideonButtonArea);
Buttonareas.Add("danielButton", danielButtonArea);
Buttonareas.Add("gameOverButton", gameOverButtonArea);
_textureLoader = TextureLoader.GetInstance();
_cijfernariumTexture = _textureLoader.GetTexture("startMenuCijfernarium");
_starbucksalandoriumTexture = _textureLoader.GetTexture("startMenuStarbucks");
_crackenariumTexture = _textureLoader.GetTexture("startMenuCrackenarium");
_kloonwereldTexture = _textureLoader.GetTexture("startMenuKloonwereld");
_cijfernariumTextureHighlighted = _textureLoader.GetTexture("startMenuCijfernariumHighlighted");
StarbucksalandoriumTextureHighlighted = _textureLoader.GetTexture("startMenuStarbucksHighlighted");
_crackenariumTextureHighlighted = _textureLoader.GetTexture("startMenuCrackenariumHighlighted");
_kloonwereldTextureHighlighted = _textureLoader.GetTexture("startMenuKloonwereldHighlighted");
_gameOverButtonHighlighted = _textureLoader.GetTexture("gameOverButtonHighlighted");
_gameOverButton = _textureLoader.GetTexture("gameOverButton");
_front = _textureLoader.GetTexture("startMenuBackgroundEmpty");
_showGameOver = false;
}
}
开发者ID:djastin,项目名称:XNA2DGame,代码行数:29,代码来源:StartMenu.cs
示例20: EarthlitNightScene
public EarthlitNightScene(IEye eye)
{
this.eye = eye;
device = eye.Device;
swapChain = device.PrimarySwapChain;
stars = new Stars(device, StarCount);
var meshFactory = new MeshFactory(device, Handedness.Right, Winding.Clockwise);
var earthMesh = meshFactory.CreateSphere(false, 1.0f, 36);
earthVertexBuffer = earthMesh.Vertices.Buffer;
earthIndexBuffer = earthMesh.Indices.Buffer;
var formatInfo = eye.Adapters[0].GetSupportedFormats(FormatSupport.RenderTarget | FormatSupport.Texture2D | FormatSupport.TextureCube)
.First(x => x.ColorBits == 24 && x.AlphaBits == 8 && x.ColorFormatType == FormatElementType.UNORM);
starsProxyTexture = device.Create.Texture2D(new Texture2DDescription
{
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
Usage = Usage.Default,
Width = SkyboxSize,
Height = SkyboxSize,
ArraySize = 1,
MipLevels = 1,
FormatID = formatInfo.ID
});
skyboxTexture = device.Create.Texture2D(new Texture2DDescription
{
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
Usage = Usage.Default,
Width = SkyboxSize,
Height = SkyboxSize,
ArraySize = 6,
MipLevels = TextureHelper.MipLevels(SkyboxSize, SkyboxSize, 1),
FormatID = formatInfo.ID,
MiscFlags = MiscFlags.TextureCube | MiscFlags.GenerateMips
});
var textureLoader = new TextureLoader(device);
earthTexture = textureLoader.Load("../Textures/BasicTest.png");
}
开发者ID:Zulkir,项目名称:Beholder,代码行数:42,代码来源:EarthlitNightScene.cs
注:本文中的TextureLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论