开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 0

PureBasic/SpiderBasicPreference

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (1)
master
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
项目仓库所选许可证以仓库主分支所使用许可证为准
master
分支 (1)
master
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (1)
master
spiderbasic_objects.html 6.37 KB
一键复制 编辑 原始数据 按行查看 历史
麦壳饼 提交于 2016年07月26日 10:47 +08:00 . chuci tijiao
<html><head><title>SpiderBasic objects</title></head>
<body bgcolor="#FFFFFF" link="#207BC3" vlink="#003B83" alink="#003B83">
<font face="Arial" size="2"><p align="center"><b><font size="5">SpiderBasic objects</font></b></p>
<p><b>Introduction</b></p><blockquote>
The purpose of this section is to describe the behavior, creation, and handling of
objects in SpiderBasic. For the demonstration, we will use the <a href="../image/index.html">Image</a> object, but the
same logic applies to all other SpiderBasic objects. When creating an Image object, we
can do it in two ways: indexed and dynamic.
</blockquote>
<p><b>I. Indexed numbering</b></p><blockquote>
The static, indexed way, allows you to reference an object by a predefined
numeric value. The first available index number is 0 and subsequent indexes
are allocated sequentially. This means that if you use the number 0 and then
the number 1000, 1001 indexes will be allocated and 999 (from 1 to 999) will
be unused, which is not an efficient way to use indexed objects. If you need a
more flexible method, use the dynamic way of allocating objects, as described
in section II. The indexed way offers several advantages:
<blockquote>
<p><b></b></p><blockquote>
- Easier handling, since no <a href="variables.html">variables</a> or <a href="dim.html">arrays</a> are required. <br>
- 'Group' processing, without the need to use an intermediate array. <br>
- Use the object in <a href="procedures.html">procedures</a> without declaring anything in <a href="global.html">global</a> (if using a <a href="general_rules.html">constant</a> or a number). <br>
- An object that is associated with an index is automatically freed when reusing that index.
</blockquote>
</blockquote>
The maximum index number is limited to an upper bound, depending of the object
type (usually from 5000 to 60000). <a href="enumerations.html">Enumerations</a> are strongly recommended if
you plan to use sequential constants to identify your objects (which is also
recommended).
<p><b>Example</b></p><blockquote>
<pre><font face="Courier New, Courier, mono"size="2"><font color="#207BC3"> CreateImage</font>(0, 640, 480) <font color="#207BC3">; Create an image, the n°0</font>
<font color="#207BC3"> ResizeImage</font>(0, 320, 240) <font color="#207BC3">; Resize the n°0 image</font>
</font></pre>
</blockquote><p><b>Example</b></p><blockquote>
<pre><font face="Courier New, Courier, mono"size="2"><font color="#207BC3"> CreateImage</font>(2, 640, 480) <font color="#207BC3">; Create an image, the n°2</font>
<font color="#207BC3"> ResizeImage</font>(2, 320, 240) <font color="#207BC3">; Resize the n°2 image</font>
<font color="#207BC3"> CreateImage</font>(2, 800, 800) <font color="#207BC3">; Create a new image in the n°2 index, the old one is automatically free'ed</font>
</font></pre>
</blockquote><p><b>Example</b></p><blockquote>
<pre><font face="Courier New, Courier, mono"size="2"> <b><font color="#207BC3">For</font></b> k = 0 <b><font color="#207BC3">To</font></b> 9
<font color="#207BC3"> CreateImage</font>(k, 640, 480) <font color="#207BC3">; Create 10 different images, numbered from 0 to 9</font>
<font color="#207BC3"> ResizeImage</font>(k, 320, 240) <font color="#207BC3">; Create a new image in the n°2 index, the old one is automatically free'ed</font>
<b><font color="#207BC3">Next</font></b>
</font></pre>
</blockquote><p><b>Example</b></p><blockquote>
<pre><font face="Courier New, Courier, mono"size="2"> <font color="#924B72">#ImageBackground</font> = 0
<font color="#924B72">#ImageButton</font> = 1
<font color="#207BC3"> CreateImage</font>(<font color="#924B72">#ImageBackground</font>, 640, 480) <font color="#207BC3">; Create an image (n°0)</font>
<font color="#207BC3"> ResizeImage</font>(<font color="#924B72">#ImageBackground</font>, 320, 240) <font color="#207BC3">; Resize the background image</font>
<font color="#207BC3"> CreateImage</font>(<font color="#924B72">#ImageButton</font> , 800, 800) <font color="#207BC3">; Create an image (n°1)</font>
</font></pre>
</blockquote>
<p><b>II. Dynamic numbering</b></p><blockquote>
Sometimes, indexed numbering isn't very handy to handle dynamic situations where we need
to deal with an unknown number of objects. SpiderBasic provides an easy and complementary way
to create objects in a dynamic manner. Both methods (indexed and dynamic) can be used together
at the same time without any conflict. To create a dynamic object, you just have to specify
the <font color="#924B72">#PB_Any</font> constant instead of the indexed number, and the dynamic number will be returned as
result of the function. Then just use this number with the other object functions in the place
where you would use an indexed number (except to create a new object). This way of object handling can be very useful when used
in combination with a <a href="../list/index.html">list</a>, which is also a dynamic way of storage.
<blockquote>
</blockquote><p><b>Example</b></p><blockquote>
<pre><font face="Courier New, Courier, mono"size="2"> DynamicImage1 =<font color="#207BC3"> CreateImage</font>(<font color="#924B72">#PB_Any</font>, 640, 480) <font color="#207BC3">; Create a dynamic image</font>
<font color="#207BC3"> ResizeImage</font>(DynamicImage1, 320, 240) <font color="#207BC3">; Resize the DynamicImage1</font>
</font></pre>
</blockquote>
</blockquote>
<p><b>Overview of the different SpiderBasic objects</b></p><blockquote>
Different SpiderBasic objects (windows, gadgets, sprites, etc.) can use the same range of object numbers
again. So the following objects can be enumerated each one starting at 0 (or other value) and SpiderBasic
differs them by their type:
<blockquote>
- <a href="../font/index.html">Font</a> <br>
- <a href="../gadget/index.html">Gadget</a> <br>
- <a href="../json/index.html">JSON</a> <br>
- <a href="../image/index.html">Image</a> <br>
- <a href="../menu/index.html">Menu</a> (not <a href="../menu/menuitem.html">MenuItem()</a>, as this is no object) <br>
- <a href="../regularexpression/index.html">RegularExpression</a> <br>
- <a href="../sound/index.html">Sound</a> <br>
- <a href="../sprite/index.html">Sprite</a> <br>
- <a href="../toolbar/index.html">ToolBar</a> <br>
- <a href="../window/index.html">Window</a> <br>
- <a href="../xml/index.html">XML</a> <br>
</blockquote>
</body></html>
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/PureBasic/SpiderBasicPreference.git
git@gitee.com:PureBasic/SpiderBasicPreference.git
PureBasic
SpiderBasicPreference
SpiderBasicPreference
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /