SqueakSource 添加资源文件

发布于 2024-09-11 06:21:49 字数 783 浏览 2 评论 0原文

我是吱吱声/吱吱声源的新手,我正在编写一个小游戏作为学习练习。我有一些图形用于我的一些精灵(主要是 png),但我不知道如何将它们添加到我的吱吱源存储库中。

有没有办法将这些文件添加到我的项目中,这样我的团队就不必继续通过电子邮件互相发送图像。

谢谢

=== 最终解决方案 ===

根据卢卡斯的建议,我最终创建了一个仅包含生成图像的方法的类。不幸的是,实际上编写这些方法有点痛苦(特别是对于大图像)。

因此,我在该类上创建了一个辅助方法,允许您动态添加图像消息。

addIcon: selector fromFile: fn
    | image stream |
    image := ColorForm fromFileNamed: fn.
    stream := WriteStream with: String new.
    stream nextPutAll: ((selector asString) , (String cr), '^').
    image storeOn: stream.
    (IconsHolder class) compile: (stream contents) classified: 'auto-generated'.
    ^self. 

因此,如果我想更新或添加图像,我可以这样做:

IconsHolder addImage: #image... fromFile:'image.jpg'

它会在 IconsHolder 中生成一条新消息,该消息会从代码生成图像。

I'm new to squeak/squeak source and i am writing a small game as a learning exercise. I have a few graphics that i am using for some of my sprites (mostly pngs) but i cannot figure out how to add them to my squeak source repository.

Is there a way to do add these files to my project so my team doesn't have to keep emailing images to each other.

Thanks

=== Final solution ===

Based on Lukas' advice i ended up creating a class that only hold methods which produce images. unfortunately actually writing these methods was kind of a pain (esp for large images).

So i created a helper method on the class that allows you to add an image message dynamically.

addIcon: selector fromFile: fn
    | image stream |
    image := ColorForm fromFileNamed: fn.
    stream := WriteStream with: String new.
    stream nextPutAll: ((selector asString) , (String cr), '^').
    image storeOn: stream.
    (IconsHolder class) compile: (stream contents) classified: 'auto-generated'.
    ^self. 

So then if i wanted to update or add an image i could just do:

IconsHolder addImage: #image... fromFile:'image.jpg'

And it would generate a new message in IconsHolder that would generate the image from code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏佲洛 2024-09-18 06:21:49

Monticello不提供对版本外部资源的支持,这与SqueakSource作为托管系统无关。大多数开发人员将他们的资源(小图像、脚本、资源等)放入方法中,请参阅 OmniBrowser 中的类 OBMenuIcons 或 Seaside 中的 WAFileLibrary 来获取突出的示例。

Monticello does not provide support to version external resources, this has nothing to do with SqueakSource as the hosting system. Most developers put their resources (small images, scripts, resources, ...) into methods, see the classes OBMenuIcons in OmniBrowser or WAFileLibrary in Seaside for prominent examples.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文