예제 #1
0
		public LPaper(LTexture background, int x, int y):base(x, y, background.GetWidth(), background.GetHeight()) {
			this.customRendering = true;
			this.SetBackground(background);
			this.SetElastic(true);
			this.SetLocked(true);
			this.SetLayer(100);
		}
예제 #2
0
 public Logo(LTexture texture)
 {
     this.logo = texture;
     this.curTime = 60;
     this.curFrame = 0;
     this.inToOut = true;
 }
예제 #3
0
		public void DrawWidth(GLEx g, int x, int y) {
			try {
				if (drawTexWidth == null) {
					LImage img = LImage.CreateImage(width, height, true);
					LGraphics gl = img.GetLGraphics();
					for (int i = 0; i < width; i++) {
						gl.SetColor(
								(start.GetRed() * (width - i)) / width
										+ (end.GetRed() * i) / width,
								(start.GetGreen() * (width - i)) / width
										+ (end.GetGreen() * i) / width,
								(start.GetBlue() * (width - i)) / width
										+ (end.GetBlue() * i) / width, alpha);
						gl.DrawLine(i, 0, i, height);
					}
					drawTexWidth = new LTexture(GLLoader.GetTextureData(img),
							Loon.Core.Graphics.Opengl.LTexture.Format.SPEED);
					gl.Dispose();
					gl = null;
				}
				g.DrawTexture(drawTexWidth, x, y);
			} catch (Exception) {
				for (int i = 0; i < width; i++) {
					g.SetColorValue(
							(start.GetRed() * (width - i)) / width
									+ (end.GetRed() * i) / width,
							(start.GetGreen() * (width - i)) / width
									+ (end.GetGreen() * i) / width,
							(start.GetBlue() * (width - i)) / width
									+ (end.GetBlue() * i) / width, alpha);
					g.DrawLine(i + x, y, i + x, y + height);
				}
			}
		}
예제 #4
0
 public void NoneBackgroundCG()
 {
     if (background != null)
     {
         background.Destroy();
         background = null;
     }
 }
예제 #5
0
	public  static LTextureBatch BindBatchCache( int index,
			 LTexture texture) {
		if (texture == null) {
			return null;
		}
		int texId = texture.textureID;
		return BindBatchCache(index, texId, texture);
	}
예제 #6
0
 public void Dispose()
 {
     Stop();
     if (texture != null)
     {
         texture.Destroy();
         texture = null;
     }
 }
예제 #7
0
		public Picture(LTexture image, int x, int y) {
			if (image != null) {
				this.SetImage(image);
				this.width = image.GetWidth();
				this.height = image.GetHeight();
			}
			this.SetLocation(x, y);
			this.visible = true;
		}
예제 #8
0
		public SpriteSheet(LTexture img, int tw, int th, int s, int m) {
			this.width = img.GetWidth();
			this.height = img.GetHeight();
			this.target = img;
			this.tw = tw;
			this.th = th;
			this.margin = m;
			this.spacing = s;
		}
예제 #9
0
 public LTextureRegion(LTexture texture)
 {
     if (texture == null)
     {
         throw new Exception("texture cannot be null.");
     }
     this.texture = texture;
     SetRegion(0, 0, texture.texWidth, texture.texHeight);
 }
예제 #10
0
 public LTextureRegion(LTexture texture, int x, int y, int width, int height)
 {
     if (texture == null)
     {
         throw new Exception("texture cannot be null.");
     }
     this.texture = texture;
     SetRegion(x, y, width, height);
 }
예제 #11
0
파일: LGesture.cs 프로젝트: keppelcao/LGame
		public override void CreateUI(GLEx g, int x, int y, LComponent component,
				LTexture[] buttonImage) {
			if (visible && goalPath != null) {
				g.SetLineWidth(lineWidth);
				g.SetColor(color);
				g.Draw(goalPath);
				g.ResetLineWidth();
				g.ResetColor();
			}
		}
예제 #12
0
 public OutEffect(LTexture t, RectBox limit, int code)
 {
     this.texture = t;
     this.type = code;
     this.width = t.Width;
     this.height = t.Height;
     this.multiples = 1;
     this.limit = limit;
     this.visible = true;
 }
예제 #13
0
 public RainKernel(int n, int w, int h)
 {
     id = n;
     rain = XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "rain_" + n + ".png");
     rainWidth = rain.GetWidth();
     rainHeight = rain.GetHeight();
     width = w;
     height = h;
     offsetX = 0;
     offsetY = (5 - n) * 30 + 75 + MathUtils.Random() * 15;
 }
예제 #14
0
파일: LControl.cs 프로젝트: keppelcao/LGame
		public LControl(int x, int y, LTexture basefile, LTexture dot, int bw,
				int bh, int dw, int dh):base(x, y, bw, bh) {
			this.controlBase = basefile;
			this.controlDot = dot;
			this.baseWidth = bw;
			this.baseHeight = bh;
			this.dotWidth = dw;
			this.dotHeight = dh;
			this.allowDiagonal = true;
			this.CenterOffset();
		}
예제 #15
0
 public static LTransition NewCross(int c, LTexture texture)
 {
     if (GLEx.Self != null)
     {
         LTransition transition = new LTransition();
         transition.SetTransitionListener(new _Cross(c, texture));
         transition.SetDisplayGameUI(true);
         transition.code = 1;
         return transition;
     }
     return null;
 }
예제 #16
0
 public SnowKernel(int n, int w, int h)
 {
     snow = XNAConfig
             .LoadTex(LSystem.FRAMEWORK_IMG_NAME + "snow_" + n + ".png");
     snowWidth = snow.GetWidth();
     snowHeight = snow.GetHeight();
     width = w;
     height = h;
     offsetX = 0;
     offsetY = n * 0.6f + 1.9f + MathUtils.Random() * 0.2f;
     speed = MathUtils.Random();
 }
예제 #17
0
	private void Init(LTexture tex2d, float limit, bool remove, float scale) {
		this.isVisible = true;
		this.expandLimit = limit;
		this.width = tex2d.GetWidth();
		this.height = tex2d.GetHeight();
		this.scaleWidth = (int) (width * scale);
		this.scaleHeight = (int) (height * scale);
		this.loopMaxCount = (MathUtils.Max(scaleWidth, scaleHeight) / 2) + 1;
		this.fractions = new float[(scaleWidth * scaleHeight) * maxElements];
		this.exWidth = (int) (scaleWidth * expandLimit);
		this.exHeigth = (int) (scaleHeight * expandLimit);
		LImage image = tex2d.GetImage().ScaledInstance(scaleWidth, scaleHeight);
		Color[] pixels = image.GetPixels();
		if (image != null) {
			image.Dispose();
			image = null;
		}
		this.size = pixels.Length;
		this.pixmap = new LPixmapData(exWidth, exHeigth, true);
		int no = 0, idx = 0;
        int length = fractions.Length;
		float angle = 0;
		float speed = 0;
		System.Random random = LSystem.random;
		for (int y = 0; y < scaleHeight; y++) {
			for (int x = 0; x < scaleWidth; x++) {
				if (idx + maxElements < length) {
					no = y * scaleWidth + x;
					angle = random.Next(360);
                    speed = 10f / random.Next(30);
					fractions[idx + 0] = x;
					fractions[idx + 1] = y;
					fractions[idx + 2] = (MathUtils.Cos(angle * MathUtils.PI
							/ 180) * speed);
					fractions[idx + 3] = (MathUtils.Sin(angle * MathUtils.PI
							/ 180) * speed);
					fractions[idx + 4] = (pixels[no].PackedValue == 0xff00 ? 0xffffff
							: pixels[no].PackedValue);
					fractions[idx + 5] = x / 6 + random.Next(10);
					idx += maxElements;
				}
			}
		}
		if (remove) {
			if (tex2d != null) {
				tex2d.Destroy();
				tex2d = null;
			}
		}
		this.tmp = tex2d;
		this.StartUsePixelThread();
	}
예제 #18
0
 public PetalKernel(int n, int w, int h)
 {
     id = n;
     sakura = XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "sakura_"
                     + n + ".png");
     sakuraWidth = sakura.GetWidth();
     sakuraHeight = sakura.GetHeight();
     width = w;
     height = h;
     offsetX = 0;
     offsetY = n * 0.6f + 1.9f + MathUtils.Random() * 0.2f;
     speed = MathUtils.Random();
 }
예제 #19
0
 public AVGScreen(string initscript, LTexture img)
 {
     if (initscript == null)
     {
         return;
     }
     this.scriptName = initscript;
     if (img != null)
     {
         this.dialogFileName = img.GetFileName();
         this.dialog = img;
     }
 }
예제 #20
0
 public void SetBackgroundCG(LTexture backgroundCG)
 {
     if (backgroundCG == this.background)
     {
         return;
     }
     if (background != null)
     {
         background.Destroy();
         background = null;
     }
     this.background = backgroundCG;
 }
예제 #21
0
	public  static LTextureBatch BindBatchCache( int index,
			 int texId,  LTexture texture) {
		if (batchPools.Count > 128) {
			ClearBatchCaches();
		}
		int key = LSystem.Unite(index, texId);
        LTextureBatch pBatch = (LTextureBatch)CollectionUtils.Get(batchPools, key);
		if (pBatch == null) {
			lock (batchPools) {
				pBatch = new LTextureBatch(texture);
                CollectionUtils.Put(batchPools,key, pBatch);
			}
		}
		return pBatch;
	}
예제 #22
0
		public LSelect(LTexture formImage, int x, int y, int width, int height):base(x, y, width, height) {
			if (formImage == null) {
				this.SetBackground(new LTexture(width, height, true, Loon.Core.Graphics.Opengl.LTexture.Format.SPEED));
				this.SetAlpha(0.3F);
			} else {
				this.SetBackground(formImage);
			}
			this.customRendering = true;
			this.selectFlag = 1;
			this.tmpOffset = -(width / 10);
			this.delay = new LTimer(150);
			this.autoAlpha = 0.25F;
			this.isAutoAlpha = true;
            this.SetCursor(XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "creese.png"));
			this.SetElastic(true);
			this.SetLocked(true);
			this.SetLayer(100);
		}
예제 #23
0
파일: LPad.cs 프로젝트: DONGChuan/LGame
 public LPad(int x, int y, LTexture b, LTexture f, LTexture d, float scale)
     : base(x, y, (int)(f.GetWidth() * scale), (int)(f.GetHeight() * scale))
 {
     this.offsetX = 6 * scale;
     this.offsetY = 6 * scale;
     this.fore = f;
     this.back = b;
     this.dot = d;
     this.dotWidth = (int)(d.GetWidth() * scale);
     this.dotHeight = (int)(d.GetHeight() * scale);
     this.baseWidth = (int)(f.GetWidth() * scale);
     this.baseHeight = (int)(f.GetHeight() * scale);
     this.backWidth = (int)(b.GetWidth() * scale);
     this.backHeight = (int)(b.GetHeight() * scale);
     this.centerX = (baseWidth - dotWidth) / 2 + offsetX;
     this.centerY = (baseHeight - dotHeight) / 2 + offsetY;
     this.scale_pad = scale;
 }
예제 #24
0
 public StatusBar(int v, int max, int x, int y, int width, int height)
 {
     lock (typeof(StatusBar))
     {
         quoteCount++;
     }
     this.value_ren = v;
     this.valueMax = max;
     this.valueMin = value_ren;
     this.current = (int)((float)(width * value_ren) / (float)valueMax);
     this.goal = (int)((float)(width * valueMin) / (float)valueMax);
     this.width = width;
     this.height = height;
     this.visible = true;
     this.hit = true;
     this.texture = LoadBarColor(LColor.gray, LColor.red, LColor.orange);
     this.SetLocation(x, y);
 }
예제 #25
0
 public SplitEffect(LTexture t, RectBox limit_0, int d)
 {
     this.texture = t;
     this.width = texture.GetWidth();
     this.height = texture.GetHeight();
     this.halfWidth = width / 2;
     this.halfHeight = height / 2;
     this.multiples = 2;
     this.direction = d;
     this.limit = limit_0;
     this.timer = new LTimer(10);
     this.visible = true;
     this.v1 = new Vector2f();
     this.v2 = new Vector2f();
     switch (direction)
     {
         case Config.UP:
         case Config.DOWN:
             special = true;
             {
                 v1.Set(0, 0);
                 v2.Set(halfWidth, 0);
                 break;
             }
         case Config.TLEFT:
         case Config.TRIGHT:
             v1.Set(0, 0);
             v2.Set(halfWidth, 0);
             break;
         case Config.LEFT:
         case Config.RIGHT:
             special = true;
             {
                 v1.Set(0, 0);
                 v2.Set(0, halfHeight);
                 break;
             }
         case Config.TUP:
         case Config.TDOWN:
             v1.Set(0, 0);
             v2.Set(0, halfHeight);
             break;
     }
 }
예제 #26
0
 public static LTexture LoadTex(string name)
 {
     VaildLoon();
     LTexture texture = (LTexture)CollectionUtils.Get(texCaches, name);
     if (texture == null || texture.isClose)
     {
         try
         {
             LTextureData data = GLLoader.GetTextureData(ResourceManager.GetStream(name));
             data.fileName = name;
             texture = new LTexture(data);
             texture.isExt = true;
         }
         catch (Exception ex)
         {
             Loon.Utils.Debugging.Log.Exception(ex);
         }
         texCaches.Add(name, texture);
     }
     return texture;
 }
예제 #27
0
 public static LTexture LoadTexture(string fileName, Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     if (fileName == null)
     {
         return null;
     }
     lock (lazyTextures)
     {
         string key = fileName.Trim().ToLower();
         LTexture texture = (LTexture)CollectionUtils.Get(lazyTextures, key);
         if (texture != null && !texture.isClose)
         {
             texture.refCount++;
             return texture;
         }
         texture = new LTexture(fileName, format);
         texture.lazyName = fileName;
         CollectionUtils.Put(lazyTextures, key, texture);
         return texture;
     }
 }
예제 #28
0
 public static LTexture LoadTexture(long id, LTexture tex2d)
 {
     if (tex2d == null)
     {
         return null;
     }
     lock (lazyTextures)
     {
         string key = tex2d.lazyName == null ? Convert.ToString(id)
                 : tex2d.lazyName;
         LTexture texture = (LTexture)CollectionUtils.Get(lazyTextures, key);
         if (texture != null && !texture.isClose)
         {
             texture.refCount++;
             return texture;
         }
         texture = tex2d;
         texture.lazyName = key;
         CollectionUtils.Put(lazyTextures, key, texture);
         return texture;
     }
 }
예제 #29
0
 public SpriteFont(LTexture tex2d, List<RectBox> gs,
         List<RectBox> crops, List<Char> chars, int line,
         float space, List<float[]> kern, char def)
 {
     this.texture = tex2d;
     this.glyphs = gs;
     this.cropping = crops;
     this.charMap = chars;
     this.lineSpacing = 0;
     this.spacing = 0f;
     this.kerning = kern;
     this.defaultchar = def;
     Int32 max = 0;
     foreach (RectBox rect in glyphs)
     {
         if (max == null || rect.GetHeight() > max)
         {
             max = (int)rect.GetHeight();
         }
     }
     this.maxCharY = max;
 }
예제 #30
0
 public LNSprite(string fsName)
     : base()
 {
     this._ans = null;
     LNFrameStruct struc0 = LNDataCache.GetFrameStruct(fsName);
     if (struc0 == null)
     {
         throw new Exception("");
     }
     this._texture = struc0._texture;
     base._left = struc0._textCoords.X();
     base._top = struc0._textCoords.Y();
     base._orig_width = struc0._orig_width;
     base._orig_height = struc0._orig_height;
     base.SetNodeSize(struc0._size_width, struc0._size_height);
     base._anchor.Set(struc0._anchor);
     blendState = struc0._state;
     if (!struc0._place.Equals(0, 0))
     {
         SetPosition(struc0._place);
     }
 }
예제 #31
0
 public int add(LTexture tex2d, float x, float y)
 {
     return(Add(new LTextureObject(tex2d, x, y)));
 }
예제 #32
0
 public static int RemoveTexture(LTexture texture, bool remove)
 {
     return(RemoveTexture(texture.lazyName, remove));
 }
예제 #33
0
 public ReloadUpdateable(LTexture tex2d)
 {
     this.texture = tex2d;
 }
예제 #34
0
 public static bool ContainsValue(LTexture texture)
 {
     return(lazyTextures.ContainsValue(texture));
 }
예제 #35
0
 public static int GetRefCount(LTexture texture)
 {
     return(GetRefCount(texture.lazyName));
 }
예제 #36
0
 public static LTexture LoadTexture(LTexture texture)
 {
     return(LoadTexture(JavaRuntime.CurrentTimeMillis(), texture));
 }
예제 #37
0
 public DeleteUpdate(LTexture tex)
 {
     this.texture = tex;
 }
예제 #38
0
 public virtual void SetTexture(LTexture texture)
 {
     this.texture = texture;
 }
예제 #39
0
 public virtual void SetRegion(LTexture texture)
 {
     this.texture = texture;
     SetRegion(0, 0, texture.Width, texture.Height);
 }
예제 #40
0
 public virtual void SetRegion(LTextureRegion region)
 {
     texture = region.texture;
     SetRegion(region.xOff, region.yOff, region.widthRatio,
               region.heightRatio);
 }