Skip to content

Commit

Permalink
Add quiz.luchok
Browse files Browse the repository at this point in the history
  • Loading branch information
shinkarom committed Aug 26, 2023
1 parent a0cd2c8 commit ee7315f
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ To build Luchok, you must have [cmake](https://cmake.org) and a build system of
* When finished, there will be `luchok_libretro.dll` or `luchok_libretro.so` in the `bin` folder.

# Running
*retroarch executable* -L *luchok library afer building* **game file**
*retroarch executable* -L *luchok library afer building* **game file**

For example, if on a GNU/Linux system, and you are locared in the repository root, you can run `retroarch -L bin/luchok_libretro.so bin/invaders.luchok`.

Expand Down
File renamed without changes.
81 changes: 81 additions & 0 deletions bin/quiz.luchok
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
showingresult = false
a = 0
b = 0
isplus = true
res = 0
drawquestion = true
answer = -1

function generatequiz()
a = rnd(10)
b = rnd(10)
if a + b > 9 then
isplus = false
if a - b < 0 then
local c = a
a = b
b = c
end
res = a - b
else
isplus = true
res = a + b
end
end

generatequiz()

function vblank()
cls()
if showingresult then
draw(get_sprite(answer), 10, 10)
if answer == res then
draw(equalssign, 15, 10)
else
draw(notequalssign, 15, 10)
end
draw(get_sprite(res), 21, 10)
if delay_timer == 0 then
showingresult = false
answer = -1
generatequiz()
end
else
draw(get_sprite(a), 10, 10)
if isplus then
draw(plussign, 15, 10)
else
draw(minussign, 15, 10)
end
draw(get_sprite(b), 21, 10)
draw(equalssign, 26, 10)
if drawquestion then
draw(questionsign, 32, 10)
end
if delay_timer == 0 then
drawquestion = not drawquestion
delay_timer = 60
end

for i = 0,9 do
if key_released(i) then
answer = i
end
end
if answer ~= -1 then
if answer == res then
sound_timer = 80
else
sound_timer = 40
end
showingresult = true
delay_timer = 120
end
end
end

plussign = {0x20, 0x20, 0xF8, 0x20, 0x20}
minussign = {0x00, 0x00, 0xF8, 0x00, 0x00}
equalssign = {0x00, 0xF8, 0x00, 0xF8, 0x00}
notequalssign = {0x50, 0x88, 0xD8, 0x88, 0x50}
questionsign = {0x70, 0x88, 0x10, 0x00, 0x20}
2 changes: 1 addition & 1 deletion bin/snake.luchok
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Snake game
-- 2021 by Roman "shinkarom" Shynkarenko
-- Controls: move snake with 2, 4, 6, 8 (internal controls, not keyboard keys)
-- After game ends, restart it by pressiong 5 9again, the internal control)
-- After game ends, restart it by pressing 5 again, the internal control)

speed = 12
frames = 0
Expand Down
2 changes: 1 addition & 1 deletion src/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ void retro_get_system_info(struct retro_system_info *info)
{
memset(info, 0, sizeof(*info));
info->library_name = "Luchok fantasy console";
info->library_version = "0.1";
info->library_version = "1.0";
info->need_fullpath = false;
info->valid_extensions = "luchok";
}
Expand Down

0 comments on commit ee7315f

Please sign in to comment.