[英]Black background appears on the last scene
I have a problem, once the hot air balloon reaches the ground, a black background appears. 我有一个问题,一旦热气球降落到地面,就会出现黑色背景。
// a switch case based on state with appropriate calls
switch (state) {
// scene 1
case 1:
drawBackground1(); // the first background to appear
drawSlogan1(); // display the first slogan
break;
// scene 2
case 2:
drawBackground2(); // the second background to appear
drawSlogan2(); // display the second slogan
break;
// scene 3
case 3:
drawBackground1(); // the third background to appear
drawSlogan3(); // display the last slogan
break;
}
I am showing this code here is because this is the only code I have changed, that made the black background appear. 我在这里显示此代码是因为这是我更改的唯一代码,使黑色背景出现。
When the balloon reaches the final position, then state
is 0. You have to draw the background if state == 0
, too: 当零件序号到达最终位置时,
state
为0。如果state == 0
,也必须绘制背景:
switch (state) {
case 0:
drawBackground1(); // the third background to appear
break;
case 1:
drawBackground1(); // the first background to appear
drawSlogan1(); // display the first slogan
break;
case 2:
drawBackground2(); // the second background to appear
drawSlogan2(); // display the second slogan
break;
case 3:
drawBackground1(); // the third background to appear
drawSlogan3(); // display the last slogan
break;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.