public GLView(Context context) : base(context) { reQueue = new CLReQueue(); GLView.context = context; this.SetWillNotDraw(false); font = Typeface.CreateFromAsset(GLView.context.Assets, "fonts/PressStart2P.ttf"); }
private void Init(RelativeLayout mainLayout, View [] hackyViews = null) { float textureScale = this.Width * 0.00087f; this.SetScreenVirtualCoords(this.Width, this.Height); var textureIdsDouble = new int[embeddedTextures.Length][]; int i = 0, size = 0; foreach (var texturesArray in embeddedTextures) { textureIdsDouble[i] = new int[texturesArray.Length]; int j = 0; foreach (var texture in texturesArray) { embeddedTextures[i][j].Name = string.Format("CLNG_{0}.png", texture.Name); j++; size++; } i++; } this.textureIds = new int[size]; bool loadTexture = /*!embeddedTextures[j][k].InitIgnore || */ Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.iOS || Device.Idiom == TargetIdiom.Desktop; //when the app is restarted (Android only for now) //then we cannot reload embedded resources //so we store them static and won't reload afterward if (ColorLinesNG.images == null) { ColorLinesNG.images = new SKImage[size]; } else { loadTexture = false; } int [] specialBgTextureIds = new int[2]; for (i = 0; i < size; i++) { int j = 0, sum = 0; foreach (var texturesArray in embeddedTextures) { int k = 0; foreach (var texture in texturesArray) { if (i == sum) { if (loadTexture) { ColorLinesNG.images[i] = LoadTexture(embeddedTextures[j][k], textureScale); } textureIdsDouble[j][k] = i; if (embeddedTextures[j][k].Name.Equals("CLNG_Stars.png")) { specialBgTextureIds[0] = i; } else if (embeddedTextures[j][k].Name.Equals("CLNG_Nebula.png")) { specialBgTextureIds[1] = i; } } else if (i < sum) { break; } k++; sum++; } j++; } } this.field = new CLField(textureIdsDouble); this.field.InitVisuals(this.Left, this.Right, this.Bottom, this.Top, this.time.ElapsedMilliseconds, hackyViews); this.reQueue = new CLReQueue(mainLayout, ColorLinesNG.images, specialBgTextureIds); this.time.Start(); this.Inited?.Invoke(this, new EventArgs()); }