Examples 范例
Tetra has a fairly large suite of examples - to try them out, clone the repository and run:
Tetra 项目包含许多的示例 - 可以克隆下来直接试用:
cargo run --example example_name
You can also click on the name of the example below to view the source code.
可以点击下面示例名称,直接查看源代码。
Name | Category | Description |
---|---|---|
名称 | 类别 | 说明 |
hello_world |
Basic | Opens a window and clears it with a solid color. |
hello_world |
基础 | 一个纯色的Hello World 窗口 |
texture |
Graphics | Loads and displays a texture. |
texture |
图形 | 显示纹理的窗口 |
animation |
Graphics | Displays an animation, made up of regions from a texture. |
animation |
图形 | 纹理组成的动画窗口 |
text |
Graphics | Displays text using a TTF font. |
text |
图形 | 示范采用TTF字体显示文本的窗口 |
nineslice |
Graphics | Slices a texture into nine segments to display a dialog box. |
nineslice |
图形 | 示范九宫格对话框 |
scaling |
Graphics | Demonstrates the different screen scaling algorithms. |
scaling |
图形 | 示范演示屏幕缩放算法 |
shaders |
Graphics | Uses a custom shader to render a texture. |
shaders |
图形 | 使用自定义纹理渲染 |
canvas |
Graphics | |
canvas |
图形 | 示范使用自定义纹理渲染后的效果 |
camera |
Graphics | Demonstrates how to use a camera to transform the scene. |
camera |
图形 | 演示如何转换场景。 |
interpolation |
Graphics | Demonstrates how to interpolate between updates. |
interpolation |
图形 | 演示如何添加部件需要看代码 没太明白 |
audio |
Audio | Plays back an audio file. |
audio |
音频 | 播放音频 |
keyboard |
Input | Moves a texture around based on keyboard input. |
keyboard |
图形 | 演示用键盘控制移动 |
animation_controller |
Input | Moves a sprite around, with the animation changing based on keyboard input. |
animation_controller |
输入 | 演示键盘控制移动目标 |
mouse |
Input | Moves a texture around based on mouse input. |
mouse |
输入 | 演示鼠标控制移动目标 |
gamepad |
Input | Displays the input from a connected gamepad. |
gamepad |
输入 | 演示用游戏杆控制 |
text_input |
Input | Displays text as it is typed in by the player. |
text_input |
输入 | 演示文本输入 |
file_drop |
Input | Loads a file that the user drags and drops into the window. |
file_drop |
输入 | 加载用户拖入窗口的文件。 |
events |
Input | Shows what events can be fired by the engine. |
events |
输入 | 显示触发的事件。 |
bunnymark |
Benchmark | Benchmarks rendering performance by rendering lots of bunnies. |
bunnymark |
测试 | 演示渲染性能。 |
tetras |
Game | A full example game (which is entirely legally distinct from a certain other block-based puzzle game cough). |
tetras |
游戏 | 一个完整的示例游戏 |
LICENSE
Copyright 2020 Joe Clay
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
评论区
写评论还没有评论