如何在 Java (Swing/SWT/AWT) 中创建 C64 样式加载屏幕?
我正在考虑做一个 Commodore 64 风格的加载屏幕(交替的条改变颜色并增大/缩小尺寸),想知道是否有人尝试过这个或知道我可以查看的任何代码。我今天要自己开始,但最好有一些东西可以与之比较:)
到目前为止,我猜你将屏幕尺寸分开并为条形高度设置一个常量(比如 12)例如,水平条),然后您在常量和常量之间选择一个随机数 - 5 或其他数字,然后刷新屏幕。看着它很难说,但我有兴趣复制它。
I was thinking of doing a commodore 64 style loading screen (with the alternating bars that change colour and grow/shrink in size) and was wondering if anyone has tried this or knows of any code I could look at. I'm gonna make a start on it myself today, but it would be good to have something to compare it against :)
So far, I'm guessing you divide the screen size up and set a constant for the bar height (say 12 horizontal bars for example) and you pick a random number between the constant and constant - 5 or whatever and refresh the screen. It's hard to tell looking at it, but it's something I'd be interested in reproducing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将重写
paintComponent()
来绘制水平条。要平铺叠加层,您可以查看这个示例,它使用getSubimage()
来切片图像并javax.swing.Timer
来调节动画的速度。附录:另请参阅这个执行水平切片的示例。
I'd override
paintComponent()
to draw the horizontal bars. To tile the overlay, you might look at this example that usesgetSubimage()
to slice the image andjavax.swing.Timer
to pace the animation.Addendum: See also this example that does horizontal slices.