Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #41 from Ethosa/nightly
Browse files Browse the repository at this point in the history
Nightly v0.4.2
  • Loading branch information
Ethosa authored Nov 21, 2021
2 parents 4ef5a91 + 89e2254 commit 7abb307
Show file tree
Hide file tree
Showing 83 changed files with 1,735 additions and 836 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
needs: before
env:
nim_version: '1.2.0'
nim_version: '1.4.8'
steps:
- uses: actions/checkout@v1
- name: Cache nimble
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
#- windows-latest
#- macOS-latest
nim_version:
- '1.2.0'
- '1.4.8'
- 'stable'
needs: before
env:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ nimcache/
nimblecache/
htmldocs/

# ignore akane
templates/

*.exe
*.log
*.db
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Nim GUI/2D framework based on OpenGL and SDL2.
[![channel icon](https://patrolavia.github.io/telegram-badge/follow.png)](https://t.me/nim1love)
[![channel icon](https://patrolavia.github.io/telegram-badge/chat.png)](https://t.me/nodesnim)

<h4>Stable version - 0.4.1</h4>
<h4>Stable version - 0.4.2</h4>
</div>

## Install
Expand All @@ -38,8 +38,11 @@ The Nim GUI/2D framework based on OpenGL and SDL2.

## Features
- Godot-like node system.
- Build nodes with YML-like syntax.
- Runtime scene loader.
- Powerful node build system using YML-like syntax.
- Stylesheets (CSS-like).
- Android-like drawables.
- Customizable GUI themes.
- Simple usage
```nim
import nodesnim
Expand All @@ -50,10 +53,11 @@ The Nim GUI/2D framework based on OpenGL and SDL2.
build:
- Scene scene:
- Label hello:
call setSizeAnchor(1, 1)
call setTextAlign(0.5, 0.5, 0.5, 0.5)
call setText("Hello, world!")
call setBackgroundColor(Color(31, 45, 62))
call:
setSizeAnchor(1, 1)
setTextAlign(0.5, 0.5, 0.5, 0.5)
setText("Hello, world!")
setBackgroundColor(Color(31, 45, 62))
addMainScene(scene)
windowLaunch()
Expand Down Expand Up @@ -81,11 +85,11 @@ This section contains links to documentation for all nodes.
|[SceneBuilder][]| |[TextureButton][] | | | |
|[StyleSheet][] | |[TextureProgressBar][]| | | |
|[TileSet][] | |[Counter][] | | | |
| | |[Switch][] | | | |
| | |[SubWindow][] | | | |
| | |[CheckBox][] | | | |
|[ChartData][] | |[Switch][] | | | |
|[Scripts][] | |[SubWindow][] | | | |
|[Scene loader][]| |[CheckBox][] | | | |
| | |[ToolTip][] | | | |

| | |[Chart][] | | | |


## Debug mode
Expand All @@ -103,28 +107,28 @@ Also use [`niminst`](https://github.com/nim-lang/niminst) tool for generate an i
## Screenshots
<div align="center">
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/hello_world">
<img src="https://user-images.githubusercontent.com/49402667/138453889-ea538f86-2fc4-4947-843f-ca100561b05d.png" width="380" height="220" alt="Hello world example">
<img src="https://user-images.githubusercontent.com/49402667/138453889-ea538f86-2fc4-4947-843f-ca100561b05d.png" height="220" alt="Hello world example">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/calculator">
<img src="https://user-images.githubusercontent.com/49402667/138453360-6b701b6a-8695-4ace-bf9f-25d5ae8c68c2.png" width="380" height="220" alt="Calculator example">
<img src="https://user-images.githubusercontent.com/49402667/138453360-6b701b6a-8695-4ace-bf9f-25d5ae8c68c2.png" height="220" alt="Calculator example">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/snake">
<img src="https://user-images.githubusercontent.com/49402667/138456143-292a5b73-7a52-4d29-9769-1c8101db9f85.png" width="380" height="220" alt="Snake game example">
<img src="https://user-images.githubusercontent.com/49402667/138456143-292a5b73-7a52-4d29-9769-1c8101db9f85.png" height="220" alt="Snake game example">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/screensaver">
<img src="https://user-images.githubusercontent.com/49402667/138455275-3df817ae-275d-4164-afc1-92fbdbbb4a6c.png" width="380" height="220" alt="Screensaver example">
<img src="https://user-images.githubusercontent.com/49402667/138455275-3df817ae-275d-4164-afc1-92fbdbbb4a6c.png" height="220" alt="Screensaver example">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/novel">
<img src="https://user-images.githubusercontent.com/49402667/138454518-376b40ba-44d0-458a-9b2b-48a5ea53ff64.png" width="380" height="220" alt="Novel game example">
<img src="https://user-images.githubusercontent.com/49402667/138454518-376b40ba-44d0-458a-9b2b-48a5ea53ff64.png" height="220" alt="Novel game example">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/roguelike">
<img src="https://user-images.githubusercontent.com/49402667/138454722-e2b2766d-29cd-412a-92d2-29393d442775.png" width="380" height="220" alt="Roguelike game example">
<img src="https://user-images.githubusercontent.com/49402667/138454722-e2b2766d-29cd-412a-92d2-29393d442775.png" height="200" alt="Roguelike game example">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/sample_messenger">
<img src="https://user-images.githubusercontent.com/49402667/138455176-d38ea0b3-274d-41c6-b877-2a9be39a7b90.png" width="240" height="480" alt="sample messenger">
<img src="https://user-images.githubusercontent.com/49402667/138455176-d38ea0b3-274d-41c6-b877-2a9be39a7b90.png" height="460" alt="sample messenger">
</a>
<a href="https://github.com/Ethosa/nodesnim/tree/nightly/examples/calculator">
<img src="https://user-images.githubusercontent.com/49402667/138453719-0b4d50a9-b4a3-40c5-b017-1e0e0dd4892b.png" width="360" height="480" alt="Material Calculator example">
<img src="https://user-images.githubusercontent.com/49402667/138453719-0b4d50a9-b4a3-40c5-b017-1e0e0dd4892b.png" height="460" alt="Material Calculator example">
</a>
</div>

Expand Down Expand Up @@ -158,7 +162,9 @@ Also use [`niminst`](https://github.com/nim-lang/niminst) tool for generate an i
[Font]:https://ethosa.github.io/nodesnim/nodesnim/core/font.html
[StyleSheet]:https://ethosa.github.io/nodesnim/nodesnim/core/stylesheet.html
[TileSet]:https://ethosa.github.io/nodesnim/nodesnim/core/tileset.html
[Scripts]:https://ethosa.github.io/nodesnim/nodesnim/core/scripts.html
[Scripts]:https://ethosa.github.io/nodesnim/nodesnim/runtime/scripts.html
[Scene loader]:https://ethosa.github.io/nodesnim/nodesnim/runtime/scene_loader.html
[ChartData]:https://ethosa.github.io/nodesnim/nodesnim/core/chartdata.html

[Node]:https://ethosa.github.io/nodesnim/nodesnim/nodes/node.html
[Canvas]:https://ethosa.github.io/nodesnim/nodesnim/nodes/canvas.html
Expand Down Expand Up @@ -189,6 +195,7 @@ Also use [`niminst`](https://github.com/nim-lang/niminst) tool for generate an i
[SubWindow]:https://ethosa.github.io/nodesnim/nodesnim/nodescontrol/subwindow.html
[CheckBox]:https://ethosa.github.io/nodesnim/nodesnim/nodescontrol/checkbox.html
[ToolTip]:https://ethosa.github.io/nodesnim/nodesnim/nodescontrol/tooltip.html
[Chart]:https://ethosa.github.io/nodesnim/nodesnim/nodescontrol/chart.html

[Node2D]:https://ethosa.github.io/nodesnim/nodesnim/nodes2d/node2d.html
[Sprite]:https://ethosa.github.io/nodesnim/nodesnim/nodes2d/sprite.html
Expand Down
14 changes: 14 additions & 0 deletions examples/builder_features/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ build:
- Node3D node2(is_ready: true, call hide())
- Control node3(is_ready: true, call hide())

# If you need a lot of repeating nodes ...
# maybe a cycle will help you?
for i in 0..10:
- Node nodeNumber_i: # Translates to nodeNumber{i}
call hide()

- Label hello_world:
call:
setText("Hello world!")
setAnchor(1, 0, 1, 0)
setTextColor(Color("#cefc"))

for child in main.getChildIter():
echo child.name

addMainScene(main)
windowLaunch()
49 changes: 27 additions & 22 deletions examples/calculator/material_ui.nim
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ proc calculate(tree: TokenTree): float =
result = parseFloat(t[0].token_value)

Window("material ui calculator", ((64+32)*4)+16, 480)
env.setBackgroundColor(Color("#FAFAFA"))
env.background_color = Color("#FAFAFA")


var
Expand All @@ -73,13 +73,15 @@ var

build:
- Button number_button:
call setStyle(style({color: "#EEEEEE"}))
call resize(64+32, 64)
call setTextFont(loadFont(standard_font_path, 24))
call:
setStyle(style({color: "#EEEEEE"}))
resize(64+32, 64)
setTextFont(loadFont(standard_font_path, 24))
- Button operator_button:
call setStyle(style({color: "#F5F5F5"}))
call resize(64+32, 51.2f)
call setTextFont(loadFont(standard_font_path, 22))
call:
setStyle(style({color: "#F5F5F5"}))
resize(64+32, 51.2f)
setTextFont(loadFont(standard_font_path, 22))

number_button.normal_background.setStyle(style({background-color: "#424242"}))
number_button.hover_background.setStyle(style({background-color: "#616161"}))
Expand All @@ -101,28 +103,31 @@ build:
- Scene main:
- HBox hbox:
separator: 0
call setPadding(8, 8, 8, 8)
call move(0, 200)
call:
setPadding(8, 8, 8, 8)
move(0, 200)
- GridBox numbers:
separator: 0
call setRow(3)
- Vbox operators:
separator: 0
- Control result_back:
call resize(((64+32)*4), 200)
call move(8, 8)
call setStyle(style({
background-color: "#4DD0E1",
shadow: true,
shadow-offset: "0 8"
}))
call:
resize(((64+32)*4), 200)
move(8, 8)
setStyle(style({
background-color: "#4DD0E1",
shadow: true,
shadow-offset: "0 8"
}))
- Label text:
call setTextFont(loadFont(standard_font_path, 32))
call setTextColor(Color("#fff"))
call setTextAlign(1, 1, 1, 1)
call setAnchor(1, 1, 1, 1)
call setSizeAnchor(1, 0.5)
call setPadding(16, 16, 16, 16)
call:
setTextFont(loadFont(standard_font_path, 32))
setTextColor(Color("#fff"))
setTextAlign(1, 1, 1, 1)
setAnchor(1, 1, 1, 1)
setSizeAnchor(1, 0.5)
setPadding(16, 16, 16, 16)


for i in 0..11:
Expand Down
14 changes: 7 additions & 7 deletions examples/hello_world/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Window("Hello, world!")


build:
- Scene scene:
name: "Main"
- Scene main_scene:
- Label hello:
call setSizeAnchor(1, 1)
call setTextAlign(0.5, 0.5, 0.5, 0.5)
call setText("Hello, world!")
call setBackgroundColor(Color(31, 45, 62))
call:
setSizeAnchor(1, 1)
setTextAlign(0.5, 0.5, 0.5, 0.5)
setText("Hello, world!")
setBackgroundColor(Color(31, 45, 62))

addMainScene(scene)
addMainScene(main_scene)
windowLaunch()
62 changes: 31 additions & 31 deletions examples/novel/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,55 @@ var

build:
- Scene main:
call rename("Main")
- Button button:
call setText("New game")
call resize(128, 32)
call setAnchor(0.5, 0.5, 0.5, 0.5)
call:
setText("New game")
resize(128, 32)
setAnchor(0.5, 0.5, 0.5, 0.5)
@onTouch(x, y):
changeScene("game_scene")

- Scene game_scene:
call rename("Game")
- TextureRect background_image:
call setSizeAnchor(1, 1)
call setTexture(night)
call setTextureAnchor(0.5, 0.5, 0.5, 0.5)
texture_mode: TEXTURE_KEEP_ASPECT_RATIO
call:
setSizeAnchor(1, 1)
setTexture(night)
setTextureAnchor(0.5, 0.5, 0.5, 0.5)
- TextureRect charapter:
call setSizeAnchor(1, 1)
call setTexture(akiko_default)
call setTextureAnchor(0.5, 0.5, 0.5, 0.5)
texture_mode: TEXTURE_KEEP_ASPECT_RATIO
visibility: GONE
call:
setSizeAnchor(1, 1)
setTexture(akiko_default)
setTextureAnchor(0.5, 0.5, 0.5, 0.5)
- Label dialog_text:
call setSizeAnchor(0.8, 0.3)
call setAnchor(0.1, 0.6, 0, 0)
call setBackgroundColor(Color(0x0e131760))
call setPadding(8, 8, 8, 8)
call:
setSizeAnchor(0.8, 0.3)
setAnchor(0.1, 0.6, 0, 0)
setBackgroundColor(Color(0x0e131760))
setPadding(8, 8, 8, 8)
- Label name_charapter:
call resize(128, 32)
call setAnchor(0, 0, 0, 1)
call setBackgroundColor(Color(0x0e131760'u32))
call setStyle(style({
border-radius: "8 8 0 0"
}))
call setTextAlign(0.1, 0.5, 0.1, 0.5)
call:
resize(128, 32)
setAnchor(0, 0, 0, 1)
setBackgroundColor(Color(0x0e131760'u32))
setStyle(style({
border-radius: "8 8 0 0"
}))
setTextAlign(0.1, 0.5, 0.1, 0.5)
- ColorRect foreground_rect:
call setSizeAnchor(1, 1)
color: Color(0x0e1317ff)
- AnimationPlayer animation:
loop: false
call addState(foreground_rect.color.a.addr,
@[(tick: 0, value: 1.0), (tick: 100, value: 0.0)])
@onReady():
animation.play()


foreground_rect@on_ready(self):
animation.play()

foreground_rect@on_input(self, event):
foreground_rect@onInput(self, event):
if event.isInputEventMouseButton() and not event.pressed:
if stage < dialog.len():
name_charapter.setText(dialog[stage][0])
Expand All @@ -69,11 +74,6 @@ foreground_rect@on_input(self, event):
inc stage



button.on_touch =
proc(self: ButtonRef, x, y: float) =
changeScene("Game")

addMainScene(main)
addScene(game_scene)
windowLaunch()
21 changes: 14 additions & 7 deletions examples/readme.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# Examples

## [Hello world](https://github.com/Ethosa/nodesnim/blob/nightly/examples/hello_world)
![Hello world](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/1.png)

<img src="https://user-images.githubusercontent.com/49402667/138453889-ea538f86-2fc4-4947-843f-ca100561b05d.png" width="100%" alt="Hello world example">

## [Calculator](https://github.com/Ethosa/nodesnim/blob/nightly/examples/calculator)
![Calculator](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/2.png)

<img src="https://user-images.githubusercontent.com/49402667/138453360-6b701b6a-8695-4ace-bf9f-25d5ae8c68c2.png" width="50%" alt="Calculator example"><img src="https://user-images.githubusercontent.com/49402667/138453719-0b4d50a9-b4a3-40c5-b017-1e0e0dd4892b.png" width="50%" alt="Material Calculator example">

## [Snake game](https://github.com/Ethosa/nodesnim/blob/nightly/examples/snake)
![Snake game](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/3.png)

<img src="https://user-images.githubusercontent.com/49402667/138456143-292a5b73-7a52-4d29-9769-1c8101db9f85.png" width="100%" alt="Snake game example">

## [Screen saver](https://github.com/Ethosa/nodesnim/blob/nightly/examples/screensaver)
![Screen saver](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/4.png)

<img src="https://user-images.githubusercontent.com/49402667/138455275-3df817ae-275d-4164-afc1-92fbdbbb4a6c.png" width="100%" alt="Screensaver example">

## [Novel](https://github.com/Ethosa/nodesnim/blob/nightly/examples/novel)
![Novel](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/5.png)

<img src="https://user-images.githubusercontent.com/49402667/138454518-376b40ba-44d0-458a-9b2b-48a5ea53ff64.png" width="100%" alt="Novel game example">

## [Roguelike](https://github.com/Ethosa/nodesnim/blob/nightly/examples/roguelike)
![Roguelike](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/6.png)

<img src="https://user-images.githubusercontent.com/49402667/138454722-e2b2766d-29cd-412a-92d2-29393d442775.png" width="100%" alt="Roguelike game example">

## [Sample messenger](https://github.com/Ethosa/nodesnim/blob/nightly/examples/sample_messenger)
![Sample messenger](https://github.com/Ethosa/nodesnim/blob/nightly/screenshots/7.png)

<img src="https://user-images.githubusercontent.com/49402667/138455176-d38ea0b3-274d-41c6-b877-2a9be39a7b90.png" width="100%" alt="sample messenger">

## [Builder features](https://github.com/Ethosa/nodesnim/blob/nightly/examples/builder_features)
1 change: 1 addition & 0 deletions examples/roguelike/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build:

# Player
- KinematicBody2D player:
z_index: 1
call move(300, 120)
- Sprite player_sprite:
call setTexture(charapter)
Expand Down
Loading

0 comments on commit 7abb307

Please sign in to comment.