Compare commits
31 Commits
19dec1ee05
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf07c9c47a | ||
|
|
ace0e2d706 | ||
|
|
8cb6892d30 | ||
|
|
de6facff03 | ||
|
|
2753aed573 | ||
|
|
0ff2be6564 | ||
|
|
11f5eb7fd1 | ||
|
|
285840b521 | ||
|
|
761b86585a | ||
|
|
528e38b428 | ||
|
|
a59192cf05 | ||
|
|
fa7e18e4d5 | ||
|
|
4ed4452fae | ||
|
|
b9ca8df59b | ||
|
|
8fa8bf392b | ||
|
|
9170524d33 | ||
|
|
cda395d6b9 | ||
|
|
d8da84cffc | ||
|
|
f6a13309f7 | ||
|
|
9c93179bf0 | ||
|
|
38b8bb0657 | ||
|
|
b147d92423 | ||
|
|
13f01d13f8 | ||
|
|
ebe03f42b6 | ||
|
|
a1c742c1cd | ||
|
|
3e0018d1cb | ||
|
|
1f5bc11ddd | ||
|
|
79db5bb8a0 | ||
|
|
bb1a24e7b3 | ||
|
|
04085c97f1 | ||
|
|
b52c78d056 |
@@ -54,6 +54,8 @@
|
|||||||
pkgs.probe-rs
|
pkgs.probe-rs
|
||||||
pkgs.probe-rs-tools
|
pkgs.probe-rs-tools
|
||||||
pkgs.bear
|
pkgs.bear
|
||||||
|
pkgs.chafa
|
||||||
|
pkgs.imagemagick
|
||||||
mbedTools
|
mbedTools
|
||||||
pyOcd
|
pyOcd
|
||||||
];
|
];
|
||||||
|
|||||||
8
semestralka1/.clangd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CompileFlags:
|
||||||
|
Add:
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/arm-none-eabi/include
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include-fixed
|
||||||
25
semestralka1/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
.build
|
||||||
|
.mbed
|
||||||
|
projectfiles
|
||||||
|
*.py*
|
||||||
|
|
||||||
|
# Local build directories
|
||||||
|
cmake_build/
|
||||||
|
BUILD/
|
||||||
|
mbed-os/
|
||||||
|
.mbed/
|
||||||
|
.mbedignore
|
||||||
|
*.elf
|
||||||
|
*.bin
|
||||||
|
*.hex
|
||||||
|
*.map
|
||||||
|
|
||||||
|
# IDE and temporary files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
__pycache__/
|
||||||
|
.cache/
|
||||||
|
|
||||||
|
compile_commands.json
|
||||||
42
semestralka1/CMakeLists.txt
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
|
||||||
|
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
||||||
|
set(APP_TARGET mbed-os-example-blinky)
|
||||||
|
|
||||||
|
include(${MBED_PATH}/tools/cmake/app.cmake)
|
||||||
|
|
||||||
|
project(${APP_TARGET})
|
||||||
|
|
||||||
|
add_subdirectory(${MBED_PATH})
|
||||||
|
|
||||||
|
add_executable(${APP_TARGET})
|
||||||
|
|
||||||
|
# Recursively collect all .cpp files under src/
|
||||||
|
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||||
|
|
||||||
|
target_sources(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
${SRC_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make includes of headers work
|
||||||
|
target_include_directories(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
mbed-os
|
||||||
|
)
|
||||||
|
|
||||||
|
mbed_set_post_build(${APP_TARGET})
|
||||||
|
|
||||||
|
option(VERBOSE_BUILD "Have a verbose build process")
|
||||||
|
if(VERBOSE_BUILD)
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
endif()
|
||||||
5
semestralka1/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Semestralka na VPS
|
||||||
|
|
||||||
|
Tato hra je najsamlepsejsia na celom svete.
|
||||||
|
Iba si treba matchnut baudrate a moze sa gamesit.
|
||||||
|
|
||||||
BIN
semestralka1/chafa/background/background.jpg
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
semestralka1/chafa/background/background_dark.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
19
semestralka1/chafa/background/background_dark_inverted.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
~`````````````````````````````````````````````````````````````````````````````````````"````````````````````````````````~```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````+````````````````````~````````````````````````````````~```````````````````````````````````````````````````````
|
||||||
|
...................................................................,.......................:..........................................'.........`..:.....................................................................................................+...................................:...........:..,................................................
|
||||||
|
..........................."............................................._................................+...........................................................................................................,..............................................`..............................................................!........................
|
||||||
|
.......`...............!..:..............................................`,...,,,'........_.....................''::.....:........................^......................,,...........................................':.......'........................,....,,,.......................+...,...'::'.............................^......................,,....
|
||||||
|
...`......................"...........`.....`...................._,....:,::::^.`::::::........'''``....`....y..^............-...........................................:'.....................,........".....................................:_......,,:::..`'`::::.........'''`..........+....+........,............................................,:`....
|
||||||
|
,,,,,,,,,,,`,,,,,,,^,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,`a',,,,,,',.+,,,''''`.........,,'?'!#R,,,,,,,,,,,,,y,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__,,,_',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y'`,,,,,'.,,,,,,.'''`........,,''^,s@^,,,,,,,,,,,,_;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,_,`,,,,,,
|
||||||
|
,,,,,,,,,,^,,,,,,','''':,,,,,,,,,,,,,,,,,,,,,,''',,,,,,,,,,+,,,,,,,,,:'!^'`,,``..'.'''`,,,,,,,yy_,_yaF,,.'`'',,,,,ym$###$@M@,,,,,;,,,,,,,,,,,,,,,,,,,,,''''':,y,,,7#@@~,,,,,,,,,,,,,,,,,~,,,,,,,::'''::,~,,,,,,,,,,,,,,,,,,,'''',,,,,,,,,,,,,,,,,,,::'~''`,```..``''',,,,,,,yy___ygR^,.,`'`,,,,,,wa###$@R@:,,,,,,,,,,,,,,,,,,,,,,,,,,'''''',,X,,~T@@R,,,,,,,,
|
||||||
|
@@@@@@@@@@@@@@$~`,'________~TF?5#@@@@@@@``4@@E,,,4@@@@@@@@@@@@@#MT~yg$^$P_____..,...:_________@@______;'...'.?@@@@@@@@@@@@@@@@@@@@@@@@@@@MR@@@@@@@@@@B,,,,,,,4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@P...________~TFFF#R@@@@@@F,`$@@,,,,@@RR@@@@@@@@@RPF~_g$Mb$______..,..,_________9@y______',....~$@@@@@@@@@@@@@@@@@@@@@@@@@@##R@@@@@@@@@@~,,,,,,~@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@yggy@@@@@@@@@@@@@@@@@@@@$$$@@@@@@@@@@@@@@@@@@@@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@@@@@~``.`,,,,,,,,:::`,g@R@BZa$TTTTF5PM@@@@^:`'`~T5#@@y_`,u@~$@$@@g_,F,,,,`@@@@'':^na$g@@@=_:@@.`,.4__,,,,,,,,,g@@K:,,,,,,g@@@@w....,,,,,,,,,$@@$g@F...,,^=#aa@$gg@@@@@@@@@@@@@@@@@F``.`,,,,,,,,,::`,:@@P@R5$T~TTFFPP5@@@$:'``~~7P@@y_``,$E4@W@$@y,4::,,`3@@@[`:,raagg@@Fk`@@L.,.`g_,,,,,,,,,,g@@~:,,,,,,g@@@$..
|
||||||
|
..,:''``a$gg@$@@ZF...:,,,,,,:`~T@@@@@@@@@@@@@A@@^``...:,,,,,`,,::,.,@@@@@@@@,`.`````@@@[',,,,,,,,,,`TR@@@@@@@$@@@`'''':,A@MP.,,,,,"~TT@,`3@@*g'.`4@':,,,,,,:EDT,,,,,,,_@@@@@$....:':':H$$g@$@@$@....,,,,,`:`~7R@@@@@@@@@@@@AR@@```..,',,,'``,,::,,d@0@@@@@y`.`````g@@@`',,,,,,,,,:79@$@@@@@@@@@'"``':,!$FP~:,,,,,~~7@y.~A@mg@'."@F::,,,,,,4ER~,,,,,,,g@@@@@..
|
||||||
|
..:`::':''~F@@@@@....:````:`:,``"FB@P~5@@@$~~3@@L....::``',:``,:::,`g@@@@@@@@.```.:7@@@F:`````````::,:`@Fy@@$@@@F.::`:::`$@@L`````````~%.`$F.B`..`B::::````4PF````````@@@@@@B...,:,,:::``TM@@@@$...:````:,`````7M$@F~@@@@~~"@@@.....:,`',:'`':::,,x@@@@@@@@,....`:@@@@:``````````:::,g@ya@@@@@@.,'`'::`4@@g,```,`````4.."@.$^...4~`::````_RP~```````g@@@@@@L.
|
||||||
|
.,,`,```,,``@@@@@,,.``````````,,4@~,,,"$@@$,,$@@m',..,,,``,,````,``g@@@@@@@@@,'`,..,"Z@F``````````````_a@@@@@@@@'.`,,````~@@F``,````,,,,,,4(``....`'```,,,g@~,,``````g@@@@@@@,,.,,,```,,,`4@@@@~,.,```````'`,,`B$,,,,$gZ$r,:@@@',...,,,``,````,``:@@@@$@@@@@.',...`~@@```````````````D$@@@@@@@E,``:`````@@R``,````,,,,,,`R'['.,..,````,,`@B,,``````g@@@@@@@L,
|
||||||
|
.',,,,,,,,,,4@@@E,,,,,,,,,,,,,,,,@,,,,,5@@@,,$@@@,,..,,,,,,,,,,,,,,@@@@@@@@@@@,,,..`,,@F,,,,,,,,,,,,,,@@@@@@@@@@,,',,,,,,,~,,,,,,,,,,,,,,,,L,..,,.':,,,,,y@~,,,,,,,,g@@@@@@@@,,.',,,,,,,,,,@@@@,,.:,,,,,,,,,,,,$F,,,,"@@@F,d@@@,,,..,,,,,,,,,,,,,d@@@@@@@@@@L,,,..,,4@,,,,,,,,,,,,,,g@@@@@@@@@F,,',,,,,,~^,,,,,,,,,,,,,,,T,...,..,,,,,,,$E,,,,,,,,y@@@@@@@@$,
|
||||||
19
semestralka1/chafa/background/background_inverted.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
......................````````````````````................................`````````````````````.....................................................................................................````````````````````...............................`````````````````````.................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
......................................................................................`..................................................'..........................................................................................................................`..................................................'.....................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
........................................................................................................................................................................................................................................................`....................................................................................................
|
||||||
|
........................'''`'''''``............'`'''''......._,_yr,..._,,........................................................................_,,,,................................................'''`'''''``............'`'''''......,_,yy+,..._,,........................................................................_,,,,.........................
|
||||||
|
..................```.......................................```~~``^?~"``::.,,,,,,,,,,,::::````'````..........``'''...`......,,,,,,,:,,:,,,,..,,:~````:,,,............,,,,......................```.......................................``"~~``^?~```:..,,,,,,,,,,,:::'`````````..........````'...`......,,,,,,::,,:,,,,..,,:~```',,,,............,,,,.....
|
||||||
|
.''``''`....`..............................................................._..`````.......................................```````'`````````''`````````..............``````````'''`''`....`..............................................................._..`````.......................................````'``'`````````''`````````..............`````````'
|
||||||
|
._.............................____yyyyyyyagggggggggggggggggggggga_..........~Th=ay__.............._____yyyyyyyyyyyyyyyyy___...+_.........................agyy_yyyyyyyyyyyyyyy_,.............................____yyyyyyyagggggggggggggggggggggga,..........~T=*wy_,.............,_____yyyyyyyyyyyyyyyy____..:._.........................agyy_yyyyyyyyyyyyyyy_
|
||||||
|
.@@$gyy_,.....__yyyyyaggg$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$$$$aaaaaa@@@$gga$$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$gZgyy_________yyyyyyyag$@@@@@@@@@@@@@@@@@@@@@@@@@$gyy_,.....__yyyyyagg$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$$$$aaaaaa@@@$gga$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$gZgyy_________yyyyyyyag$@@@@@@@@@@@@@@@@@@@@@@$
|
||||||
|
.@@@@@@@@@$g@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$
|
||||||
|
.@@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@@@@@@@$
|
||||||
|
.RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR4RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRF
|
||||||
4
semestralka1/chafa/chafa_commands.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
nix-shell -p imagemagick
|
||||||
|
identify background.jpg
|
||||||
|
chafa --symbols ascii --fill none --size=6912x793 background.jpg > out.txt
|
||||||
|
chafa --symbols ascii-block -c none --fill none --invert --size=349x40 background_dark.jpg > background_dark_inverted.txt
|
||||||
7
semestralka1/chafa/character/2out.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.....a@$..
|
||||||
|
.....7PF..
|
||||||
|
..yaM@@__y
|
||||||
|
..@.y@FFF~
|
||||||
|
..._$M@_..
|
||||||
|
yaa@~.`@y.
|
||||||
|
........@r
|
||||||
7
semestralka1/chafa/character/3out.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.g@$
|
||||||
|
.7PF
|
||||||
|
y@$.
|
||||||
|
0@F.
|
||||||
|
4@$.
|
||||||
|
y$@.
|
||||||
|
u@..
|
||||||
BIN
semestralka1/chafa/character/crawl/crawl1.jpg
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
semestralka1/chafa/character/crawl/crawl2.jpg
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
6
semestralka1/chafa/character/crawl/out_crawl1.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
........
|
||||||
|
........
|
||||||
|
...y4@W.
|
||||||
|
..a@a`..
|
||||||
|
..@@R@=.
|
||||||
|
.aa@s@..
|
||||||
6
semestralka1/chafa/character/crawl/out_crawl2.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
........
|
||||||
|
........
|
||||||
|
........
|
||||||
|
.____...
|
||||||
|
.@@@@yg,
|
||||||
|
.a@@PR@L
|
||||||
9
semestralka1/chafa/character/out.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
......_g@$w..
|
||||||
|
......4@@@F..
|
||||||
|
.....yyyy`...
|
||||||
|
...g@~@@@y_ys
|
||||||
|
..4F..@@FTF~.
|
||||||
|
.....g@@g,...
|
||||||
|
..._a@^.4@_..
|
||||||
|
4R@F~....7@y.
|
||||||
|
..........~@.
|
||||||
4
semestralka1/chafa/character/out_crawl1.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.._$@.
|
||||||
|
.$By`.
|
||||||
|
4@$@@a
|
||||||
|
aa@W@.
|
||||||
3
semestralka1/chafa/character/out_crawl2.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
a@@Bw_,
|
||||||
|
7@@Db@$
|
||||||
|
4@@PF#@
|
||||||
BIN
semestralka1/chafa/character/predloha.jpg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
semestralka1/chafa/character/predloha2.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
semestralka1/chafa/character/predloha2_scaled.xcf
Normal file
BIN
semestralka1/chafa/character/predloha_crawl1.jpg
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
semestralka1/chafa/character/predloha_crawl2.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
semestralka1/chafa/character/predloha_run_a.jpg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
semestralka1/chafa/character/predloha_run_b.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
6
semestralka1/chafa/character/run/out_run1.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
....g@w.
|
||||||
|
..._ZF~.
|
||||||
|
..@~@@y=
|
||||||
|
.".g@_`.
|
||||||
|
_ygF.Ry.
|
||||||
|
`~`...4L
|
||||||
6
semestralka1/chafa/character/run/out_run2.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
....g@w.
|
||||||
|
..._Z~~.
|
||||||
|
..aM@$y,
|
||||||
|
..~a@_`.
|
||||||
|
.yy@`$..
|
||||||
|
..`..@..
|
||||||
6
semestralka1/chafa/character/run/out_run3.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
...a@$..
|
||||||
|
..._Z~..
|
||||||
|
..a@@...
|
||||||
|
..R@@=..
|
||||||
|
.yy@@...
|
||||||
|
.``u@...
|
||||||
6
semestralka1/chafa/character/run/out_run4.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..g@$...
|
||||||
|
..yT`...
|
||||||
|
.g@F....
|
||||||
|
.4@L....
|
||||||
|
._$$....
|
||||||
|
.`@~....
|
||||||
6
semestralka1/chafa/character/run/out_run5.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
...@@...
|
||||||
|
.._Z~...
|
||||||
|
..@@....
|
||||||
|
..$@#...
|
||||||
|
..g@L...
|
||||||
|
.yFP....
|
||||||
6
semestralka1/chafa/character/run/out_run6.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
....@@..
|
||||||
|
..._Z~..
|
||||||
|
..y@@,_.
|
||||||
|
..@$@~~.
|
||||||
|
..y@~$..
|
||||||
|
.aF~.4L.
|
||||||
6
semestralka1/chafa/character/run/out_run7.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
....a@e.
|
||||||
|
..._ZF`.
|
||||||
|
..a~@@y=
|
||||||
|
..'y@L`.
|
||||||
|
_yyP.4y.
|
||||||
|
`~`...4L
|
||||||
BIN
semestralka1/chafa/character/run/run1.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
semestralka1/chafa/character/run/run2.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
semestralka1/chafa/character/run/run3.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
semestralka1/chafa/character/run/run4.jpg
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
semestralka1/chafa/character/run/run5.jpg
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
semestralka1/chafa/character/run/run6.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
semestralka1/chafa/character/run/run7.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
5
semestralka1/chafa/character/run_chafa.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
chafa --symbols ascii-block -c none --fill none --invert --size=13x20 predloha_run_a.jpg > out.txt
|
||||||
|
|
||||||
|
a = 78x111
|
||||||
|
b = 34x111
|
||||||
|
walk = 60x111
|
||||||
6
semestralka1/chafa/character/walk/out_walk1.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..a@w.
|
||||||
|
.._T`.
|
||||||
|
.s@@y.
|
||||||
|
.^$$~T
|
||||||
|
.y@`$.
|
||||||
|
=F..?K
|
||||||
6
semestralka1/chafa/character/walk/out_walk2.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..y@$.
|
||||||
|
.._Z~.
|
||||||
|
.y@@L.
|
||||||
|
.4W@Z!
|
||||||
|
._$~$.
|
||||||
|
~~`.0.
|
||||||
6
semestralka1/chafa/character/walk/out_walk3.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..g@L.
|
||||||
|
.._T~.
|
||||||
|
.g@$..
|
||||||
|
.J@@..
|
||||||
|
_y$4L.
|
||||||
|
~~.4~.
|
||||||
6
semestralka1/chafa/character/walk/out_walk4.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..a@w.
|
||||||
|
..~T~.
|
||||||
|
..@$..
|
||||||
|
..@$..
|
||||||
|
..y@..
|
||||||
|
."~@..
|
||||||
6
semestralka1/chafa/character/walk/out_walk5.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..@@..
|
||||||
|
..Z~..
|
||||||
|
..@L..
|
||||||
|
..@L..
|
||||||
|
..$%..
|
||||||
|
.4F...
|
||||||
6
semestralka1/chafa/character/walk/out_walk6.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.u@$..
|
||||||
|
..Z~..
|
||||||
|
.g@_..
|
||||||
|
.$@5+.
|
||||||
|
._BL..
|
||||||
|
uP.@..
|
||||||
6
semestralka1/chafa/character/walk/out_walk7.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
..a@w.
|
||||||
|
.._T`.
|
||||||
|
.s@@y.
|
||||||
|
.^$$~T
|
||||||
|
.yE`$.
|
||||||
|
=F..JK
|
||||||
BIN
semestralka1/chafa/character/walk/walk1.jpg
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
semestralka1/chafa/character/walk/walk2.jpg
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
semestralka1/chafa/character/walk/walk3.jpg
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
semestralka1/chafa/character/walk/walk4.jpg
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
semestralka1/chafa/character/walk/walk5.jpg
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
semestralka1/chafa/character/walk/walk6.jpg
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
semestralka1/chafa/character/walk/walk7.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
1
semestralka1/mbed-os.lib
Normal file
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
|
||||||
BIN
semestralka1/resources/official_armmbed_example_badge.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
22
semestralka1/src/assets/background_frame.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// src/assets/background_frame.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
static const char *BACKGROUND_MASK[] = {
|
||||||
|
"~`````````````````````````````````````````````````````````````````````````````````````\"````````````````````````````````~```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````+````````````````````~````````````````````````````````~```````````````````````````````````````````````````````",
|
||||||
|
"...................................................................,.......................:..........................................'.........`..:.....................................................................................................+...................................:...........:..,................................................",
|
||||||
|
"...........................\"............................................._................................+...........................................................................................................,..............................................`..............................................................!........................",
|
||||||
|
".......`...............!..:..............................................`,...,,,'........_.....................''::.....:........................^......................,,...........................................':.......'........................,....,,,.......................+...,...'::'.............................^......................,,....",
|
||||||
|
"...`......................\"...........`.....`...................._,....:,::::^.`::::::........'''``....`....y..^............-...........................................:'.....................,........\".....................................:_......,,:::..`'`::::.........'''`..........+....+........,............................................,:`....",
|
||||||
|
",,,,,,,,,,,`,,,,,,,^,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,`a',,,,,,',.+,,,''''`.........,,'?'!#R,,,,,,,,,,,,,y,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__,,,_',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y'`,,,,,'.,,,,,,.'''`........,,''^,s@^,,,,,,,,,,,,_;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,_,`,,,,,,",
|
||||||
|
",,,,,,,,,,^,,,,,,','''':,,,,,,,,,,,,,,,,,,,,,,''',,,,,,,,,,+,,,,,,,,,:'!^'`,,``..'.'''`,,,,,,,yy_,_yaF,,.'`'',,,,,ym$###$@M@,,,,,;,,,,,,,,,,,,,,,,,,,,,''''':,y,,,7#@@~,,,,,,,,,,,,,,,,,~,,,,,,,::'''::,~,,,,,,,,,,,,,,,,,,,'''',,,,,,,,,,,,,,,,,,,::'~''`,```..``''',,,,,,,y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@@ETTT~~~~~~~~~~FFFFFFFFF5@@@R#=PFFF~~~,,,,aggy_..,__,.._,_$@PPRRRRR#$4GRRRRR@@@@@@@@@@F",
|
||||||
|
"...,,,:::::4@@@@@@~...,,,,,,,,,,$@$:_@@@@@_ggaggg@@F~.::::,,,,,,,,,,,yyyyyy,_yggg@@@@@@@@MF#$ggagggyww::$@M@@@@..~$.,,:3@@@$A::::,\"@@g$_:d@@..~~@~`,,,,,,,,,,yyyx,,,,,,,ggg_......,,::::::@@@@@@$....:,,,,,,,,,@@:_$@@@@yg$g$ggg@@~`::::,,,,,,,,,,,yyyyyy_,yygg$@@@@@@@@F5aagggggyyw,:d@P@@@@L.`5r,,,:@@@@UL`:::,N@@gy.:@@F.>~5F~,,,,,,,,,,,yyy,,,,,,,,ggy...",
|
||||||
|
"...,,,,,,,,4@@@$g@....,7^=sa@@$a@@@@@@@@@@@@@@@@@@~``.`,,,,,,,,:::`,g@R@BZa$TTTTF5PM@@@@^:`'`~T5#@@y_`,u@~$@$@@g_,F,,,,`@@@@'':^na$g@@@=_:@@.`,.4__,,,,,,,,,g@@K:,,,,,,g@@@@w....,,,,,,,,,$@@$g@F...,,^=#aa@$gg@@@@@@@@@@@@@@@@@F``.`,,,,,,,,,::`,:@@P@R5$T~TTFFPP5@@@$:'``~~7P@@y_``,$E4@W@$@y,4::,,`3@@@[`:,raagg@@Fk`@@L.,.`g_,,,,,,,,,,g@@~:,,,,,,g@@@$..",
|
||||||
|
"..,:''``a$gg@$@@ZF...:,,,,,,:`~T@@@@@@@@@@@@@A@@^``...:,,,,,`,,::,.,@@@@@@@@,`.`````@@@[',,,,,,,,,,`TR@@@@@@@$@@@`'''':,A@MP.,,,,,\"~TT@,`3@@*g'.`4@':,,,,,,:EDT,,,,,,,_@@@@@$....:':':H$$g@$@@$@....,,,,,`:`~7R@@@@@@@@@@@@AR@@```..,',,,'``,,::,,d@0@@@@@y`.`````g@@@`',,,,,,,,,:79@$@@@@@@@@@'\"``':,!$FP~:,,,,,~~7@y.~A@mg@'.\"@F::,,,,,,4ER~,,,,,,,g@@@@@..",
|
||||||
|
};
|
||||||
|
static const int VIEW_HEIGHT = sizeof(BACKGROUND_MASK) / sizeof(BACKGROUND_MASK[0]);
|
||||||
38
semestralka1/src/assets/character_crawl_frames.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// src/assets/character_crawl_frames.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Crawl frame 1
|
||||||
|
static const char *CRAWL_FRAME_1[] = {
|
||||||
|
"........",
|
||||||
|
"........",
|
||||||
|
"...y4@W.",
|
||||||
|
"..a@a`..",
|
||||||
|
"..@@R@=.",
|
||||||
|
".aa@s@.."
|
||||||
|
};
|
||||||
|
|
||||||
|
// Crawl frame 2
|
||||||
|
static const char *CRAWL_FRAME_2[] = {
|
||||||
|
"........",
|
||||||
|
"........",
|
||||||
|
"........",
|
||||||
|
".____...",
|
||||||
|
".@@@@yg,",
|
||||||
|
".a@@PR@L"
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CrawlFrame {
|
||||||
|
Crawl1 = 0,
|
||||||
|
Crawl2,
|
||||||
|
COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char **CHARACTER_CRAWL_FRAMES[] = {
|
||||||
|
CRAWL_FRAME_1,
|
||||||
|
CRAWL_FRAME_2
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int CHARACTER_CRAWL_FRAME_COUNT = sizeof(CHARACTER_CRAWL_FRAMES) / sizeof(CHARACTER_CRAWL_FRAMES[0]);
|
||||||
|
|
||||||
|
// Height (rows per crawl frame)
|
||||||
|
static const int CHARACTER_CRAWL_FRAME_HEIGHT = sizeof(CRAWL_FRAME_1) / sizeof(CRAWL_FRAME_1[0]);
|
||||||
98
semestralka1/src/assets/character_run_frames.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// src/assets/character_run_frames.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Run frame 1
|
||||||
|
static const char *RUN_FRAME_1[] = {
|
||||||
|
"....g@w.",
|
||||||
|
"..._ZF~.",
|
||||||
|
"..@~@@y=",
|
||||||
|
"\".g@_`.",
|
||||||
|
"_ygF.Ry.",
|
||||||
|
"`~`...4L",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run frame 2
|
||||||
|
static const char *RUN_FRAME_2[] = {
|
||||||
|
"....g@w.",
|
||||||
|
"..._Z~~.",
|
||||||
|
"..aM@$y,",
|
||||||
|
"..~a@_`.",
|
||||||
|
".yy@`$..",
|
||||||
|
"..`..@..",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run frame 3
|
||||||
|
static const char *RUN_FRAME_3[] = {
|
||||||
|
"...a@$..",
|
||||||
|
"..._Z~..",
|
||||||
|
"..a@@...",
|
||||||
|
"..R@@=..",
|
||||||
|
".yy@@...",
|
||||||
|
".``u@...",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run frame 4
|
||||||
|
static const char *RUN_FRAME_4[] = {
|
||||||
|
"..g@$...",
|
||||||
|
"..yT`...",
|
||||||
|
".g@F....",
|
||||||
|
".4@L....",
|
||||||
|
"._$$....",
|
||||||
|
".`@~....",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run frame 5
|
||||||
|
static const char *RUN_FRAME_5[] = {
|
||||||
|
"...@@...",
|
||||||
|
".._Z~...",
|
||||||
|
"..@@....",
|
||||||
|
"..$@#...",
|
||||||
|
"..g@L...",
|
||||||
|
".yFP....",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run frame 6
|
||||||
|
static const char *RUN_FRAME_6[] = {
|
||||||
|
"....@@..",
|
||||||
|
"..._Z~..",
|
||||||
|
"..y@@,_.",
|
||||||
|
"..@$@~~.",
|
||||||
|
"..y@~$..",
|
||||||
|
".aF~.4L.",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Run frame 7
|
||||||
|
static const char *RUN_FRAME_7[] = {
|
||||||
|
"....a@e.",
|
||||||
|
"..._ZF`.",
|
||||||
|
"..a~@@y=",
|
||||||
|
"..'y@L`.",
|
||||||
|
"_yyP.4y.",
|
||||||
|
"`~`...4L",
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class RunFrame {
|
||||||
|
Run1 = 0,
|
||||||
|
Run2,
|
||||||
|
Run3,
|
||||||
|
Run4,
|
||||||
|
Run5,
|
||||||
|
Run6,
|
||||||
|
Run7,
|
||||||
|
COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char **CHARACTER_RUN_FRAMES[] = {
|
||||||
|
RUN_FRAME_1,
|
||||||
|
RUN_FRAME_2,
|
||||||
|
RUN_FRAME_3,
|
||||||
|
RUN_FRAME_4,
|
||||||
|
RUN_FRAME_5,
|
||||||
|
RUN_FRAME_6,
|
||||||
|
RUN_FRAME_7,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int CHARACTER_RUN_FRAME_COUNT = sizeof(CHARACTER_RUN_FRAMES) / sizeof(CHARACTER_RUN_FRAMES[0]);
|
||||||
|
|
||||||
|
// Height (rows per run frame)
|
||||||
|
static const int CHARACTER_RUN_FRAME_HEIGHT = sizeof(RUN_FRAME_1) / sizeof(RUN_FRAME_1[0]);
|
||||||
98
semestralka1/src/assets/character_walk_frames.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// src/assets/character_walk_frames.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Walk frame 1
|
||||||
|
static const char *WALK_FRAME_1[] = {
|
||||||
|
"..a@w.",
|
||||||
|
".._T`.",
|
||||||
|
".s@@y.",
|
||||||
|
".^$$~T",
|
||||||
|
".y@`$.",
|
||||||
|
"=F..?K",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Walk frame 2
|
||||||
|
static const char *WALK_FRAME_2[] = {
|
||||||
|
"..y@$.",
|
||||||
|
".._Z~.",
|
||||||
|
".y@@L.",
|
||||||
|
".4W@Z!",
|
||||||
|
"._$~$.",
|
||||||
|
"~~`.0.",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Walk frame 3
|
||||||
|
static const char *WALK_FRAME_3[] = {
|
||||||
|
"..g@L.",
|
||||||
|
".._T~.",
|
||||||
|
".g@$..",
|
||||||
|
".J@@..",
|
||||||
|
"_y$4L.",
|
||||||
|
"~~.4~.",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Walk frame 4
|
||||||
|
static const char *WALK_FRAME_4[] = {
|
||||||
|
"..a@w.",
|
||||||
|
"..~T~.",
|
||||||
|
"..@$..",
|
||||||
|
"..@$..",
|
||||||
|
"..y@..",
|
||||||
|
".\"~@..",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Walk frame 5
|
||||||
|
static const char *WALK_FRAME_5[] = {
|
||||||
|
"..@@..",
|
||||||
|
"..Z~..",
|
||||||
|
"..@L..",
|
||||||
|
"..@L..",
|
||||||
|
"..$%..",
|
||||||
|
".4F...",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Walk frame 6
|
||||||
|
static const char *WALK_FRAME_6[] = {
|
||||||
|
".u@$..",
|
||||||
|
"..Z~..",
|
||||||
|
".g@_..",
|
||||||
|
".$@5+.",
|
||||||
|
"._BL..",
|
||||||
|
"uP.@..",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Walk frame 7
|
||||||
|
static const char *WALK_FRAME_7[] = {
|
||||||
|
"..a@w.",
|
||||||
|
".._T`.",
|
||||||
|
".s@@y.",
|
||||||
|
".^$$~T",
|
||||||
|
".yE`$.",
|
||||||
|
"=F..JK",
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class WalkFrame {
|
||||||
|
Walk1 = 0,
|
||||||
|
Walk2,
|
||||||
|
Walk3,
|
||||||
|
Walk4,
|
||||||
|
Walk5,
|
||||||
|
Walk6,
|
||||||
|
Walk7,
|
||||||
|
COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char **CHARACTER_WALK_FRAMES[] = {
|
||||||
|
WALK_FRAME_1,
|
||||||
|
WALK_FRAME_2,
|
||||||
|
WALK_FRAME_3,
|
||||||
|
WALK_FRAME_4,
|
||||||
|
WALK_FRAME_5,
|
||||||
|
WALK_FRAME_6,
|
||||||
|
WALK_FRAME_7,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int CHARACTER_WALK_FRAME_COUNT = sizeof(CHARACTER_WALK_FRAMES) / sizeof(CHARACTER_WALK_FRAMES[0]);
|
||||||
|
|
||||||
|
// Height (rows per walk frame)
|
||||||
|
static const int CHARACTER_WALK_FRAME_HEIGHT = sizeof(WALK_FRAME_1) / sizeof(WALK_FRAME_1[0]);
|
||||||
16
semestralka1/src/game/animation.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// src/game/animation.cpp
|
||||||
|
#include "animation.h"
|
||||||
|
|
||||||
|
AnimationController::AnimationController() {
|
||||||
|
anim_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AnimationController::tick(int speed) {
|
||||||
|
if (anim_timer.elapsed_time() >= ANIMATION_TICK) {
|
||||||
|
// speed determines scroll steps per tick
|
||||||
|
shift += speed;
|
||||||
|
anim_timer.reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
20
semestralka1/src/game/animation.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// src/game/animation.h
|
||||||
|
#pragma once
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
constexpr auto ANIMATION_TICK = 170ms;
|
||||||
|
|
||||||
|
class AnimationController {
|
||||||
|
private:
|
||||||
|
Timer anim_timer;
|
||||||
|
int shift = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AnimationController();
|
||||||
|
|
||||||
|
// Update animation, returns true if redraw needed
|
||||||
|
bool tick(int speed);
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
int get_shift() const { return shift; }
|
||||||
|
};
|
||||||
167
semestralka1/src/game/state.cpp
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
// src/game/state.cpp
|
||||||
|
#include "state.h"
|
||||||
|
#include "../render/player.h"
|
||||||
|
#include "../timing/speed_controller.h"
|
||||||
|
#include "../assets/character_run_frames.h"
|
||||||
|
#include "../assets/character_walk_frames.h"
|
||||||
|
#include "../assets/character_crawl_frames.h"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
// Frame selector with two regimes:
|
||||||
|
// 1) Normal (speed <= 6): ping‑pong with holds at both ends
|
||||||
|
// 2) High‑speed (speed >= 7): 0, random(1..last-1), last, random(1..last-1)...
|
||||||
|
static inline int compute_frame_index(int frame_count,
|
||||||
|
float player_speed,
|
||||||
|
int tick_counter) {
|
||||||
|
if (frame_count <= 1) return 0;
|
||||||
|
if (player_speed <= 0.0f) return 0;
|
||||||
|
|
||||||
|
const int last = frame_count - 1;
|
||||||
|
|
||||||
|
// High-speed pattern: 0, rand(1..last-1), last, rand(1..last-1), ...
|
||||||
|
if (player_speed >= 7.0f) {
|
||||||
|
// Special-case 2-frame animations
|
||||||
|
if (frame_count <= 2) {
|
||||||
|
return (tick_counter & 1) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Even ticks → extremes (0 or last), alternating each time.
|
||||||
|
// Odd ticks → pseudo-random mid in [1..last-1].
|
||||||
|
if ((tick_counter & 1) == 0) {
|
||||||
|
// Alternate 0 and last on even ticks
|
||||||
|
bool choose_zero = ((tick_counter >> 1) & 1) == 0;
|
||||||
|
return choose_zero ? 0 : last;
|
||||||
|
} else {
|
||||||
|
// Simple deterministic PRNG from tick_counter and speed
|
||||||
|
unsigned int seed =
|
||||||
|
static_cast<unsigned int>(tick_counter) * 1664525u + 1013904223u;
|
||||||
|
seed ^= static_cast<unsigned int>(frame_count) * 2654435761u;
|
||||||
|
seed ^= static_cast<unsigned int>(player_speed * 997.0f);
|
||||||
|
int range = last - 1; // size of 1..last-1
|
||||||
|
if (range <= 0) return 0; // safety
|
||||||
|
int mid = 1 + static_cast<int>(seed % static_cast<unsigned int>(range));
|
||||||
|
return mid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normal-speed regime: discrete ping‑pong with holds at both ends.
|
||||||
|
// - speed 1 => 0,1,2,...,last, last, ..., 2,1, 0,0 ...
|
||||||
|
// - speed 2 => advances 2 steps per tick (skipping every second timeline entry)
|
||||||
|
// - holds at ends make 0 and last appear more frequently
|
||||||
|
const int hold = 2; // how many extra steps to hold at each end
|
||||||
|
|
||||||
|
// One full ping‑pong cycle length:
|
||||||
|
// [hold at 0] + [ascend 1..last] + [hold at last] + [descend last-1..0]
|
||||||
|
const int ascend_len = last; // produces 1..last (length = last)
|
||||||
|
const int descend_len = last; // produces last-1..0 (length = last)
|
||||||
|
const int cycle_len = hold + ascend_len + hold + descend_len;
|
||||||
|
|
||||||
|
// Advance by an integer number of steps per tick based on speed
|
||||||
|
int step = static_cast<int>(floorf(player_speed + 0.5f));
|
||||||
|
if (step < 1) step = 1;
|
||||||
|
|
||||||
|
// Use 64-bit for safety, then fold into cycle length
|
||||||
|
const long long pos64 =
|
||||||
|
(static_cast<long long>(tick_counter) *
|
||||||
|
static_cast<long long>(step)) %
|
||||||
|
static_cast<long long>(cycle_len);
|
||||||
|
int pos = static_cast<int>(pos64);
|
||||||
|
|
||||||
|
// Map timeline position to frame index
|
||||||
|
if (pos < hold) {
|
||||||
|
return 0; // hold at 0
|
||||||
|
}
|
||||||
|
pos -= hold;
|
||||||
|
|
||||||
|
if (pos < ascend_len) {
|
||||||
|
// ascend: 1..last
|
||||||
|
return (pos + 1);
|
||||||
|
}
|
||||||
|
pos -= ascend_len;
|
||||||
|
|
||||||
|
if (pos < hold) {
|
||||||
|
return last; // hold at last
|
||||||
|
}
|
||||||
|
pos -= hold;
|
||||||
|
|
||||||
|
// descend: last-1 .. 0
|
||||||
|
return last - 1 - pos;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void WalkingState::update() {
|
||||||
|
// stop crawling after duration
|
||||||
|
if (current_state == PlayerState::Crawl &&
|
||||||
|
state_timer.elapsed_time() >= CRAWL_DURATION) {
|
||||||
|
current_state = PlayerState::Walk;
|
||||||
|
state_timer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WalkingState::start_crawl() {
|
||||||
|
current_state = PlayerState::Crawl;
|
||||||
|
state_timer.reset();
|
||||||
|
state_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WalkingState::set_state(PlayerState s) {
|
||||||
|
if (current_state != s) {
|
||||||
|
walk_index = run_index = crawl_index = 0;
|
||||||
|
phase = 0.0f;
|
||||||
|
}
|
||||||
|
current_state = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WalkingState::set_motion_state_for_speed(int player_speed, int ground_speed) {
|
||||||
|
int relative = player_speed - ground_speed;
|
||||||
|
PlayerState new_state = (relative > 1) ? PlayerState::Run : PlayerState::Walk;
|
||||||
|
if (new_state != current_state) {
|
||||||
|
run_index = 0;
|
||||||
|
walk_index = 0;
|
||||||
|
}
|
||||||
|
current_state = new_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO THIS NEEDS REDESIGN FOR WALK/RUN
|
||||||
|
void WalkingState::toggle_walk_frame(float player_speed, int tick_counter) {
|
||||||
|
switch (current_state) {
|
||||||
|
case PlayerState::Run:
|
||||||
|
run_index =
|
||||||
|
compute_frame_index(CHARACTER_RUN_FRAME_COUNT, player_speed, tick_counter);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlayerState::Walk:
|
||||||
|
walk_index =
|
||||||
|
compute_frame_index(CHARACTER_WALK_FRAME_COUNT, player_speed, tick_counter);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlayerState::Crawl:
|
||||||
|
crawl_index =
|
||||||
|
compute_frame_index(CHARACTER_CRAWL_FRAME_COUNT, player_speed, tick_counter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameSelection WalkingState::get_frame_selection() const {
|
||||||
|
FrameSelection f{};
|
||||||
|
switch (current_state) {
|
||||||
|
case PlayerState::Walk:
|
||||||
|
f.movement = MovementType::Walk;
|
||||||
|
f.frame_index = walk_index;
|
||||||
|
break;
|
||||||
|
case PlayerState::Run:
|
||||||
|
f.movement = MovementType::Run;
|
||||||
|
f.frame_index = run_index;
|
||||||
|
break;
|
||||||
|
case PlayerState::Crawl:
|
||||||
|
f.movement = MovementType::Crawl;
|
||||||
|
f.frame_index = crawl_index;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
f.movement = MovementType::Walk;
|
||||||
|
f.frame_index = walk_index;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
35
semestralka1/src/game/state.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// src/game/state.h
|
||||||
|
#pragma once
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "../render/player.h"
|
||||||
|
|
||||||
|
constexpr auto CRAWL_DURATION = 300ms;
|
||||||
|
|
||||||
|
enum class PlayerState { Walk, Run, Crawl };
|
||||||
|
|
||||||
|
struct FrameSelection {
|
||||||
|
MovementType movement;
|
||||||
|
int frame_index;
|
||||||
|
};
|
||||||
|
|
||||||
|
class WalkingState {
|
||||||
|
private:
|
||||||
|
PlayerState current_state = PlayerState::Walk;
|
||||||
|
Timer state_timer;
|
||||||
|
int walk_index = 0; // cycles 0‑6
|
||||||
|
int run_index = 0; // cycles 0‑6
|
||||||
|
int crawl_index = 0; // cycles 0‑1
|
||||||
|
float phase = 0.0f;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void update();
|
||||||
|
void start_crawl();
|
||||||
|
|
||||||
|
void set_motion_state_for_speed(int player_speed, int ground_speed);
|
||||||
|
void toggle_walk_frame(float player_speed, int tick_counter);
|
||||||
|
|
||||||
|
FrameSelection get_frame_selection() const;
|
||||||
|
PlayerState get_state() const { return current_state; }
|
||||||
|
|
||||||
|
void set_state(PlayerState s);
|
||||||
|
};
|
||||||
49
semestralka1/src/hardware/uart.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
// src/hardware/uart.cpp
|
||||||
|
#include "uart.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
UartReader::UartReader(BufferedSerial &serial) : serial_port(serial) {
|
||||||
|
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||||
|
memset(message, 0, sizeof(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
UartEvent UartReader::poll() {
|
||||||
|
bool changed = false;
|
||||||
|
bool triggered = false;
|
||||||
|
|
||||||
|
// cita spravu z uartu
|
||||||
|
if (serial_port.readable()) {
|
||||||
|
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||||
|
ssize_t num = serial_port.read(rx_buffer, sizeof(rx_buffer) - 1);
|
||||||
|
if (num > 0) {
|
||||||
|
strncpy(message, rx_buffer, sizeof(message) - 1);
|
||||||
|
message_active = true;
|
||||||
|
changed = true;
|
||||||
|
triggered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// casovac na 1s zobrazenia spravy
|
||||||
|
if (!timer_started) {
|
||||||
|
msg_timer.start();
|
||||||
|
timer_started = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// po jednu sekundu sa sprava zobrazi
|
||||||
|
if (message_active && msg_timer.elapsed_time() > MESSAGE_DISPLAY_DURATION) {
|
||||||
|
message_active = false;
|
||||||
|
memset(message, 0, sizeof(message));
|
||||||
|
msg_timer.reset();
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (triggered)
|
||||||
|
return UartEvent::Triggered;
|
||||||
|
if (changed)
|
||||||
|
return UartEvent::MessageUpdate;
|
||||||
|
return UartEvent::NoChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* UartReader::get_message() const {
|
||||||
|
return message_active ? message : nullptr;
|
||||||
|
}
|
||||||
35
semestralka1/src/hardware/uart.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// src/hardware/uart.h
|
||||||
|
#pragma once
|
||||||
|
#include "mbed.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
constexpr size_t UART_BUFFER_SIZE = 64;
|
||||||
|
constexpr auto MESSAGE_DISPLAY_DURATION = 1s;
|
||||||
|
|
||||||
|
enum class UartEvent {
|
||||||
|
NoChange = 0, // No new data
|
||||||
|
MessageUpdate = 1, // Message changed (received or expired)
|
||||||
|
Triggered = 2 // New message received (trigger action)
|
||||||
|
};
|
||||||
|
|
||||||
|
class UartReader {
|
||||||
|
private:
|
||||||
|
BufferedSerial &serial_port;
|
||||||
|
|
||||||
|
char rx_buffer[UART_BUFFER_SIZE];
|
||||||
|
char message[UART_BUFFER_SIZE];
|
||||||
|
bool message_active = false;
|
||||||
|
|
||||||
|
Timer msg_timer;
|
||||||
|
bool timer_started = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UartReader(BufferedSerial &serial);
|
||||||
|
|
||||||
|
// Poll for UART events
|
||||||
|
UartEvent poll();
|
||||||
|
|
||||||
|
// Get current message (nullptr if no active message)
|
||||||
|
const char* get_message() const;
|
||||||
|
bool has_message() const { return message_active; }
|
||||||
|
};
|
||||||
26
semestralka1/src/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// main.cpp
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "assets/background_frame.h"
|
||||||
|
#include "render/loop.h"
|
||||||
|
|
||||||
|
#define TARGET_TX_PIN USBTX
|
||||||
|
#define TARGET_RX_PIN USBRX
|
||||||
|
#define BAUD_RATE 460800
|
||||||
|
|
||||||
|
BufferedSerial serial_port(TARGET_TX_PIN, TARGET_RX_PIN, BAUD_RATE);
|
||||||
|
|
||||||
|
FileHandle *mbed::mbed_override_console(int fd)
|
||||||
|
{
|
||||||
|
return &serial_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
DigitalOut led(LED1);
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
serial_port.set_format(8, BufferedSerial::None, 1);
|
||||||
|
printf("Baud: %d, Format: 8-N-1\r\n", BAUD_RATE);
|
||||||
|
|
||||||
|
// Just call into render feature
|
||||||
|
render_loop(6);
|
||||||
|
}
|
||||||
33
semestralka1/src/render/background.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// src/render/background.cpp
|
||||||
|
|
||||||
|
#include "background.h"
|
||||||
|
#include "../assets/background_frame.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
void draw_mask(const char *unused_filename, int shift, const char *text) {
|
||||||
|
// Terminal clear + home
|
||||||
|
printf("\033[2J\033[H");
|
||||||
|
|
||||||
|
for (int i = 0; i < VIEW_HEIGHT && i < VIEW_HEIGHT; i++) {
|
||||||
|
const char *row = BACKGROUND_MASK[i];
|
||||||
|
int width = strlen(row);
|
||||||
|
if (width == 0) {
|
||||||
|
printf("\r\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = shift % width;
|
||||||
|
|
||||||
|
for (int j = 0; j < VIEW_WIDTH; j++) {
|
||||||
|
printf("%c", row[(start + j) % width]);
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text && text[0] != '\0') {
|
||||||
|
printf("\r\n[RX] %s\r\n", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
7
semestralka1/src/render/background.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// src/render/background.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
constexpr int VIEW_WIDTH = 90;
|
||||||
|
|
||||||
|
// Draws the ASCII art background with optional message
|
||||||
|
void draw_mask(const char *unused_filename, int shift, const char *text = nullptr);
|
||||||
83
semestralka1/src/render/loop.cpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
// src/render/loop.cpp
|
||||||
|
#include "loop.h"
|
||||||
|
#include "../assets/background_frame.h"
|
||||||
|
#include "player_positioning.h"
|
||||||
|
#include "background.h"
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "player.h"
|
||||||
|
#include "../game/state.h"
|
||||||
|
#include "../game/animation.h"
|
||||||
|
#include "../hardware/uart.h"
|
||||||
|
#include "../render/player.h"
|
||||||
|
#include "../timing/speed_controller.h"
|
||||||
|
#include "../timing/movement_controller.h"
|
||||||
|
|
||||||
|
extern BufferedSerial serial_port;
|
||||||
|
extern DigitalOut led;
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
// constexpr int PLAYER_X = 9;
|
||||||
|
constexpr int PLAYER_X = 29;
|
||||||
|
constexpr int PLAYER_Y = 6;
|
||||||
|
|
||||||
|
void draw_mask(const char *unused_filename, int shift, const char *text);
|
||||||
|
|
||||||
|
void render_loop(int speed) {
|
||||||
|
WalkingState player_state;
|
||||||
|
AnimationController animation;
|
||||||
|
UartReader uart(serial_port);
|
||||||
|
MovementController mover(PLAYER_X, VIEW_WIDTH);
|
||||||
|
SpeedController timing;
|
||||||
|
timing.set_ground_speed(speed);
|
||||||
|
|
||||||
|
CharacterPosition pos = {PLAYER_X, PLAYER_Y};
|
||||||
|
|
||||||
|
const char *bg_file = "background_dark_inverted.txt";
|
||||||
|
bool need_redraw = false;
|
||||||
|
|
||||||
|
int anim_tick_counter = 0;
|
||||||
|
int tick_counter = 0;
|
||||||
|
int player_speed = 6;
|
||||||
|
|
||||||
|
player_state.set_state(PlayerState::Run);
|
||||||
|
while (true) {
|
||||||
|
tick_counter++;
|
||||||
|
|
||||||
|
mover.update_position(player_speed, timing.get_ground_speed());
|
||||||
|
pos.x = mover.get_position();
|
||||||
|
|
||||||
|
need_redraw = false;
|
||||||
|
UartEvent uart_event = uart.poll();
|
||||||
|
|
||||||
|
if (uart_event == UartEvent::MessageUpdate) {
|
||||||
|
need_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uart_event == UartEvent::Triggered) {
|
||||||
|
// start crawl frame for x time
|
||||||
|
player_state.start_crawl();
|
||||||
|
need_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if crawl duration expired
|
||||||
|
player_state.update();
|
||||||
|
|
||||||
|
if (animation.tick(speed)) {
|
||||||
|
anim_tick_counter++;
|
||||||
|
need_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (need_redraw) {
|
||||||
|
player_state.toggle_walk_frame(player_speed, anim_tick_counter);
|
||||||
|
draw_mask(bg_file, animation.get_shift(), uart.get_message());
|
||||||
|
FrameSelection frame = player_state.get_frame_selection();
|
||||||
|
|
||||||
|
CharacterPosition draw_pos = get_aligned_frame_position(pos, frame.movement, frame.frame_index);
|
||||||
|
draw_character(draw_pos.x, draw_pos.y, frame.movement, frame.frame_index);
|
||||||
|
|
||||||
|
ThisThread::sleep_for(50ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThisThread::sleep_for(25ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
6
semestralka1/src/render/loop.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// src/render/loop.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Runs the render loop: reads UART, animates, and draws output
|
||||||
|
void render_loop(int speed);
|
||||||
43
semestralka1/src/render/player.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// src/render/player.cpp
|
||||||
|
#include "player.h"
|
||||||
|
#include "../assets/character_walk_frames.h"
|
||||||
|
#include "../assets/character_run_frames.h"
|
||||||
|
#include "../assets/character_crawl_frames.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
void draw_character(int x, int y, MovementType movement, int frame_index) {
|
||||||
|
const char **character = nullptr;
|
||||||
|
int character_height = 0;
|
||||||
|
int total_frames = 0;
|
||||||
|
|
||||||
|
switch (movement) {
|
||||||
|
case MovementType::Walk:
|
||||||
|
total_frames = CHARACTER_WALK_FRAME_COUNT;
|
||||||
|
if (frame_index < 0 || frame_index >= total_frames)
|
||||||
|
frame_index = 0;
|
||||||
|
character = CHARACTER_WALK_FRAMES[frame_index];
|
||||||
|
character_height = CHARACTER_WALK_FRAME_HEIGHT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MovementType::Run:
|
||||||
|
total_frames = CHARACTER_RUN_FRAME_COUNT;
|
||||||
|
if (frame_index < 0 || frame_index >= total_frames)
|
||||||
|
frame_index = 0;
|
||||||
|
character = CHARACTER_RUN_FRAMES[frame_index];
|
||||||
|
character_height = CHARACTER_RUN_FRAME_HEIGHT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MovementType::Crawl:
|
||||||
|
total_frames = CHARACTER_CRAWL_FRAME_COUNT;
|
||||||
|
if (frame_index < 0 || frame_index >= total_frames)
|
||||||
|
frame_index = 0;
|
||||||
|
character = CHARACTER_CRAWL_FRAMES[frame_index];
|
||||||
|
character_height = CHARACTER_CRAWL_FRAME_HEIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < character_height; i++) {
|
||||||
|
printf("\033[%d;%dH%s", y + i + 1, x + 1, character[i]);
|
||||||
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
11
semestralka1/src/render/player.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// src/render/player.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum class MovementType {
|
||||||
|
Walk,
|
||||||
|
Run,
|
||||||
|
Crawl
|
||||||
|
};
|
||||||
|
|
||||||
|
// Draw the player object starting at given (x, y)
|
||||||
|
void draw_character(int x, int y, MovementType movement, int frame_index);
|
||||||
30
semestralka1/src/render/player_positioning.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// src/render/player_positioning.cpp
|
||||||
|
#include "player_positioning.h"
|
||||||
|
#include "../assets/background_frame.h"
|
||||||
|
#include "../assets/character_walk_frames.h"
|
||||||
|
#include "../assets/character_run_frames.h"
|
||||||
|
#include "../assets/character_crawl_frames.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
CharacterPosition get_aligned_frame_position(CharacterPosition base,
|
||||||
|
MovementType movement,
|
||||||
|
int /*frame_index*/) {
|
||||||
|
int character_height = 0;
|
||||||
|
|
||||||
|
switch (movement) {
|
||||||
|
case MovementType::Walk:
|
||||||
|
character_height = CHARACTER_WALK_FRAME_HEIGHT;
|
||||||
|
break;
|
||||||
|
case MovementType::Run:
|
||||||
|
character_height = CHARACTER_RUN_FRAME_HEIGHT;
|
||||||
|
break;
|
||||||
|
case MovementType::Crawl:
|
||||||
|
character_height = CHARACTER_CRAWL_FRAME_HEIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CharacterPosition draw_pos{};
|
||||||
|
draw_pos.x = base.x;
|
||||||
|
draw_pos.y = (VIEW_HEIGHT - base.y) - character_height;
|
||||||
|
return draw_pos;
|
||||||
|
}
|
||||||
12
semestralka1/src/render/player_positioning.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// src/render/player_positioning.h
|
||||||
|
#pragma once
|
||||||
|
#include "../assets/background_frame.h"
|
||||||
|
#include "player.h"
|
||||||
|
|
||||||
|
struct CharacterPosition {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Calculates drawing position relative to bottom-left pivot
|
||||||
|
CharacterPosition get_aligned_frame_position(CharacterPosition base, MovementType movement,int frame_index);
|
||||||
29
semestralka1/src/timing/movement_controller.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// src/timing/movement_controller.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
// Handles position of the player relative to ground movement
|
||||||
|
class MovementController {
|
||||||
|
private:
|
||||||
|
float x_pos;
|
||||||
|
const int view_width;
|
||||||
|
|
||||||
|
// Scale factor for translating speed difference to pixel movement
|
||||||
|
const float motion_scale = 0.2f;
|
||||||
|
|
||||||
|
public:
|
||||||
|
MovementController(int start_x, int width) : x_pos(static_cast<float>(start_x)), view_width(width) {}
|
||||||
|
|
||||||
|
void reset(int start_x) { x_pos = static_cast<float>(start_x); }
|
||||||
|
|
||||||
|
void update_position(int player_speed, int ground_speed) {
|
||||||
|
int delta = player_speed - ground_speed;
|
||||||
|
x_pos += static_cast<float>(delta) * motion_scale;
|
||||||
|
|
||||||
|
if (x_pos < 0) x_pos = 0;
|
||||||
|
if (x_pos > (VIEW_WIDTH - 10)) x_pos = static_cast<float>(VIEW_WIDTH - 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_position() const { return static_cast<int>(x_pos); }
|
||||||
|
};
|
||||||
34
semestralka1/src/timing/speed_controller.cpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// src/timing/speed_controller.cpp
|
||||||
|
#include "speed_controller.h"
|
||||||
|
|
||||||
|
void SpeedController::set_ground_speed(int spd) {
|
||||||
|
if (spd < 0) spd = 0;
|
||||||
|
if (spd > 30) spd = 30;
|
||||||
|
ground_speed = spd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SpeedController::frame_advance_for(int object_speed, int tick_counter) const {
|
||||||
|
if (object_speed <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ground_speed == 0) {
|
||||||
|
return 1 + object_speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int delta = object_speed - ground_speed;
|
||||||
|
|
||||||
|
if (delta > 0) {
|
||||||
|
return 1 + delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delta == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ratio_f = static_cast<float>(ground_speed) / object_speed;
|
||||||
|
int ratio = static_cast<int>(ratio_f + 0.3f);
|
||||||
|
if (ratio < 1) ratio = 1;
|
||||||
|
|
||||||
|
return (tick_counter % ratio == 0) ? 1 : 0;
|
||||||
|
}
|
||||||
19
semestralka1/src/timing/speed_controller.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// src/timing/speed_controller.h
|
||||||
|
#pragma once
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
class SpeedController {
|
||||||
|
private:
|
||||||
|
int ground_speed = 1;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SpeedController() = default;
|
||||||
|
|
||||||
|
void set_ground_speed(int spd);
|
||||||
|
int get_ground_speed() const { return ground_speed; }
|
||||||
|
|
||||||
|
// Calculates how many frames to advance for current tick.
|
||||||
|
// Takes object’s current speed and a global tick counter
|
||||||
|
// to automatically handle slower "wait" behavior.
|
||||||
|
int frame_advance_for(int object_speed, int tick_counter) const;
|
||||||
|
};
|
||||||