SDL을 사용하여 C++로 Yahtzee 형 (득점과 함께 주사위 게임)을 만들고 있습니다. 그것은 내 스스로 개발하는 첫 번째 SDL 프로젝트입니다.잠시 후에 SDL C++ TTF가 무작위로 사라집니다 (다시 돌아 오지 않습니다)
이 문제는이라고 할 수 있습니다. 게임을 시작하면 텍스트가 잘 렌더링됩니다. 점수를 올리고 경기를 계속할 수 있습니다. 그러나, 내가 몇 분 동안 기다리더라도 (여전히 연주 중이 든 아니든) 텍스트는 결국 렌더링이 중단됩니다. 게임을 계속할 수는 있지만 텍스트가 표시되지 않고 이전에 표시된 텍스트가 더 이상 표시되지 않습니다.
나는이 문제에 완전히 좌절하고 있습니다. 지금까지는 지금까지 없었던 경기가 있기 때문에 지금까지 아무 것도 알려지지 않았습니다.
참고 : 내가 발견 한 한 가지는 소프트웨어 및 하드웨어 렌더링입니다. 왜 그런지 모르겠지만 대신 하드웨어로 렌더링하려했는데 문제가 해결되지 않았습니다.
또 다른 참고 사항 : 코드의 텍스트 렌더링 부분은 for 루프에 있습니다.
내가 길을 잃었습니다. 누구든지 도와 줄 수 있습니까? 나는 코드를 게시 할 것이지만 길고, 어리 석다. 나는 그것이 문제라고 생각하지 않는다.
int GUI(State& GameState)
{
apply_surface(0, 0, background, screen); //background
apply_surface(SCORE_X, SCORE_Y, scoreImage, screen); //score card
apply_surface(KEPT_TRAY_X, KEPT_TRAY_Y, keptTray, screen); //kept tray
apply_surface(TEXT_BOX_X, TEXT_BOX_Y, textBox, screen); //text box
//Blatantly handles only the next event on the queue per frame
if(SDL_PollEvent(&event))
eventHandler(GameState);
//place button
if(GameState.placeButtonClicked)
{
apply_surface(GameState.buttonV[GameState.placeButtonClicked].x, GameState.buttonV[GameState.placeButtonClicked].y, clickedButton, screen);
}
//dice[1]
apply_surface(*GameState.diceV[1].pointX, *GameState.diceV[1].pointY, *GameState.diceV[1].surfaceValue, screen);
//dice[2]
apply_surface(*GameState.diceV[2].pointX, *GameState.diceV[2].pointY, *GameState.diceV[2].surfaceValue, screen);
//dice[3]
apply_surface(*GameState.diceV[3].pointX, *GameState.diceV[3].pointY, *GameState.diceV[3].surfaceValue, screen);
//dice[4]
apply_surface(*GameState.diceV[4].pointX, *GameState.diceV[4].pointY, *GameState.diceV[4].surfaceValue, screen);
//dice[5]
apply_surface(*GameState.diceV[5].pointX, *GameState.diceV[5].pointY, *GameState.diceV[5].surfaceValue, screen);
//rollButton
if(GameState.navV[1].clicked)
{
apply_surface(GameState.navV[1].x, GameState.navV[1].y, rollButtonClicked, screen);
}
else
{
apply_surface(GameState.navV[1].x, GameState.navV[1].y, rollButton, screen);
}
//endTurnButton
if(GameState.navV[2].clicked)
{
apply_surface(GameState.navV[2].x, GameState.navV[2].y, endTurnButtonClicked, screen);
}
else
{
apply_surface(GameState.navV[2].x, GameState.navV[2].y, endTurnButton, screen);
}
//displaying the clickedButton if a score is clicked
if(GameState.placeButtonClicked != 0)
{
apply_surface(GameState.buttonV[GameState.placeButtonClicked].x, GameState.buttonV[GameState.placeButtonClicked].y, clickedButton, screen);
}
//displaying the scores for each "button" (each score segment)
for(int i = 1; i <= (GameState.buttonV.size() - 1); i++)
{
if(GameState.buttonV[i].value >= 0)
{
message = TTF_RenderText_Solid(scoreFont, GameState.buttonV[i].valueString, scoreFontColor);
apply_surface(GameState.buttonV[i].x + 10, GameState.buttonV[i].y + 2, message, screen);
}
}
if(SDL_Flip(screen) == -1)
{
return 1;
}
decGUICounters(GameState);
return 0;
}
그것은 당신이 답을 발견 좋아요! 그러나 질문의 일부로 대답을 쓰는 대신 대답을 * 답으로 쓰십시오. 자신의 질문에 대답하는 것은 확실히 괜찮습니다! –
아, 그래. 팁을 주셔서 감사합니다 –
@Intrusive_Logic 또한 나중에 답변을 수락하는 것을 잊지 마십시오;) –