本文将分享重拾VB6的详细内容,并且还将对25:UsingGraphicsMethods进行详尽解释,此外,我们还将为大家带来关于com.badlogic.gdx.graphics.Orthograp
本文将分享重拾VB6的详细内容,并且还将对25:Using Graphics Methods进行详尽解释,此外,我们还将为大家带来关于com.badlogic.gdx.graphics.OrthographicCamera的实例源码、com.codahale.metrics.graphite.Graphite的实例源码、com.codahale.metrics.graphite.PickledGraphite的实例源码、Difference between drawing with QPainter and (QGraphicsView + QGraphicsScene)的相关知识,希望对你有所帮助。
本文目录一览:- 重拾VB6(25):Using Graphics Methods
- com.badlogic.gdx.graphics.OrthographicCamera的实例源码
- com.codahale.metrics.graphite.Graphite的实例源码
- com.codahale.metrics.graphite.PickledGraphite的实例源码
- Difference between drawing with QPainter and (QGraphicsView + QGraphicsScene)
重拾VB6(25):Using Graphics Methods
来自MSDN-2001-OCT: Visual Tools and Languages/Visual Studio 6.0 Documentation/Visual Basic Documentation/Using Visual Basic/Programmer’s Guide/Part 2: What Can You Do With Visual Basic/Working with Text and Graphics/
1. basics of Graphics Methods
(1)
Cls | Clears all graphics and Print output. |
PSet | Sets the color of an individual pixel. |
Point | Returns the color value of a specified point. |
Line | Draws a line,rectangle,or filled-in Box. |
Circle | Draws a circle,ellipse,or arc. |
PaintPicture | Paints graphics at arbitrary locations. |
(2) The graphics methods work well in situations where using graphical controls require too much work.
(3) Graphics methods offer some visual effects that are not available in the graphical controls. For example,you can only create arcs or paint individual pixels using the graphics methods.
(4) Graphics you create with these graphics methods appear on the form in a layer of their own. This layer is below all other controls on a form,so using the graphics methods can work well when you want to create graphics that appear behind everything else in your application.
(5) 短处:在设计时不可见(而用图形控件则可在设计时就知道效果)。
(6) Every graphics method draws output on a form,in a picture Box,or to the Printer object. To indicate where you want to draw,precede a graphics method with the name of a form or picture Box control.
Each drawing area has its own coordinate system that determines what units apply to the coordinates. In addition,every drawing area has its own complete set of graphics properties.
2. Drawing points,lines,Boxes,circles,ellipses,pictures
(1) You can precede each of these points with the Step keyword,specifying that the location of the point is relative to the last point drawn.
(2) 用Line可以画Box: 直接画4条线或用B参数。还可用F参数及指定填充颜色和FillStyle。
(3) The Circle method draws a variety of circular and elliptical (oval) shapes. In addition,Circle draws arcs (segments of circles) and pie-shaped wedges.
(4) The PaintPicture method can be used in place of the BitBlt Windows API function to perform a wide variety of bit operations while moving a rectangular block of graphics from one position to any other position.
The pic argument must be a Picture object,as from the Picture property of a form or control.
3. DrawWidth,DrawMode
(1) The DrawWidth property specifies the width of the line for output from the graphics methods. The BorderWidth property specifies the outline thickness of line and shape controls.
(2) The DrawMode property determines what happens when you draw one pattern on top of another.
(3) (4)
4 | Not copy Pen. Draws the inverse of the line pattern,regardless of what is already there. |
7 | Xor Pen. displays the difference between the line pattern and the existing display,as explained later in this section. Drawing an object twice with this mode restores the background precisely as it was. |
11 | No operation. In effect,this turns drawing off. |
13 | copy Pen (default). Applies the line’s pattern,regardless of what is already there. |
4. Creating Graphics When a Form Loads
When creating graphics that appear on a form when it loads,consider placing the graphics methods in the Form_Paint event. Form_Paint graphics will get repainted automatically in every paint event. If you place graphics in the Form_Load event,set the AutoRedraw property on the form to True. In this case,Form_Load should show the form,then draw the graphics. Remember,forms are not visible during the Form_Load event. Because Visual Basic does not process graphics methods on a form that is not visible,graphics methods in the Form_Load event are ignored unless AutoRedraw is set to True.
com.badlogic.gdx.graphics.OrthographicCamera的实例源码
@Override public void show() { fpsLogger = new FPSLogger(); batch = new SpriteBatch(); camera = new OrthographicCamera(500,800); viewport = new FitViewport(500,800,camera); player = new Player(); player.create(); background = new Background(); background.create(); spawningFactory = new SpawningFactory(); spawningFactory.create(); spawningEnemy = new SpawningEnemy(); spawningEnemy.create(); spawningBullet = new SpawningBullet(); spawningBullet.create(); ui = new UI(); ui.create(); }
/** * Zeigt den Namenswahl Bilschirm an * * @param camera die aktuelle Kamera * @param deltaTime die vergangene Zeit seit dem letztem Frame */ public void renderName(OrthographicCamera camera,float deltaTime) { strokeTimer += deltaTime; if (strokeTimer > 0.6f) { strokeTimer = 0f; stateSwitch = !stateSwitch; playerNamestroke = String.format("%s%s",playerName,stateSwitch ? " " : "|"); } fontLayout.setText(font,localeBundle.get("name_eingeben"),Color.WHITE,camera.viewportWidth,Align.center,false); font.draw(batch,fontLayout,-camera.viewportWidth / 2,camera.viewportHeight / 2 - 120); fontLayout.setText(font,playerNamestroke,Color.ROYAL,30); fontLayout.setText(smallFont,localeBundle.get("enter_bestaetigen"),false); smallFont.draw(batch,-camera.viewportHeight / 2 + 70); }
public GameService(SpriteBatch batch,IGameAsset asset,BaseGameSetting setting,OrthographicCamera camera,ISceneManager sceneManager) { this.batch = batch; this.asset = asset; this.setting = setting; if (asset == null) this.asset = new DefaultGameAsset(); if (setting == null) this.setting = new DefaultGameSetting(); this.camera = camera; this.setChangeScene(sceneManager); Rectangle.tmp.set(0,getwindowSize().x,getwindowSize().y); services = new IService[MAX_SERVICES]; }
public static boolean touchInRectangle(Rectangle r,OrthographicCamera camera) { if (Gdx.input.isTouched()) { Vector3 touchPos = new Vector3(); touchPos.set(Gdx.input.getX(),Gdx.input.getY(),0); camera.unproject(touchPos); return r.x <= touchPos.x && r.x + r.width >= touchPos.x && r.y <= touchPos.y && r.y + r.height >= touchPos.y; } return false; }
@Override public void create() { rotationSpeed = 0.5f; mesh = new Mesh(true,4,6,new VertexAttribute(VertexAttributes.Usage.Position,3,"attr_Position"),new VertexAttribute(Usage.TextureCoordinates,2,"attr_texCoords")); texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg")); mesh.setVertices(new float[] { -1024f,-1024f,1,1024f,0 }); mesh.setIndices(new short[] { 0,0 }); cam = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH; yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT; font = loadBitmapFont("default.fnt","default.png"); scale = Math.min(xScale,yScale); cam.zoom = 1/scale; // cam.project(start_position); cam.position.set(0,0); batch = new SpriteBatch(); }
@Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); camera = new OrthographicCamera(1,h/w); batch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/libgdx.png")); texture.setFilter(TextureFilter.Linear,TextureFilter.Linear); TextureRegion region = new TextureRegion(texture,200,200); sprite = new Sprite(region); sprite.setSize(1f,sprite.getHeight() / sprite.getWidth()); sprite.setorigin(sprite.getWidth()/2,sprite.getHeight()/2); sprite.setPosition(-.5f,-.5f); }
public MenuScreen() { camera = new OrthographicCamera(); viewport = new FitViewport(Game.WIDTH,Game.HEIGHT,camera); viewport.apply(); camera.position.set(Game.WIDTH / 2,Game.HEIGHT / 2,0); camera.update(); betaText = new BitmapFont(Gdx.files.internal("score.fnt"),Gdx.files.internal("score.png"),false); betaText.getData().setScale(0.35f); logo = new Sprite(new Texture("logo.png")); Random r = new Random(); background = new Particle[r.nextInt(55 - 45) + 45]; for (int i = 0; i < background.length; i++) { int size = r.nextInt(4) + 1; int x = r.nextInt(Game.WIDTH); int y = r.nextInt(Game.HEIGHT); background[i] = new Particle(x,y,-1,new Color(207 / 255f,187 / 255f,20 / 255f,1f),size); } musicMuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_muted.png"))); musicUnmuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_unmuted.png"))); play = new CenteredButton(500,"buttons/play.png"); music = new Button(Game.WIDTH - 130,15,Game.musicMuted() ? musicMuted : musicUnmuted); music.setScale(4f); }
LevelScreen(GftGame game) { this.game = game; this.guiCam = new OrthographicCamera(800,480); this.guiCam.position.set(800 / 2,480 / 2,0); this.backBounds = new Rectangle(7,432,48,48); this.autoMovetoNextBounds = new Rectangle(0,62); this.levelBounds = new ArrayList<Rectangle>(); int line = 0; int column = 0; for(int i = 0; i < LEVELS; i++) { this.levelBounds.add(i,new Rectangle(370 + 75 * column++,240 - 70 * line,57,57)); if(column == 5) { column = 0; line++; } } this.touchPoint = new Vector3(); }
public GameCenter(Chat game){ this.game = game; /*Camera Settings*/ camera = new OrthographicCamera(); camera.setToOrtho(false,480,800); camera.position.set(480/2,800/2,0); /*Button Areas*/ wordTiles = new Rectangle(480/2-250/2,250,55); Arkanoid = new Rectangle(480/2-250/2,800/2-60,55); WordCrush = new Rectangle(480/2-250/2,800/2-120,55); EndlessRoad = new Rectangle(480/2-250/2,800/2-180,55); bottone4 = new Rectangle(480/2-250/2,800/2-240,55); buttonTexture = new Texture("green_button00.png"); touch = new Vector3(); }
public ScreenCombat(GameManager gameManager) { this.gameManager = gameManager; managerAssets = ManagerAssets.getInstance(); cam = new OrthographicCamera(); UpdatedisplayCombat.getInstance().setScreenCombat(this); camera = new PerspectiveCamera(40,Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); camera.position.set(0,350);//initial 180 camera.lookAt(0,0); camera.far = 2500; camera.near = 1; camera.update(); centerPlayer = new Integer[7]; for(int i=0;i<7;i++){ centerPlayer[i]=-1; } }
private void initUtils() { //init camera & viewport camera = new OrthographicCamera(); viewport = new StretchViewport(polymorph.WORLD_WIDTH,polymorph.WORLD_HEIGHT,camera); viewport.apply(true); camera.update(); //init sprite batch batch = new SpriteBatch(); batch.setProjectionMatrix(camera.combined); //init font FreeTypeFontGenerator fontGenerator = polymorph.getAssetManager().get(polymorph.FONT_BOLD_PATH,FreeTypeFontGenerator.class); FreeTypeFontParameter fontSettings = new FreeTypeFontParameter(); fontSettings.size = 80; fontSettings.minFilter = TextureFilter.Linear; fontSettings.magFilter = TextureFilter.Linear; font = fontGenerator.generateFont(fontSettings); }
public void show() { if (!init) { loadingScreenAssets = new Assets.LoadingScreenAssets(); AL.getAssetManager().loadAssetFields(loadingScreenAssets); AL.getAssetManager().finishLoading(); font = new BitmapFont(); batch = new SpriteBatch(); cam = new OrthographicCamera(); viewport = new FitViewport(1920,1080); viewport.setCamera(cam); stage = new Stage(viewport); stage.setViewport(viewport); skin = loadingScreenAssets.styles_json; loadingScreenBar = new ProgressBar(0,100,false,skin); loadingScreenBar.setPosition(25,-10); loadingScreenBar.setSize(1890,50); stage.addActor(loadingScreenBar); } init = true; }
/** * Method responsible for initializing the main menu * Called when the screen becomes the current screen of the game */ @Override public void show() { cam = new OrthographicCamera(); viewport = new FitViewport(1920,1080); viewport.setCamera(cam); stage = new Stage(viewport); stage.setViewport(viewport); skin = settingsAssets.styles_json; int x = 1920; int y = 1080; spriteBatch = new SpriteBatch(); mainbackground = settingsAssets.testmainscreen; BitmapFont font = settingsAssets.bocklin_fnt; TextureRegion backgroundTexture = new TextureRegion(settingsAssets.background_textbutton); inputTable = new Table(); keys = IInputConfig.InputKeys.values(); keyMap = new HashMap<>(); initInputRows(font,backgroundTexture); createBackButton(); AL.input.setInputProcessor(new InputMultiplexer(stage,this)); }
public void render(OrthographicCamera camera,SpriteBatch batch,int y,MenuEntry activeEntry,SchoolGame game,I18NBundle localeBundle,float deltaTime) { Color entryColor = getColor(); if (this == activeEntry) { entryColor = getActiveColor(); } if (!isEnabled()) { entryColor = getdisabledColor(); } if (font == null) font = game.getDefaultFont(); if (fontSmall == null) fontSmall = game.getLongTextFont(); fontLayout.setText(font,localeBundle.format(getLabel(),id,used,gender),entryColor,false); font.draw(batch,y); fontLayout.setText(fontSmall,localeBundle.format(detail,levelName,playTime),false); fontSmall.draw(batch,y - 50); }
public RenderSystem(DecalBatch decalBatch,AssetManager assetManager,float worldDegree,Assets.LevelAssets assets) { super(Aspect.all(RenderComponent.class,PositionComponent.class)); this.levelAssets = assets; decalmap = new ObjectMap<>(); uiMap = new ObjectMap<>(); this.decalBatch = decalBatch; this.assetManager = assetManager; buffers = new ObjectMap<>(); this.spriteBatch = new SpriteBatch(); this.font = assets.uifont; font.setColor(Color.BLACK); this.uiCamera = new OrthographicCamera(); Viewport viewportUi = new FitViewport(levelAssets.health_bar_gradient.getWidth(),levelAssets.health_bar_gradient.getHeight(),uiCamera); viewportUi.update(viewportUi.getScreenWidth(),viewportUi.getScreenHeight(),true); stateTime = 0; this.worldDegree = worldDegree; gradientShader = new ShaderProgram(Shaders.GradientShader.vertexShader,Shaders.GradientShader.fragmentShader); if (gradientShader.isCompiled() == false) throw new IllegalArgumentException("Couldn't compile shader: " + gradientShader.getLog()); shaderBatch = new SpriteBatch(10,gradientShader); }
public UiStage(){ OrthographicCamera _uiCamera = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); this.setViewport(new ScreenViewport(_uiCamera)); // create skin // root table _roottable = createRoottable(); createErrorMessagePanel(); uiPanel = new UIPanel(Assets._skin); _roottable.add(uiPanel) .align(Align.center) .fill(true,true) .minWidth(uiPanel.getLeftSection().getPrefWidth() + uiPanel.getMidSection().getPrefWidth() + uiPanel.getRightSection().getPrefWidth() + 50); // align stuff _roottable.align(Align.bottom); // add root table to stage this.addActor(_roottable); _pauseWindow = new PauseWindow("Pause",Assets._skin); _pauseWindow.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); this.addActor(_pauseWindow); this.resize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); }
public Hud(SpriteBatch sb) { countKill = 0; viewport = new FitViewport(ScreenConf.V_WIDTH,ScreenConf.V_HEIGHT,new OrthographicCamera()); stage = new Stage(viewport,sb); Table table = new Table(); table.setFillParent(true); table.top(); countKillLabel = new Label(String.format("%03d",countKill),new Label.LabelStyle(new BitmapFont(),Color.WHITE)); table.add(countKillLabel).expandX().padTop(10); table.add().expandX(); table.add().expandX(); table.add().expandX(); stage.addActor(table); }
TrainingScreen(GftGame game) { this.game = game; this.guiCam = new OrthographicCamera(800,48); this.playPauseBounds = new Rectangle(7,7,48); this.restartBounds = new Rectangle(62,48); this.backFowardtBounds = new Rectangle(127,48); this.soundBounds = new Rectangle(192,48); this.minusBounds = new Rectangle(590,48); this.plusBounds = new Rectangle(699,48); this.touchPoint = new Vector3(); this.grid = new Grid(this.game); this.grid.loadTraining(); this.bottomBar = new BottomBar(this.game); this.firstRun = 3; this.lastUpdateTime = TimeUtils.millis(); this.bpm = MINUTE_IN_MILLIS / SettingsUtil.bpm; }
/** * Create a new SelectionSystem object * * @param camera - the world camera * @param batch - the batch to draw to * @param commandUI - the command ui system used to remove set commands * @param quadtree - the quadtree containign all selectable entities */ public SelectionSystem(OrthographicCamera camera,DrawingBatch batch,CommandUISystem commandUI,SpatialQuadtree<Entity> quadtree) { super(4); this.camera = camera; this.batch = batch; this.cmdUI = commandUI; this.quadtree = quadtree; }
public ThirdScreen (Game agame) { game = agame; batch = new SpriteBatch(); img = new Texture("aklu.jpg"); shapeRenderer = new ShapeRenderer(); centerCircle = new Circle(); leftCircle = new Circle(); rightCircle = new Circle(); myTouch = new Circle(); camera = new OrthographicCamera(); camera.setToOrtho(false,400); colorChanger = 0; counter = 0; }
@Override public void show() { //Initialize everything screenCamera = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); camera = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); camera.position.x = 0; camera.position.y = 0; batch = new DrawingBatch(1000,ShaderUtil.compileShader(Gdx.files.internal("shaders/basic.vertex.glsl"),Gdx.files .internal("shaders/basic.fragment.glsl")),true); batch.setBlendFunction(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA); setLevel(level); }
@Override public void create () { batch = new SpriteBatch(); img = new Texture("aklu.jpg"); shapeRenderer = new ShapeRenderer(); centerCircle = new Circle(); leftCircle = new Circle(); rightCircle = new Circle(); myTouch = new Circle(); camera = new OrthographicCamera(); camera.setToOrtho(false,400); colorChanger = 0; }
public void render(SpriteBatch batch,OrthographicCamera screenCamera) { batch.setShader(null); batch.setProjectionMatrix(screenCamera.combined); batch.begin(); batch.draw(pixelBufferRegion,screenCamera.viewportWidth,screenCamera.viewportHeight); batch.end(); }
public GameScreen(SkyCity skyCity) { super(skyCity); state = InputState.GAME; hud = new Hud(skyCity.batch); chat = new Chat(skyCity.batch); mapCamera = new OrthographicCamera(SCREEN_WIDTH,SCREEN_HEIGHT); gamePort = new FitViewport(SCREEN_WIDTH,SCREEN_HEIGHT,mapCamera); renderer = new OrthogonalTiledMapRenderer(Assets.getInstance().getTiledMap(),skyCity.batch); mapCamera.position.set(SCREEN_WIDTH / 2,SCREEN_HEIGHT / 2,0); renderer.setView(mapCamera); }
public RenderSystem(Batch batch) { super(FAMILY); this.camera = new OrthographicCamera(); viewport = new FitViewport(Asteroids.VIRTUAL_WIDTH,Asteroids.VIRTUAL_HEIGHT,camera); viewport.apply(true); this.batch = batch; shapeRenderer = new ShapeRenderer(); shapeRenderer.setColor(Color.RED); font = ServiceLocator.getAppComponent().getAssetService().getSkin(AssetService.SkinAsset.UISKIN).getFont("default-font"); }
public Background(OrthographicCamera camera) { this.camera = camera; this.texture = new Texture("bg.png"); this.sprite = new Sprite(texture); this.sprite.setSize(texture.getWidth(),texture.getHeight()); this.sprite.setPosition(0,0); this.spriteClone = new Sprite(texture); this.spriteClone.setSize(texture.getWidth(),texture.getHeight()); this.spriteClone.setPosition((FlappyChapa.WIDTH + FlappyChapa.WIDTH/2) - 20f,0); }
/** * Zeigt den Splashscreen an. * * @param camera die aktuelle Kamera * @param deltaTime die vergangene Zeit seit dem letztem Frame */ @Override public void render(OrthographicCamera camera,float deltaTime) { batch.setProjectionMatrix(camera.combined); batch.begin(); screensprite.draw(batch); batch.end(); }
public void setupUIManager(String skinFilePath) { skin = new Skin(Gdx.files.internal(skinFilePath)); uiManager = new UIManager("dialog",skin,getGameService()); uiBatch = uiManager.getSpriteBatch(); uiManager.getCamera().update(); uiBatch.setTransformMatrix(uiManager.getCamera().combined); // Gdx.graphics.setdisplayMode(Gdx.graphics.getWidth(),// Gdx.graphics.getH,true); if (isZoomUI()) { OrthographicCamera uiCamera = (OrthographicCamera) uiManager .getCamera(); uiCamera.zoom = services.getCamera().zoom; } }
/** * @param configuration the {@link ZoompulseEffectConfiguration} which drives the effect * @param cameras the cameras to be manipulated */ public ZoompulseEffect(ZoompulseEffectConfiguration configuration,OrthographicCamera... cameras) { if (cameras.length == 0) throw new IllegalArgumentException("at least one camera is required"); this.cameras = Array.with(cameras); this.maxZoomTime = configuration.maxZoomTime / 6; this.targetZoom = configuration.targetZoom; }
/** * Setup camera at specific zoom and position at map center * * @param zoom */ protected void setupCamera(float zoom) { OrthographicCamera cam = services.getCamera(); cam.zoom = zoom; cam.position.set(Gdx.graphics.getWidth() / 2f,Gdx.graphics.getHeight() / 2f,0); }
public CameraWrapper(OrthographicCamera camera) { this.camera = camera; this.cameraOffsetX = this.camera.position.x; this.cameraOffsetY = this.camera.position.y; this.tempCameraParams = new TempCameraParams(0,1); // this.sync(); // add some basic modifications this.registerMod(new Shake1CameraModification(),Shake1CameraModification.class); this.registerMod(new Shake2CameraModification(),Shake2CameraModification.class); this.registerMod(new Shake3CameraModification(),Shake3CameraModification.class); }
public GameScreen() { game.setGameScreen(this); createWorld(); camera = new OrthographicCamera(); camera.setToOrtho(false,GameCore.SCREEN_WIDTH,GameCore.SCREEN_HEIGHT); uiCamera = new OrthographicCamera(); uiCamera.setToOrtho(false,GameCore.SCREEN_HEIGHT); }
public SplashScreen() { camera = new OrthographicCamera(); viewport = new FitViewport(Game.WIDTH,0); camera.update(); logo = new Sprite(new Texture(Gdx.files.internal("gussio.png"))); initiateTime = System.currentTimeMillis(); }
public World(String avatarImage) { batch = new SpriteBatch(); texture = new Texture("images/black.png"); this.avatarImage = avatarImage; Gdx.input.setInputProcessor(this); camera = new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); music.setLooping(true); music.play(); connectedTiles = new HashMap<Integer,ArrayList<Tile>>(); block = null; blockAlongX = false; lastBlockX = -1; lastBlockY = -1; fadeTime = FADE_TIME / 2.0f; level = 1; File levelsFolder = new File("levels/"); if(levelsFolder.exists()) { File[] files = levelsFolder.listFiles(); if(files == null) { maxLevels = 0; } else { maxLevels = files.length; } } else { maxLevels = 0; } loadLevel("levels/1.txt"); }
public void render(OrthographicCamera camera,float deltaTime) { if (font == null) font = game.getTitleFont(); fontLayout.setText(font,localeBundle.get(getLabel()),getColor(),y); }
public void render(OrthographicCamera camera,float deltaTime) { if (font == null) font = game.getDefaultFont(); fontLayout.setText(font,y); }
public ScreenRooms(GameManager gameManager) { this.gameManager = gameManager; manager = ManagerAssets.getInstance(); camera = new PerspectiveCamera(40,Gdx.graphics.getHeight()*0.183f);//initial 180 camera.lookAt(0,0); camera.far = 2500; camera.near = 1; camera.update(); cam = new OrthographicCamera(); renderer = new ImmediateModeRenderer20(false,true,1); }
public void renderCercle(OrthographicCamera camera,float amt,Color c){ float start = 0f; float end = amt * 360f; lookup.bind(); renderer.begin(camera.combined,GL20.GL_TRIANGLE_STRIP); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA); int segs = (int)(24 * Math.cbrt(r)); end += 90f; start += 90f; float halfThick = thickness/2f; float step = 360f / segs; for (float angle=start; angle<(end+step); angle+=step) { float tc = 0.5f; if (angle==start) tc = 0f; else if (angle>=end) tc = 1f; float fx = MathUtils.cosDeg(angle); float fy = MathUtils.sinDeg(angle); float z = 0f; //renderer. renderer.color(c.r,c.g,c.b,c.a); renderer.texCoord(tc,1f); renderer.vertex(cx + fx * (r + halfThick),cy + fy * (r + halfThick),z); renderer.color(c.r,0f); renderer.vertex(cx + fx * (r + -halfThick),cy + fy * (r + -halfThick),z); } renderer.end(); }
@Override public void create() { GameWorldEntity gameWorldEntity = mEngine.getFirstEntityOfType(GameWorldEntity.class); if (gameWorldEntity == null) { // cannot create a camera without a game world return; } mCamera = new OrthographicCamera(gameWorldEntity.getWorldWidth(),gameWorldEntity.getWorldHeight()); mCamera.position.set(mCamera.viewportWidth / 2f,mCamera.viewportHeight / 2f,0.f); PositionComponent positionComponent = getComponentByType(PositionComponent.class); positionComponent.position.set(mCamera.viewportWidth / 2f,mCamera.viewportHeight / 2f); }
@Override public OrthographicCamera copy (Kryo kryo,OrthographicCamera original) { OrthographicCamera camera = new OrthographicCamera(); camera.position.set(original.position); camera.direction.set(original.direction); camera.up.set(original.up); camera.near = original.near; camera.far = original.far; camera.viewportWidth = original.viewportWidth; camera.viewportHeight = original.viewportHeight; camera.zoom = original.zoom; camera.update(); return camera; }
com.codahale.metrics.graphite.Graphite的实例源码
public static void config(String graphiteHost,int port,TimeUnit tu,int period,VertxOptions vopt,String hostName) { final String registryName = "okapi"; MetricRegistry registry = SharedMetricRegistries.getorCreate(registryName); DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions(); metricsOpt.setEnabled(true).setRegistryName(registryName); vopt.setMetricsOptions(metricsOpt); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,port)); final String prefix = "folio.okapi." + hostName ; GraphiteReporter reporter = GraphiteReporter.forRegistry(registry) .prefixedWith(prefix) .build(graphite); reporter.start(period,tu); logger.info("Metrics remote:" + graphiteHost + ":" + port + " this:" + prefix); }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,graphitePort)); GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .prefixedWith(graphitePrefix) .build(graphite); graphiteReporter.start(1,TimeUnit.MINUTES); } }
@Override public void report(MetricRegistry metricRegistry) { JbootMetricsGraphiteReporterConfig config = Jboot.config(JbootMetricsGraphiteReporterConfig.class); if (StringUtils.isBlank(config.getHost())) { throw new NullPointerException("graphite reporter host must not be null,please config jboot.metrics.reporter.graphite.host in you properties."); } if (config.getPort() == null) { throw new NullPointerException("graphite reporter port must not be null,please config jboot.metrics.reporter.graphite.port in you properties."); } if (config.getPrefixedWith() == null) { throw new NullPointerException("graphite reporter prefixedWith must not be null,please config jboot.metrics.reporter.graphite.prefixedWith in you properties."); } Graphite graphite = new Graphite(new InetSocketAddress(config.getHost(),config.getPort())); GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry) .prefixedWith(config.getPrefixedWith()) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .build(graphite); reporter.start(1,TimeUnit.MINUTES); }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (properties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = properties.getMetrics().getGraphite().getHost(); Integer graphitePort = properties.getMetrics().getGraphite().getPort(); String graphitePrefix = properties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { Boolean graphiteEnabled = propertyResolver.getProperty(PROP_GRAPHITE_ENABLED,Boolean.class,false); if (graphiteEnabled) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = propertyResolver.getrequiredProperty(PROP_HOST); Integer graphitePort = propertyResolver.getrequiredProperty(PROP_PORT,Integer.class); String graphitePrefix = propertyResolver.getProperty(PROP_GRAPHITE_PREFIX,String.class,""); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,graphitePort)); GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .prefixedWith(graphitePrefix) .build(graphite); graphiteReporter.start(1,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
/** * Start a metrics graphite reporter. */ public GraphiteReporter(Configuration conf) { Configuration.MetricsConfig.ReporterConfig metricConf = conf.getReporterConfig(GraphiteReporter.type); frequency = conf.getReportingFrequency(); String[] urlSplit = metricConf.url.split(":"); String hostName = urlSplit[0]; int port = 3002; if (urlSplit.length > 1) { port = Integer.parseInt(urlSplit[1]); } reporter = com.codahale.metrics.graphite.GraphiteReporter .forRegistry(Metrics.registry) .prefixedWith(metricConf.namespace) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.SECONDS) .build(new Graphite(new InetSocketAddress(hostName,port))); }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
protected void startMetricReporters(int metricsReportingInterval,int graphitePort,String graphiteHostname,MetricRegistry metricRegistry) { if (shouldCreateLoggingMetricsReporter()) { registerReporter(Slf4jReporter.forRegistry(metricRegistry) .convertDurationsTo(MILLISECONDS) .convertRatesTo(SECONDS) .withLoggingLevel(TRACE) .outputTo(getLogger(ReverseProxyFilter.class)) .build() ).start(metricsReportingInterval,SECONDS); } if (shouldCreateGraphiteMetricsReporter()) { Graphite graphite = new Graphite(graphiteHostname,graphitePort); registerReporter(GraphiteReporter.forRegistry(metricRegistry) .convertDurationsTo(MILLISECONDS) .convertRatesTo(SECONDS) .build(graphite) ).start(metricsReportingInterval,SECONDS); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@Override public void configureReporters(MetricRegistry metricRegistry) { registerReporter(Slf4jReporter.forRegistry(metricRegistry) .outputTo(LoggerFactory.getLogger("metrics")) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .build()).start(1,TimeUnit.MINUTES); // set DNS ttl to 60 per Hosted Graphite documentation java.security.Security.setProperty("networkaddress.cache.ttl","60"); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,graphitePort)); registerReporter(GraphiteReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .prefixedWith(graphiteApiKey) .build(graphite)).start(1,TimeUnit.MINUTES); }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@Override public GraphiteSender get() { switch (configuration.getProtocol()) { case PICKLE: return new PickledGraphite( configuration.getAddress(),SocketFactory.getDefault(),configuration.getCharset(),configuration.getPickleBatchSize()); case TCP: return new Graphite(configuration.getAddress(),configuration.getCharset()); case UDP: return new GraphiteUDP(configuration.getAddress()); default: throw new IllegalArgumentException("UnkNown Graphite protocol \"" + configuration.getProtocol() + "\""); } }
public GraphiteRegistry(MetricRegistry metricRegistry,JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; if (this.jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info(INITIALIZING_MESSAGE); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = getGraphite(graphiteHost,graphitePort); GraphiteReporter graphiteReporter = getBuilder(metricRegistry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .prefixedWith(graphitePrefix) .build(graphite); graphiteReporter.start(REPORTER_PERIOD,TimeUnit.MINUTES); } }
private static void init() { // Init JMX reporter reporter = JmxReporter.forRegistry(registry).build(); reporter.start(); // Init graphite reporter Graphite graphite = getGraphite(); GraphiteReporter graphiteReporter; if (graphite == null) { graphiteReporter = null; } else { graphiteReporter = GraphiteReporter.forRegistry(registry).prefixedWith(PREFIX).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite); graphiteReporter.start(AuditConfig.GRAPHITE_REPORT_PERIOD_SEC,TimeUnit.SECONDS); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost,TimeUnit.MINUTES); } }
@postconstruct private void init() { Boolean graphiteEnabled = propertyResolver.getProperty(PROP_GRAPHITE_ENABLED,TimeUnit.MINUTES); } }
@postconstruct private void init() { Boolean graphiteEnabled = propertyResolver.getProperty(PROP_GRAPHITE_ENABLED,TimeUnit.MINUTES); } }
com.codahale.metrics.graphite.PickledGraphite的实例源码
@Override public GraphiteSender get() { switch (configuration.getProtocol()) { case PICKLE: return new PickledGraphite( configuration.getAddress(),SocketFactory.getDefault(),configuration.getCharset(),configuration.getPickleBatchSize()); case TCP: return new Graphite(configuration.getAddress(),configuration.getCharset()); case UDP: return new GraphiteUDP(configuration.getAddress()); default: throw new IllegalArgumentException("UnkNown Graphite protocol \"" + configuration.getProtocol() + "\""); } }
private static void initGraphiteReporter(final GraphiteReporterConfig graphiteReporterConfig) { HostAndPort hostAndPort = graphiteReporterConfig.getAddress(); InetSocketAddress inetSocketAddress = new InetSocketAddress(hostAndPort.getHost(),hostAndPort.getPort()); GraphiteSender graphiteSender = graphiteReporterConfig.isEnableBatching() ? new PickledGraphite(inetSocketAddress) : new Graphite(inetSocketAddress); graphiteReporter = GraphiteReporter.forRegistry(metricRegistry) .prefixedWith(prefix) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MICROSECONDS) .withClock(new Clock() { private long lastReportingTime = 0; @Override public long getTick() { return System.nanoTime(); } @Override public synchronized long getTime() { if (lastReportingTime == 0) { lastReportingTime = System.currentTimeMillis(); return lastReportingTime; } lastReportingTime += graphiteReporterConfig.getReportingIntervalInSeconds() * 1000; return lastReportingTime; } }) .filter(buildMetricFilter(graphiteReporterConfig.getStartsWithFilters(),graphiteReporterConfig.getBlockedStartsWithFilters())) .build(graphiteSender); graphiteReporter.start(graphiteReporterConfig.getReportingIntervalInSeconds(),TimeUnit.SECONDS); }
@Test public void getReturnsGraphitePickledGraphite() throws Exception { final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration() { @Override public GraphiteProtocol getProtocol() { return GraphiteProtocol.PICKLE; } }; final GraphiteSenderProvider provider = new GraphiteSenderProvider(configuration); final GraphiteSender graphiteSender = provider.get(); assertTrue(graphiteSender instanceof PickledGraphite); assertFalse(graphiteSender.isConnected()); }
@Override public void start() { LOG.info("Starting Graphite reporter to [host={}; port={}]",host,port); graphite = new PickledGraphite(new InetSocketAddress(host,port)); reporter = GraphiteReporter.forRegistry(registry) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .build(graphite); reporter.start(reportEveryMillis,TimeUnit.MILLISECONDS); }
public static void main(String[] args) throws Exception { CreeperConfiguration creeperConfiguration = new CreeperConfiguration(buildConfiguration(args)); final JmxReporter jmxReporter = JmxReporter.forRegistry(metrics).build(); jmxReporter.start(); if (creeperConfiguration.isProduction) { final PickledGraphite pickledGraphite = new PickledGraphite(new InetSocketAddress(creeperConfiguration.graphiteHostname,creeperConfiguration.graphitePort)); final GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics) .prefixedWith(creeperConfiguration.mudName) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .build(pickledGraphite); reporter.start(1,TimeUnit.MINUTES); } Files.isDirectory().apply(new File("world/")); DB db = DBMaker.fileDB(new File("world/" + creeperConfiguration.databaseFileName)) .transactionEnable() .cloSEOnJvmShutdown() .make(); MapDBCreeperStorage mapDBCreeperStorage = new MapDBCreeperStorage(db); mapDBCreeperStorage.startAsync(); mapDBCreeperStorage.awaitRunning(); PlayerManager playerManager = new PlayerManager(mapDBCreeperStorage,new SessionManager()); playerManager.createallGauges(); RoomManager roomManager = new RoomManager(playerManager); startUpMessage("Configuring core systems."); MapsManager mapsManager = new MapsManager(creeperConfiguration,roomManager); ChannelUtils channelUtils = new ChannelUtils(playerManager,roomManager); EntityManager entityManager = new EntityManager(mapDBCreeperStorage,roomManager,playerManager); GameManager gameManager = new GameManager(mapDBCreeperStorage,creeperConfiguration,playerManager,entityManager,mapsManager,channelUtils,HttpClients.createDefault()); startUpMessage("Reading world from disk."); WorldStorage worldExporter = new WorldStorage(roomManager,gameManager.getFloorManager(),gameManager); worldExporter.readWorldFromdisk(); startUpMessage("Creating and registering Player Management MBeans."); PlayerManagementManager playerManagementManager = new PlayerManagementManager(gameManager); playerManagementManager.processplayersMarkedForDeletion(); playerManagementManager.createAndRegisterallPlayerManagementMBeans(); startUpMessage("Configuring commands"); ConfigureCommands.configure(gameManager); startUpMessage("Configure Bank commands"); ConfigureCommands.configureBankCommands(gameManager); startUpMessage("Configure Locker commands"); ConfigureCommands.configureLockerCommands(gameManager); startUpMessage("Configure Player Class Selection commands"); ConfigureCommands.configurePlayerClassSelector(gameManager); startUpMessage("Configuring npcs and merchants"); ConfigureNpc.configure(entityManager,gameManager); CreeperServer creeperServer = new CreeperServer(creeperConfiguration.telnetPort); startUpMessage("Generating map data."); mapsManager.generateallMaps(); startUpMessage("Creeper MUD engine started"); creeperServer.run(gameManager); startUpMessage("Creeper MUD engine online"); if (creeperConfiguration.isIrcEnabled) { startUpMessage("Starting irc server."); configureIrc(gameManager); } }
Difference between drawing with QPainter and (QGraphicsView + QGraphicsScene)
总结
以上是小编为你收集整理的Difference between drawing with QPainter and (QGraphicsView + QGraphicsScene)全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
今天关于重拾VB6和25:Using Graphics Methods的讲解已经结束,谢谢您的阅读,如果想了解更多关于com.badlogic.gdx.graphics.OrthographicCamera的实例源码、com.codahale.metrics.graphite.Graphite的实例源码、com.codahale.metrics.graphite.PickledGraphite的实例源码、Difference between drawing with QPainter and (QGraphicsView + QGraphicsScene)的相关知识,请在本站搜索。
本文标签: