나는 아직도이 문제에 직면하고있다. 나는 내 머리가 날아가는 것처럼 느껴진다. 말하자면, 내가 만든 텍스쳐를 그리기위한 코드가 있습니다.libgdx 흐리게 2d 그래픽
public MainMenuScreen(TheSpring game) {
this.game = game;
//camera for interface
guiCam = new OrthographicCamera(1020, 640);
guiCam.position.set(1020/2, 640/2, 0);
//buttons
play = new Button(10, 120, 400, 300, AssetLoader.play);
highscores = new Button(460, 10, 82, 102, AssetLoader.highscores);
sound = new Button(10, 10, 72, 72, AssetLoader.soundEnabled);
sound.AddTexture(AssetLoader.soundDisabled);
if (!Settings.soundEnabled)
sound.SwitchTexture();
help = new Button(120, 160, 80, 15, "Help", Color.WHITE);
//enable buttons
play.Enable(true);
highscores.Enable(true);
sound.Enable(true);
help.Enable(true);
//touchpoint for unproject
touchpoint = new Vector3();
}`
재생 버튼으로 생성 된 텍스처도 400x300입니다. 문제는이 "app"을 실행하려고하면 텍스처가 흐려진다는 것입니다. Button이 제 클래스이고 그리기 메서드를 사용하고 있습니다.
public void Draw(SpriteBatch batcher) {
if (enabled){
if (text != null) {
AssetLoader.ComicFont.setColor(clr);
AssetLoader.ComicFont.setScale(ScaleWidth, ScaleHeight);
AssetLoader.ComicFont.draw(batcher, text, x, y + height);
}
if (texture != null) {
batcher.draw(texture, x, y, width, height);
}
}
}
그리고 그 결과가 이것이다 (내 그림 실력 나를 판단하지 마십시오, 유일한 테스트 버전)
예를 들어, 버튼의 오른쪽에, 또한 블랙이 있어야한다 라인 및 직선은 직선이어야합니다. 저를 도와주세요? :)
어쩌면이 답변이 질문과 관련이없는이 밖으로 시도하지만, . –
안녕하세요, 답장을 보내 주셔서 감사합니다. 기사를 읽었습니다. Spritebatch와 orthographicCamera를 사용하여 libgdx에서 무언가를 그리려는 모든 사람들이이 ninepatch 메서드를 사용하지 않고 있다고 생각합니다. 나는 그 비율 (예 : 텍스처 140x140)을 보유하고있는 텍스처를 그리려하고 있습니다.이 텍스처로 버튼 70x70을 갖고 싶습니다. 결과는 주 기사의 인쇄 화면과 동일합니다. –