public void Render(FrontEndButton inButton, ZAtlas inAtlas) { if ((myButton.zobject).state == ZobjectState.kZobjectWaitingToShow) { return; } CGPoint renderPosition = (inButton.zobject).screenPosition; renderPosition.x += currentOffset.x; renderPosition.y += currentOffset.y; renderPosition.y += yOffset; renderPosition.y -= 35.0f; if (Globals.deviceIPad) { renderPosition.x += 32.0f; } if (myBillboard[0] == null) { myBillboard[0] = new Billboard("hangingButton1"); myBillboard[0].SetAtlas(inAtlas); myBillboard[0].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[0].myObject.layer = LayerMask.NameToLayer("guistuff"); } (DrawManager.Instance()).AddTextureToListP1(myBillboard[0], renderPosition, subTextureId, 1.0f); if (longerRope > 0.0f) { if (myBillboard[1] == null) { myBillboard[1] = new Billboard("hangingButton2"); myBillboard[1].SetAtlas(inAtlas); myBillboard[1].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[1].myObject.layer = LayerMask.NameToLayer("guistuff"); } renderPosition.y -= 65.0f; (DrawManager.Instance()).AddTextureToListP1(myBillboard[1], renderPosition, subTextureId, 1.0f); if (longerRope > 2.0f) { if (myBillboard[2] == null) { myBillboard[2] = new Billboard("hangingButton3"); myBillboard[2].SetAtlas(inAtlas); myBillboard[2].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[2].myObject.layer = LayerMask.NameToLayer("guistuff"); } renderPosition.y -= 65.0f; (DrawManager.Instance()).AddTextureToListP1(myBillboard[2], renderPosition, subTextureId, 1.0f); renderPosition.y += 65.0f; } renderPosition.y += 65.0f; } renderPosition = (inButton.zobject).screenPosition; renderPosition.x += currentOffset2.x; renderPosition.y += currentOffset2.y; renderPosition.y += yOffset; renderPosition.y -= 35.0f; if (Globals.deviceIPad) { renderPosition.x += 32.0f; } if (myBillboard[4] == null) { myBillboard[4] = new Billboard("hangingButton4"); myBillboard[4].SetAtlas(inAtlas); myBillboard[4].SetDetailsFromAtlas(inAtlas, subTextureId); myBillboard[4].myObject.layer = LayerMask.NameToLayer("guistuff"); } (DrawManager.Instance()).AddTextureToListP1(myBillboard[4], renderPosition, subTextureId, hangingButtonScale); if (longerRope > 0.0f) { renderPosition.y -= 65.0f; // (DrawManager.Instance()).AddTextureToListP1(myBillboard[1],renderPosition, subTextureId); if (longerRope > 2.0f) { renderPosition.y -= 65.0f; // (DrawManager.Instance()).AddTextureToListP1(myBillboard[2],renderPosition, subTextureId); renderPosition.y += 65.0f; } renderPosition.y += 65.0f; } }
public void Render() { if (zobject.atlas == null) { if (!this.IsOnScreen()) { this.StopRender(); } else { zobject.Render(); if (zobjectLabel != null) { CGPoint labePos = Utilities.CGPointMake(zobject.displayPosition.x + labelOffset.x, zobject.displayPosition.y + labelOffset.y); zobjectLabel.SetScreenPosition(labePos); zobjectLabel.Render(); } } } else { if (this.IsOnScreen()) { ////glEnableClientState (GL_COLOR_ARRAY); (DrawManager.Instance()).Begin(zobject.atlas); if (hangingButton != null) { zobject.SetRotation(hangingButton.UpdateRotation()); if (hangingButton != null) { hangingButton.Render(this, zobject.atlas); } if (hangingButton.hangingButtonScale != 1.0f) { zobject.SetShowScale(hangingButton.hangingButtonScale); } zobject.RenderToDrawArrays_Rotatable(); } else { zobject.RenderToDrawArrays(); } (DrawManager.Instance()).Flush(); if (zobjectLabel != null) { CGPoint labePos = Utilities.CGPointMake(zobject.displayPosition.x + labelOffset.x, zobject.displayPosition.y + labelOffset.y); zobjectLabel.SetScreenPosition(labePos); zobjectLabel.RenderFromAtlas(); } ////glDisableClientState (GL_COLOR_ARRAY); } else { this.StopRender(); } } }
public void RenderBridgeAsSprite() { // if (yCliffStart < 1000.0f) // { // int ross = 0; // } // Debug.Log("ycliff " + yCliffStart.ToString()); float scrollY = (Globals.g_world.GetGame()).GetScrollPosition().y; if ((yCliffStart + 500.0f) < scrollY) { if (isBeingDrawn) { for (int i = 0; i < 12; i++) { if (myAtlasBillboard[i] != null) { myAtlasBillboard[i].StopRender(); } } isBeingDrawn = false; } return; } (DrawManager.Instance()).Begin(Globals.g_world.GetAtlas(AtlasType.kAtlas_GrassTiles)); CGPoint mapPos = Utilities.CGPointMake(xFlowerPosition, yCliffStart); mapPos.x -= 32.0f; mapPos.y += 28.0f; CGPoint screenPosition = (Globals.g_world.game).GetScreenPosition(mapPos); int bridgeX = 12; int bridgeY = 0; int billboardId = 0; //isBeingDrawn = true; for (int x = 0; x < 2; x++) { for (int y = 0; y < 6; y++) { int tileSubtexture = ((Globals.g_world.game).lBuilder).GetTileMapTileP1P2((int)AtlasType.kAtlas_GrassTiles, bridgeX + x, bridgeY + y); CGPoint pos = Utilities.CGPointMake(screenPosition.x + ((float)x * 64.0f), screenPosition.y + ((float)y * 64.0f)); if ((Globals.g_world.game).IsOnScreenNewP1(pos, 50.0f)) // if (true) { isBeingDrawn = true; (DrawManager.Instance()).AddTextureToListP1(myAtlasBillboard[billboardId], pos, tileSubtexture, 1.0f); } else { myAtlasBillboard[billboardId].StopRender(); } billboardId++; } } (DrawManager.Instance()).Flush(); }