本文整理汇总了C#中Texture2D.SetPixels方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.SetPixels方法的具体用法?C# Texture2D.SetPixels怎么用?C# Texture2D.SetPixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture2D
的用法示例。
在下文中一共展示了Texture2D.SetPixels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
//.........这里部分代码省略.........
}
if(dead[i].On)
dead[i].Render(scene);
}
// Image img = new Image(ImageMode.Rgba, new ImageSize(width,height),
// new ImageColor(255,0,0,0));
// img.DrawText("Hello World",
// new ImageColor(255,0,0,255),
// new Font(FontAlias.System,170,FontStyle.Regular),
// new ImagePosition(0,150));
//
// Texture2D texture = new Texture2D(width,height,false,
// PixelFormat.Rgba);
// texture.SetPixels(0,img.ToBuffer());
// img.Dispose();
//
// Image img1 = new Image(ImageMode.Rgba, new ImageSize(width/5,height/10),
// new ImageColor(255,0,0,0));
// img1.DrawText(scene.Camera.CalcBounds().Center.ToString(),
// new ImageColor(0,0,255,255),
// new Font(FontAlias.System,20,FontStyle.Regular),
// new ImagePosition(0,0));
//
// Texture2D texture1 = new Texture2D(width/5,height/10,false,
// PixelFormat.Rgba);
// texture1.SetPixels(0,img1.ToBuffer());
// img1.Dispose();
//
//
// TextureInfo ti1 = new TextureInfo();
// ti1.Texture = texture1;
//
// SpriteUV sprite1 = new SpriteUV();
// sprite1.TextureInfo = ti1;
//
// sprite1.Quad.S = ti1.TextureSizef;
// sprite1.CenterSprite();
// sprite1.Position = new Vector2(100,100);// scene.Camera.CalcBounds().Center;
//
// scene.AddChild(sprite1);
//
//
// TextureInfo ti = new TextureInfo();
// ti.Texture = texture;
//
// SpriteUV sprite = new SpriteUV();
// sprite.TextureInfo = ti;
//
// sprite.Quad.S = ti.TextureSizef;
// sprite.CenterSprite();
// sprite.Position = new Vector2(100,100);
//
//scene.AddChild(sprite);
if(altimer.Milliseconds() > 800){
alpha-=.1f;
altimer.Reset();
}
counter++;
if(timer1.Milliseconds() >= 1000){
timer1.Reset();
FPS=counter;
counter=0;
img = new Image(ImageMode.Rgba, new ImageSize(width/2,height/10),
new ImageColor(255,255,0,0));
img.DrawText("Score: "+score.ToString()+"\nHighscore: "+highscore.ToString()+ " " + (FPS).ToString(),
new ImageColor(255,0,0,255),
new Font(FontAlias.System,20,FontStyle.Bold),
new ImagePosition(0,0));
texturet = new Texture2D(width/2,height/10,false,
PixelFormat.Rgba);
texturet.SetPixels(0,img.ToBuffer());
img.Dispose();
}
TextureInfo ti = new TextureInfo();
ti.Texture = texturet;
SpriteUV sprite = new SpriteUV();
sprite.TextureInfo = ti;
sprite.Quad.S = ti.TextureSizef;
//sprite.CenterSprite();
sprite.Position = uppercorner;
scene.AddChild(sprite);
Director.Instance.Render();
Director.Instance.GL.Context.SwapBuffers();
Director.Instance.PostSwap();
}
示例2: DrawSprite
/// <summary>
/// Draws the sprite. and Add the scene.
/// 文字列(のsprite)を作成するメソッド
/// </summary>
/// <returns>
/// The sprite.
/// </returns>
/// <param name='drawStr'>
/// Draw string.
/// </param>
/// <param name='positionX'>
/// Position x.
/// </param>
/// <param name='positionY'>
/// Position y.
/// </param>
/// <param name='fontSize'>
/// Font size.
/// </param>
/// <param name='fontColor'>
/// Font color.
/// </param>
public static SpriteUV DrawSprite(String drawStr,float positionX, float positionY,
int fontSize,ImageColor fontColor)
{
//Director.Initialize(); //重要なんで最初にinitializeしようね。GameEngine2Dのために必要(たぶんほかにも)
//Scene //Sce.Pss.HighLevel.GameEngine2DのScene()
//scene.Camera.SetViewFromViewport(); //CameraをDisplayで使う たぶん画面サイズ -> 3DCGソフトでいうところのカメラ。それの移してる範囲=画面サイズ
positionX = Const.DISPLAY_WIDTH - Const.DISPLAY_WIDTH*(Const.GRID_NUM_X-positionX)/Const.GRID_NUM_X;
positionY = Const.DISPLAY_HEIGHT - Const.DISPLAY_HEIGHT*(Const.GRID_NUM_Y-positionY)/Const.GRID_NUM_Y;
//the Director's OpenGL context たぶん画面サイズの幅
//var width = (int)Const.getVITA_DISPLAY_WIDTH();
//var height = (int)Const.getVITA_DISPLAY_HEIGHT();
//Font font = new Font(FontAlias.System, fontSize, FontStyle.Regular);
Font font = new Font(Const.DEFAULT_FONT, fontSize, FontStyle.Regular); //日本語使う
var width = font.GetTextWidth(drawStr);
var height = font.GetTextWidth("oo");
//Console.WriteLine(width + " : " + height);
//Image classはimageデータを保つよ~。 PNG or JPGなど
//今回はblankのnew Image でも、これ作らないと img.DrawTextが使えない
Image img = new Image(ImageMode.Rgba,
new ImageSize(width,height), //固定で。たぶん描画範囲
new ImageColor(255,0,0,0));//blankなので変更しても意味なし
//ここで文字を作ってる
img.DrawText(drawStr,
fontColor,
font,
new ImagePosition(0, 0)); //画面の位置
//textureを作る
Texture2D texture = new Texture2D(width,
height,
false,
PixelFormat.Rgba);
//Texture2D を使うためにimageからpixelデータに変換(img.ToBuffer())
//それをtexture.SetPixelsでtextureにPixcelデータを貼り付け
texture.SetPixels(0, img.ToBuffer());
//で一覧のimgの処理を実行
img.Dispose();
//新しいTexture作るときはTextureInfoも作らないとね
TextureInfo ti = new TextureInfo();
ti.Texture = texture;
//スプライト(イメージパターン)を作る。まぁ、テクスチャだし
SpriteUV sprite = new SpriteUV();
sprite.TextureInfo = ti;
//テクスチャーの貼り付けられた長方形(quad.S)を作成。サイズはImage img = new Imageのとこ。たぶん
sprite.Quad.S = ti.TextureSizef;
sprite.CenterSprite();
//sprite.Position = scene.Camera.CalcBounds().Center;
positionX = positionX + sprite.Quad.S.X/2;
positionY = Const.DISPLAY_HEIGHT- positionY - sprite.Quad.S.Y;
sprite.Position = new Vector2(positionX,positionY);
return sprite;
}
示例3: Main
/*private static GraphicsContext graphics;
public static void Main (string[] args)
{
Initialize ();
while (true) {
SystemEvents.CheckEvents ();
Update ();
Render ();
}
}
public static void Initialize ()
{
// Set up the graphics system
graphics = new GraphicsContext ();
}
public static void Update ()
{
// Query gamepad for current state
var gamePadData = GamePad.GetData (0);
}
public static void Render ()
{
// Clear the screen
graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f);
graphics.Clear ();
// Present the screen
graphics.SwapBuffers ();
}*/
public static void Main(string[] args)
{
//JP: initialize GameEngine2D singletion that handles loop
Director.Initialize();
//JP: New 2D scene (graph) container (and camera alignment to orthogonal view
Scene scene = new Scene();
scene.Camera.SetViewFromViewport();
//JP: Get width and height to local variables (optimization)
var width = Director.Instance.GL.Context.GetViewport().Width;
var height = Director.Instance.GL.Context.GetViewport().Height;
//JP: Create new image
Image img = new Image(ImageMode.Rgba, new ImageSize(width,height),
new ImageColor(255,0,0,0));
img.DrawText("Dream-Gin",
new ImageColor(255,0,0,255),
new Font(FontAlias.System,170,FontStyle.Regular),
new ImagePosition(0,150));
//JP: Create hax0r frame buffer and add our img to it's buffer (and consequently kill img content)
Texture2D texture = new Texture2D(width,height,false,
PixelFormat.Rgba);
texture.SetPixels(0,img.ToBuffer());
img.Dispose();
//JP: Texture info needed for SpriteUV
TextureInfo ti = new TextureInfo();
ti.Texture = texture;
//JP: Add ti to SpriteUV
SpriteUV sprite = new SpriteUV();
sprite.TextureInfo = ti;
//JP: resize sprite and center
sprite.Quad.S = ti.TextureSizef;
sprite.CenterSprite();
sprite.Position = scene.Camera.CalcBounds().Center;
//JP: Add to Scene
scene.AddChild(sprite);
//JP: execute loop shit
Director.Instance.RunWithScene(scene, true);
bool gameOver = false;
while(!gameOver)
{
Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.Update();
if(Input2.GamePad.GetData(0).Left.Release)
{
sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90));
}
if(Input2.GamePad0.Right.Release)
{
sprite.Rotate(Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90));
}
if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up)
{
sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f,sprite.Quad.S.Y += 10.0f);
sprite.CenterSprite();
}
if((Sce.PlayStation.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down)
{
sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f,sprite.Quad.S.Y -= 10.0f);
sprite.CenterSprite();
}
if(Input2.GamePad0.Circle.Press == true)
gameOver = true;
Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.Render();
Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.GL.Context.SwapBuffers();
Sce.PlayStation.HighLevel.GameEngine2D.Director.Instance.PostSwap();
//.........这里部分代码省略.........
示例4: UpdateImage
private void UpdateImage()
{
Image image = new Image(ImageMode.Rgba,new ImageSize(110,100),new ImageColor(0,0,0,0));
Font font = new Font(FontAlias.System,50,FontStyle.Regular);
image.DrawText(playerScore + " - " + aiScore,new ImageColor(255,255,255,255),font,new ImagePosition(0,0));
image.Decode();
var texture = new Texture2D(110,100,false,PixelFormat.Rgba);
if(this.TextureInfo.Texture != null)
this.TextureInfo.Texture.Dispose();
this.TextureInfo.Texture = texture;
texture.SetPixels(0,image.ToBuffer());
font.Dispose();
image.Dispose();
}
示例5: Main
public static void Main(string[] args)
{
Director.Initialize();
//Initialize ();
Scene scene = new Scene();
scene.Camera.SetViewFromViewport();
var width = Director.Instance.GL.Context.GetViewport().Width;
var height = Director.Instance.GL.Context.GetViewport().Height;
/* Color Matrix Values
* Unfortunately C# doesn't allow the regular #define usage,
* See: The #define directive cannot be used to declare constant values
* as is typically done in C and C++. Constants in C# are best defined as static members of a
* class or struct. If you have several such constants, consider creating a separate "Constants"
* class to hold them.
*
*/
const int RED = 255;
const int BLUE = 0;
const int GREEN = 0;
const int ALPHA = 0;
Image img = new Image(ImageMode.Rgba, new ImageSize(width, height), new ImageColor(RED,GREEN,BLUE,ALPHA));
img.DrawText("Hello World", new ImageColor(RED,GREEN,BLUE,ALPHA+255),
new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150));
Texture2D texture = new Texture2D(width,height,false,PixelFormat.Rgba);
texture.SetPixels(0,img.ToBuffer());
img.Dispose();
TextureInfo ti = new TextureInfo();
ti.Texture = texture;
SpriteUV sprite = new SpriteUV();
sprite.TextureInfo = ti;
sprite.Quad.S = ti.TextureSizef;
sprite.CenterSprite();
sprite.Position = scene.Camera.CalcBounds().Center;
scene.AddChild(sprite);
Director.Instance.RunWithScene(scene);
}
示例6: setText
public void setText(string text)
{
var width = 200;
var height = 60;
Image img = new Image(ImageMode.Rgba, new ImageSize(width,height),
new ImageColor(255,0,0,0));
img.DrawText("" + text,
new ImageColor(255,0,0,255),
new Font(FontAlias.System,170,FontStyle.Regular),
new ImagePosition(100,100));
texture2d = new Texture2D(width,height,false,
PixelFormat.Rgba);
texture2d.SetPixels(0,img.ToBuffer());
img.Dispose();
Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo ti = new Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo(texture2d);
this.TextureInfo = ti;
}
示例7: CreateTextureFromText
/// <summary>
/// 文字列からテクスチャ作成
/// </summary>
/// <returns>
/// テクスチャ
/// </returns>
/// <param name='text'>
/// 文字列
/// </param>
/// <param name='font'>
/// フォント
/// </param>
/// <param name='argb'>
/// ARGB
/// </param>
public static Texture2D CreateTextureFromText(string text, Font font, uint argb)
{
int width = font.GetTextWidth(text, 0, text.Length);
int height = font.Metrics.Height;
var image = new Image(ImageMode.Rgba, new ImageSize(width,height),new ImageColor(0,0,0,0));
image.DrawText(text,new ImageColor((int)((argb >> 16) & 0xff),
(int)((argb >> 8) & 0xff),
(int)((argb >> 0) & 0xff),
(int)((argb >> 24) & 0xff)),font,new ImagePosition(0,0));
var texture = new Texture2D(width,height,false, PixelFormat.Rgba);
texture.SetPixels(0, image.ToBuffer());
image.Dispose();
font.Dispose();
return texture;
}
示例8: TextLabel
//public Image img = null;
//public ImageColor rgb = null;
//public ImageSize size = null;
public TextLabel(string text)
{
ImageColor rgb = new ImageColor(255,255,255,255);
ImageSize size = new ImageSize(200,100);
Image img = new Image(ImageMode.Rgba, size,
rgb);
img.DrawText (text,
new ImageColor(255,255,255,255),
new Font(FontAlias.System,120,FontStyle.Regular),
new ImagePosition(300,200));
texture2d = new Texture2D(size.Width, size.Height, false, PixelFormat.Rgba);
texture2d.SetPixels(0,img.ToBuffer());
img.Dispose();
Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo ti = new Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo(texture2d);
this.TextureInfo = ti;
}
示例9: CreateTextureUnicolor
/// <summary>
/// Create a small texture where all pixels have the same color.
/// </summary>
public static Texture2D CreateTextureUnicolor( uint color )
{
int w = 16;
int h = 16;
uint[] data = new uint[ w * h ];
for ( int i=0; i < data.Length; ++i )
data[i] = color;
var texture = new Texture2D( w, h, false, PixelFormat.Rgba );
texture.SetPixels( 0, data );
return texture;
}
示例10: Styles
public Styles()
{
Texture2D textured = new Texture2D(4, 4);
Color[] colors = new Color[] { Color.white, Color.white, Color.white, Color.white, Color.white, Color.clear, Color.clear, Color.white, Color.white, Color.clear, Color.clear, Color.white, Color.white, Color.white, Color.white, Color.white };
textured.SetPixels(colors);
textured.filterMode = UnityEngine.FilterMode.Point;
textured.Apply();
textured.hideFlags = HideFlags.HideAndDontSave;
this.frame.normal.background = textured;
this.frame.border = new RectOffset(2, 2, 2, 2);
this.label.alignment = TextAnchor.LowerCenter;
if (EditorGUIUtility.isProSkin)
{
this.tableHeaderColor = new Color(0.18f, 0.18f, 0.18f, 1f);
this.tableLineColor = new Color(1f, 1f, 1f, 0.3f);
this.parentColor = new Color(0.4f, 0.4f, 0.4f, 1f);
this.selfColor = new Color(0.6f, 0.6f, 0.6f, 1f);
this.simpleAnchorColor = new Color(0.7f, 0.3f, 0.3f, 1f);
this.stretchAnchorColor = new Color(0f, 0.6f, 0.8f, 1f);
this.anchorCornerColor = new Color(0.8f, 0.6f, 0f, 1f);
this.pivotColor = new Color(0f, 0.6f, 0.8f, 1f);
}
else
{
this.tableHeaderColor = new Color(0.8f, 0.8f, 0.8f, 1f);
this.tableLineColor = new Color(0f, 0f, 0f, 0.5f);
this.parentColor = new Color(0.55f, 0.55f, 0.55f, 1f);
this.selfColor = new Color(0.2f, 0.2f, 0.2f, 1f);
this.simpleAnchorColor = new Color(0.8f, 0.3f, 0.3f, 1f);
this.stretchAnchorColor = new Color(0.2f, 0.5f, 0.9f, 1f);
this.anchorCornerColor = new Color(0.6f, 0.4f, 0f, 1f);
this.pivotColor = new Color(0.2f, 0.5f, 0.9f, 1f);
}
}
示例11: UpdateImage
public static void UpdateImage(string highScores)
{
Image image = new Image(ImageMode.Rgba,new ImageSize(960,544),new ImageColor(0,0,0,0));
Font font = new Font(FontAlias.System,25,FontStyle.Regular);
image.DrawText("High Scores: " + highScores,new ImageColor(255,255,255,255),font,new ImagePosition(25,100));
image.Decode();
var texture = new Texture2D(960,544,false,PixelFormat.Rgba);
if(textInfo.Texture != null)
textInfo.Texture.Dispose();
textInfo.Texture = texture;
texture.SetPixels(0,image.ToBuffer());
font.Dispose();
image.Dispose();
}
示例12: InitTexture2D
////////////////////////////////////////////////////////////////
public void InitTexture2D()
{
TermTexture2D();
sm_Texture2D = new Texture2D(movie.Width, movie.Height, false, PixelFormat.Rgba);
// Rgba8888 : 4 bytes per pixel
// Rgb565 : 2 bytes per pixel
var bytesCount = movie.Width * movie.Height * 4;
Buffer = new byte[bytesCount];
sm_Texture2D.SetPixels(0, Buffer);
}
示例13: Render
public void Render(Scene scene, int width, int height)
{
Image img1 = new Image(ImageMode.Rgba, new ImageSize(width/5,height/10),
new ImageColor(255,0,0,0));
img1.DrawText(RotationAngle.ToString()+" "+currentAngle.ToString(),
new ImageColor(0,0,255,255),
new Font(FontAlias.System,20,FontStyle.Regular),
new ImagePosition(0,0));
Texture2D texture1 = new Texture2D(width/5,height/10,false,
PixelFormat.Rgba);
texture1.SetPixels(0,img1.ToBuffer());
img1.Dispose();
TextureInfo ti1 = new TextureInfo();
// if(timer.Milliseconds()>100){
// flip = !flip;
// timer.Reset();
// }
//if(flip) {
ti1.Texture = shipTexture;
//flip= !flip;
// }
// else {
// ti1.Texture = shipTexture1;
//flip = !flip;
// }
// else
// ti1.Texture = texture1;
SpriteUV sprite1 = new SpriteUV();
sprite1.TextureInfo = ti1;
sprite1.Quad.S = ti1.TextureSizef.Multiply(.3f);
sprite1.CenterSprite();
sprite1.Position = position;// scene.Camera.CalcBounds().Center;
sprite1.Rotate(-RotationAngle);//*Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.Pi/180);
scene.AddChild(sprite1);
}
示例14: validateBuffer
public override void validateBuffer()
{
if (texture != null){
texture.Dispose();
texture = null;
}
if (vertexBuffer != null){
vertexBuffer.Dispose();
vertexBuffer = null;
}
if (textfield.text == null || textfield.text.Length == 0){
dirtyBuffer = false;
return;
}
updateSize();
float[] verts = new float[8];
float[] uvs = new float[8];
int maxWidth = (int) textWidth;
if (textfield.defaultTextFormat.align == "right"){
maxWidth = textfield.width;
}
verts[0] = (float) OFFSET_X;
verts[1] = (float) OFFSET_Y;
verts[2] = (float) OFFSET_X;
verts[3] = (float) OFFSET_Y + textHeight;
verts[6] = (float) OFFSET_X + maxWidth;
verts[7] = (float) OFFSET_Y;
verts[4] = (float) OFFSET_X + maxWidth;
verts[5] = (float) OFFSET_Y + textHeight;
uvs[0] = 0;
uvs[1] = 0;
uvs[2] = 0;
uvs[3] = 1;
uvs[6] = 1;
uvs[7] = 0;
uvs[4] = 1;
uvs[5] = 1;
vertexBuffer = new VertexBuffer(4, VertexFormat.Float2, VertexFormat.Float2);
vertexBuffer.SetVertices(0, verts);
vertexBuffer.SetVertices(1, uvs);
int argb = textfield.defaultTextFormat.color;
var image = new Image( ImageMode.Rgba,
new ImageSize((int)maxWidth, (int)textHeight),
new ImageColor(0, 0, 0, 0));
ImagePosition pos = new ImagePosition(0, 0);
for (int i = 0; i < textLines.Length; i++){
pos.X = 0;
pos.Y = i * font.Metrics.Height;
if (textfield.defaultTextFormat.align == "right"){
pos.X = (int) maxWidth - font.GetTextWidth(textLines[i]);
}
image.DrawText(
textLines[i],
new ImageColor((int)((argb >> 16) & 0xff),
(int)((argb >> 8) & 0xff),
(int)((argb >> 0) & 0xff),
255),
font,
pos
);
}
texture = new Texture2D((int)maxWidth, (int)textHeight, false, PixelFormat.Rgba);
texture.SetPixels(0, image.ToBuffer());
texture.SetFilter(TextureFilterMode.Disabled);
texture.SetWrap(TextureWrapMode.ClampToEdge);
texture.SetMaxAnisotropy(0);
image.Dispose();
dirtyBuffer = false;
//Console.WriteLine("buffer validated: " + renderable.commands.length);
}
示例15: Init
public static void Init()
{
ex = new List<Texture2D>();
ex.Add(new Texture2D("/Application/textures/ex0.png", false));
ex.Add(new Texture2D("/Application/textures/ex1.png", false));
ex.Add(new Texture2D("/Application/textures/ex2.png", false));
ex.Add(new Texture2D("/Application/textures/ex3.png", false));
ex.Add(new Texture2D("/Application/textures/ex4.png", false));
ex.Add(new Texture2D("/Application/textures/ex5.png", false));
ex.Add(new Texture2D("/Application/textures/ex6.png", false));
ex.Add(new Texture2D("/Application/textures/ex7.png", false));
ex.Add(new Texture2D("/Application/textures/ex8.png", false));
ex.Add(new Texture2D("/Application/textures/ex9.png", false));
ex.Add(new Texture2D("/Application/textures/ex10.png", false));
ex.Add(new Texture2D("/Application/textures/ex11.png", false));
ballTexture = new Texture2D("/Application/textures/ss.png", false);
ballTexture1 = new Texture2D("/Application/textures/^.png", false);
backGround = new Texture2D("/Application/textures/bg.png", false);
backGround1 = new Texture2D("/Application/textures/bgw.png", false);
player = new PlayerClass();
player.bounds = new Vector2( Director.Instance.GL.Context.GetViewport().Width,
Director.Instance.GL.Context.GetViewport().Height);
cleanuptimer = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer();
cleanuptimer.Reset();
timer = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer();
timer.Reset();
timer1 = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Timer();
counter = 0;
FPS=0;
firable = true;
rand = new Random();
uppercorner = new Vector2(scene.Camera.CalcBounds().Center.X-460,scene.Camera.CalcBounds().Center.Y+220);
var width = Director.Instance.GL.Context.GetViewport().Width;
var height = Director.Instance.GL.Context.GetViewport().Height;
//init score
img = new Image(ImageMode.Rgba, new ImageSize(width/3,height/10),
new ImageColor(255,255,0,0));
img.DrawText("Score: "+score.ToString()+"\nHighscore: "+highscore.ToString(),
new ImageColor(255,0,0,255),
new Font(FontAlias.System,20,FontStyle.Regular),
new ImagePosition(0,0));
texturet = new Texture2D(width/3,height/10,false,
PixelFormat.Rgba);
texturet.SetPixels(0,img.ToBuffer());
img.Dispose();
dead = new List<SimpleDead>();
for(int x = 0; x < 20; x++){
dead.Add(new SimpleDead(ex,player.position,player.bounds));
}
shots = new List<ShotClass>();
for(int x = 0; x < 100; x++){
shots.Add(new ShotClass(player.position,Input2.GamePad0.AnalogRight,player.bounds));
}
enemies = new List<EnemyClass>();
for(int x = 0; x < 30; x++){
enemies.Add(new SimpleEnemy(player.bounds));
}
oThread = new Thread(new ThreadStart(Updating1));
oThread.Start();
pThread= new Thread( new ThreadStart(Updating2));
pThread.Start();
}