2014-07-24 2 views
0

내 스프린트 (상자 자체이지만 색상이 다름)는 내 andengine 활동이로드 된 두 번째 블랙 박스로 표시됩니다. 보통이 문제는 텍스쳐 아틀라스가 충분히 크지 않기 때문에 이상합니다.하지만 아틀라스의 크기를 두 배로 늘리려고 시도했는데 작동하지 않았습니다. 그래서 여기에 관련 코드가 있습니다, 어떤 도움을 많이 주시면 감사하겠습니다!다시로드 할 때 스프린트가 아닌 검은 상자

게임을 처음로드 할 때 모든 것이 훌륭하고 완벽하지만 두 번째로는 스프라이트가 검은 색으로 보입니다.

스프라이트가 검은 색 상자로 나타나는 다른 질문이 있지만 처음에는 잘로드되지만 다른 질문에서는 발생하지 않으며 다른 질문에 대한 답변은 나에게 적합하지 않았습니다. (그들은했다, 아틀라스는 두 가지의 힘이 될 필요가 있고지도 책은 충분히 크지 않다)

public void loadGameResources(){ 

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); 

    gameTextureAtlas = new BuildableBitmapTextureAtlas(activity.getTextureManager(), 512, 512, TextureOptions.BILINEAR); 

    blackTile = BitmapTextureAtlasTextureRegionFactory.createFromAsset(gameTextureAtlas, activity, "blacktile.png"); 
    greyTile = BitmapTextureAtlasTextureRegionFactory.createFromAsset(gameTextureAtlas, activity, "greytile.png"); 
    redTile = BitmapTextureAtlasTextureRegionFactory.createFromAsset(gameTextureAtlas, activity, "redtile.png"); 
    greenTile = BitmapTextureAtlasTextureRegionFactory.createFromAsset(gameTextureAtlas, activity, "greentile.png"); 
    Log.d(gameTextureAtlas+"","didn'tignore"); 
    loadFont(); 

    try{ 
     Log.d("LOPOLL","arrived"); 
     gameTextureAtlas.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 1, 0)); 

     Log.d("boom","arrived"); 

     gameTextureAtlas.load(); 
     Log.d("gotHere","arrived"); 
    }catch(Exception e){ 
     Log.d("WrongPlace","arrived"); 
    } 

} 

(자원 언로드 방법)

public void unloadGameResources(){ 
    if(gameTextureAtlas !=null){ 
    gameTextureAtlas.unload(); 
    } 
    gameTextureAtlas = null; 

//  blackTile = null; 
//  greyTile = null; 
//  redTile = null; 
//  greenTile = null; 

    } 

나는 tiletextures에게 널을주는 부분을 주석 이유 가치는 어떤 이유로이 일을하는 것이 비록 액티비티를 재로드 할 때 텍스처 영역이 재 할당 될 때 텍스처 영역이 재 할당되는 것으로 생각했지만 액티비티를 다시 불러올 때 loadgameresources() 메서드를 호출했습니다.

+0

활동을 떠날 때 '설정 활동'을 입력하고 그대로두면 스프라이트가 상자가 아닙니다. 아마이 정보가 유용할까요? – user3287039

+0

얘들 아, 활동을 파기하지 않고 활동을 멈추게 할 뿐인데 어떻게하면 활동을 파괴 할 수 있을까? – user3287039

답변

0

System.exit (code)는 액티비티가 올바르게 종료되도록합니다. Dissapointed stack overflow는 이것을 대답 할 수 없었습니다!

관련 문제