Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 5242 → Rev 5243

/programs/games/heliothryx/Tupfile.lua
1,8 → 1,21
if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end
-- tup.rule("echo \"#define LANG_" .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. "\" > lang.h", {"lang.h"})
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_sound.lua")
LDFLAGS = LDFLAGS .. " -T kolibri.ld"
tup.append_table(OBJS, tup.rule("start.asm", "fasm %f %o", "start.o"))
compile_gcc{"system/kolibri.c", "game/rs/rsmicrolibc.c", "game/rs/rsplatform_kos.c", "game/rs/rsmx.c", "game/rsnoise.c", "game/rsgentex.c", "game/rsmain.c", "game/rsgame.c", "game/rsgamedraw.c", "game/rskos.c", "game/rsgametext.c", "game/rsgamemenu.c"}
 
if tup.getconfig("LANG") == "ru"
then C_LANG = "LANG_RU"
 
elseif tup.getconfig("LANG") == "sp"
then C_LANG = "LANG_SP" -- just for example, other languages are not implemented
 
else C_LANG = "LANG_EN" -- default language is English
end
 
CFLAGS = CFLAGS .. " -DRS_KOS -D" .. C_LANG .. " "
 
compile_gcc{ "system/kolibri.c", "game/rs/rsmicrolibc.c", "game/rs/rsplatform_kos.c", "game/rs/rsmx.c", "game/rsnoise.c", "game/rsgentex.c", "game/rsgame.c", "game/rsgamedraw.c", "game/rskos.c", "game/rsgametext.c", "game/rsgamemenu.c"}
link_gcc("heliothryx")
/programs/games/heliothryx/game/rsmain.h
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/programs/games/heliothryx/game/rsmain.c
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/programs/games/heliothryx/game/rs/rsmicrolibc.c
170,5 → 170,24
}
 
 
char* strchr(char* s, int c) {
 
while (*s) {
if (*s == (char) c) {
return s;
};
s++;
};
return NULL;
 
};
 
unsigned int strlen ( char * str ) {
unsigned int len = 0;
while ( *str ) {
len++;
str++;
};
return len;
};
 
/programs/games/heliothryx/game/rs/rsmicrolibc.h
50,4 → 50,7
void* memset(void *mem, int c, unsigned size);
void* memcpy(void *dst, const void *src, unsigned size);
 
char* strchr(char* s, int c);
unsigned int strlen ( char * str );
 
#endif
/programs/games/heliothryx/game/rs/rsplatform.h
40,22 → 40,26
#define RS_KEY_X 45
 
 
unsigned int get_time();
 
 
typedef void RSFUNC0();
typedef void RSFUNC1i(int);
/*typedef void RSFUNC1i(int);
typedef void RSFUNC2i(int,int);
typedef void RSFUNC1i1f(int,float);
typedef void RSFUNC1i1f(int,float); */
 
typedef RSFUNC0 *PRSFUNC0;
typedef RSFUNC1i *PRSFUNC1i;
/*typedef RSFUNC1i *PRSFUNC1i;
typedef RSFUNC2i *PRSFUNC2i;
typedef RSFUNC1i1f *PRSFUNC1i1f;
typedef RSFUNC1i1f *PRSFUNC1i1f;*/
 
 
/*
void NullFunc0();
void NullFunc1i(int i);
void NullFunc2i(int i, int j);
void NullFunc1i1f(int i, float f);
 
*/
 
typedef struct rs_app_t {
 
62,21 → 66,26
unsigned short app_time;
unsigned short delta_time;
 
PRSFUNC2i OnSize;
/*
 
PRSFUNC2i OnKeyDown;
PRSFUNC1i OnKeyUp;
 
PRSFUNC2i OnMouseDown;
PRSFUNC2i OnMouseUp;
 
PRSFUNC0 OnAppProcess;
PRSFUNC0 rsAppOnInitDisplay;
PRSFUNC0 rsAppOnTermDisplay;
 
*/
 
} rs_app_t;
 
extern rs_app_t rs_app;
 
void rsAppZero();
//void rsAppZero();
 
 
 
/programs/games/heliothryx/game/rs/rsplatform_kos.c
240,5 → 240,3
 
kol_exit();
}
 
 
/programs/games/heliothryx/game/rsgame.c
24,6 → 24,7
#endif
 
 
 
rs_game_t game;
 
 
162,6 → 163,24
for (i = 0; i < snd->length_samples; i++) {
snd->data[i] = ( 1.0 - 1.0*i/snd->length_samples ) * sin( ( (1.0 - 0.48*i/snd->length_samples) * freq ) *i) * amp;
};
/*
// ok
rs_sgen_init(2, snd->length_samples);
rs_sgen_func_pm(1, 880.0, 21.0, 0.3, 110.0, 0.3);
rs_sgen_func_normalize(1, 1.0);
rs_sgen_func_lowpass(0, 1, 1.0, 0.0, 1.0);
rs_sgen_wave_out(0);
memcpy(snd->data, rs_sgen_reg.wave_out, snd->length_samples*2 );
rs_sgen_term();
*/
rskos_snd_update_buffer(&snd->hbuf, snd->data, snd->length_samples);
};
 
196,7 → 215,7
game.status = STATUS_MENU;
game.window_scale = 2;
#ifdef RS_LINUX
#ifndef RS_KOS
game.window_scale = 3;
window_scale_str[3] = '3';
#endif
421,7 → 440,7
rs_gen_term();
 
#ifdef RS_LINUX
#ifndef RS_KOS
rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 0);
#endif
 
446,7 → 465,7
 
DEBUG10("--- Game Term ---");
 
#ifdef RS_LINUX
#ifndef RS_KOS
rs_audio_term();
#endif
 
511,6 → 530,7
 
if ( (game.menu_index == MENU_SETTINGS) && (game.menu_item_index == MENU_ITEM_WINDOW_SCALE) ) {
game_change_window_scale(-1);
game_ding(1);
};
 
//PlayBuffer(hBuff, 0);
520,6 → 540,7
if ( (game.menu_index == MENU_SETTINGS) && (game.menu_item_index == MENU_ITEM_WINDOW_SCALE) ) {
game_change_window_scale(1);
game_ding(1);
};
 
//StopBuffer(hBuff);
591,7 → 612,17
 
};
 
void GameMouseDown(int x, int y) {
game.tx = x;
game.ty = y;
DEBUG10f("Mouse Down %d, %d \n", x, y);
};
 
void GameMouseUp(int x, int y) {
//
};
 
 
void game_change_window_scale(int d) {
int scale = window_scale_str[3] - '0';
621,6 → 652,9
rskos_resize_window( GAME_WIDTH * scale, GAME_HEIGHT * scale );
 
window_scale_str[3] = scale + '0';
};
 
void game_ding(int i) {
/programs/games/heliothryx/game/rsgame.h
8,7 → 8,15
 
*/
 
#ifndef RS_LINUX
#ifndef RS_WIN32
#ifndef RS_KOS
#error Please specify platform
#endif
#endif
#endif
 
 
#include "rskos.h"
#include "rs/rsplatform.h"
//#include "rs/rstexture.h"
182,6 → 190,9
void GameKeyDown(int key, int first);
void GameKeyUp(int key);
 
void GameMouseDown(int x, int y);
void GameMouseUp(int x, int y);
 
void game_change_window_scale(int d);
 
#endif // RSGAME_H_INCLUDED
/programs/games/heliothryx/game/rsgamedraw.c
6,9 → 6,9
 
#include "rsnoise.h"
 
#include "strings.h"
 
 
 
void game_draw() {
 
int w = 320;
76,9 → 76,9
texture_draw(&game.framebuffer, &game.tex_rocks[i], 250+80*rs_noise(i,150), 60+60*rs_noise(i,1110), DRAW_MODE_ADDITIVE );
};
game_textout( GAME_WIDTH/2 - 100, 40, 1, "HELIOTHRYX");
game_textout( GAME_WIDTH/2 - 8, 58, 3, "TECHDEMO");
game_textout( 2, GAME_HEIGHT-10, 2, "DEVELOPER: ROMAN SHUVALOV` TOGLIATTI_ 2014");
game_textout( GAME_WIDTH/2 - 100, 40, 1, "HELI0THRYX");
game_textout( GAME_WIDTH/2 - 8, 58, 3, "TECHDEM0");
game_textout( 2, GAME_HEIGHT-10, 2, L_BOTTOM_LINE_DEVELOPER_INFO);
};
}
100,8 → 100,8
};
};
game_textout( 2, 2, 2, "THIS IS TECHDEMO` ");
game_textout( 2, 12, 2, "USE ARROWS TO MOVE_ <A> TO SHOOT_ <ESC> TO EXIT` ");
game_textout( 2, 2, 2, L_TECHDEMO_LINE1 );
game_textout( 2, 12, 2, L_TECHDEMO_LINE2 );
};
 
/programs/games/heliothryx/game/rsgamemenu.c
4,6 → 4,8
 
#include "rskos.h"
 
#include "strings.h"
 
PRSFUNC0 menu_actions[] = {
/* a */ &menu_action_start,
/* b */ &menu_action_exit,
12,27 → 14,38
 
char window_scale_str[] = "c< 2X >";
 
/*
First char:
- letter a...z means action (a = 0th, b = 1st, c = 2nd, see menu_actions[] above)
- number 0...9 means goto menu #0, #1, #2... see menu_titles[] below
- space ' ' means no action, menu item is unselectable
- empty string "" is now allowed and can cause segfault
String from second char is label of menu item
 
*/
 
 
char* menu_main_titles[] = {
"a5TART",
"15ETTING5",
"2ABOUT",
"bQUIT",
"a"L_START,
"1"L_SETTINGS,
"2"L_ABOUT,
"b"L_QUIT,
0
};
 
char* menu_settings_titles[] = {
" WINDOW SCALE:",
" "L_WINDOW_SCALE,
window_scale_str,
" ",
"0DONE",
"0"L_DONE,
0
};
 
char* menu_about_titles[] = {
" DEVELOPED BY",
" ROMAN SHUVALOV",
" "L_DEVELOPED_BY,
" "L_ROMAN_SHUVALOV,
" ",
"0DONE",
"0"L_DONE,
0
};
 
113,7 → 126,7
};
 
void menu_action_exit() {
#ifndef RS_LINUX
#ifdef RS_KOS
GameTerm();
#endif
rskos_exit();
/programs/games/heliothryx/game/rsgametext.c
217,7 → 217,7
11, 25,
6, 0,
 
// 31 not implemented
// 31 not implemented - need to create up-left DOT for percent(%) sign
16, 26-16,
16, 26+16,
16, 26,
226,8 → 226,8
 
};
 
uint32_t ch_seg[64] = {
0b00111111, // // for cross-line in O | 1<<12 | 1<<19, // 0
unsigned int ch_seg[64] = {
0b00111111 /* | 1<<12 | 1<<19 */, // 0 or O
1<<26 | 1<<8 | 1<<9 | 1<<3, // 1
0b01011011, // 2
1<<0 | 1<<12 | 1<<15 | 1<<2 | 1<<3, // 3
261,12 → 261,12
1<<5 | 1<<4 | 1<<3, // L
1<<5 | 1<<4 | 1<<1 | 1<<2 | 1<<16 | 1<<12, // M
1<<5 | 1<<4 | 1<<16 | 1<<11 | 1<<1 | 1<<2, // N
0b00111111, // O
1<<16 | 1<<11 | 1<<19 | 1<<12 | 1<<6 | 1<<8 | 1<<9, // O - FREE SYMBOL
 
1<<4 | 1<<5 | 1<<0 | 1<<1 | 1<<6, // P
1<<0 | 1<<1 | 1<<13 | 1<<27 | 1<<4 | 1<<5 | 1<<11, // Q // old: 0b00111111 | 1<<11, // Q
1<<0 | 1<<1 | 1<<6 | 1<<5 | 1<<4 | 1<<11, // R
0b01101101, // S
(1 << 18 | 1 << 13) | (1 << 29 | 1 << 26) | (1 << 5 | 1 << 2) | (1 << 19 | 1 << 12), // percent(%) sign, s == 5 -> // 0b01101101, // S
1<<0 | 1<<8 | 1<<9, // T
1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5, // U
1<<1 | 1<<13 | 1<<17 | 1<<5, // V
296,7 → 296,7
1<<4 | 1<<18 | 1<<28 | 1<<1 | 1<<2, // l // old symmetric: 1<<4 | 1<<18 | 1<<10 | 1<<2, // l // old: 1<<19 | 1<<12 | 1<<1 | 1<<2, // lЛ
1<<5 | 1<<4 | 1<<3 | 1<<1 | 1<<2 | 1<<9 | 1<<21, // mЩ,
1<<4 | 1<<5 | 1<<0 | 1<<1 | 1<<2, // n
1<<0 | 1<<12 | 1<<15 | 1<<2 | 1<<3, // oЗ
(1<<8 | 1<<9) | 1<<10 | 1<<18, // 'o' for arrow up ^
 
};
 
/programs/games/heliothryx/game/rskos.c
1,6 → 1,6
#include "rskos.h"
 
#ifdef RS_LINUX
#ifndef RS_KOS
 
#include "rs/rstexture.h"
#include "rs/rsgl.h"
/programs/games/heliothryx/game/rskos.h
16,7 → 16,7
// sound
 
#ifndef SNDBUF
#ifdef RS_LINUX
#ifndef RS_KOS
#include "rs/rsaudio.h"
typedef rs_sound_t* SNDBUF;
#else
/programs/games/heliothryx/game/rssoundgen.c
1,13 → 1,17
#include "rssoundgen.h"
 
/*
 
#include "rsnoise.h"
 
#include "rs/rsmx.h"
 
 
#ifdef RS_KOS
#include "rs/rsplatform.h"
#else
#include <stdlib.h>
#include <math.h>
#include <string.h>
#endif
 
rs_sgen_reg_t rs_sgen_reg;
 
454,4 → 458,4
};
};
 
*/
 
/programs/games/heliothryx/game/rssoundgen.h
3,10 → 3,8
 
#include "rsgame.h"
 
/*
//#include "rs/rsaudio.h"
 
#include "rs/rsaudio.h"
 
typedef struct rs_sgen_reg_t {
int wave_length;
int waves_count;
40,6 → 38,6
 
//void rs_gen_func_mult_add_value(int dest, int src, float val_mult, float val_add);
 
*/
 
 
#endif
/programs/games/heliothryx/localization-tool/font.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/heliothryx/localization-tool/index.html
0,0 → 1,201
<html>
 
<head>
<meta charset="utf-8">
<title>Heliothryx Localization Tool: Text Converter</title>
 
<script type="text/javascript">
 
/*
 
Russian (Cyrilic) match:
 
Б b
Г g
Д d
Ж j
З o
И i
Й ^
Л l
П n
Ф f
Ц c
Ч - (4)
Ш h
Щ m
Ъ [
Ы \\
Ь ]
Э e
Ю k
Я a
 
*/
 
function convert() {
ar = new Array;
ar["A"] = "A";
ar["B"] = "B";
ar["C"] = "C";
ar["D"] = "D";
ar["E"] = "E";
ar["F"] = "F";
ar["G"] = "G";
ar["H"] = "H";
ar["I"] = "I";
ar["J"] = "J";
ar["K"] = "K";
ar["L"] = "L";
ar["M"] = "M";
ar["N"] = "N";
ar["O"] = "0";
ar["P"] = "P";
ar["Q"] = "Q";
ar["R"] = "R";
ar["S"] = "5";
ar["T"] = "T";
ar["U"] = "U";
ar["V"] = "V";
ar["W"] = "W";
ar["X"] = "X";
ar["Y"] = "Y";
ar["Z"] = "Z";
ar[" "] = " ";
 
ar["0"] = "0";
ar["1"] = "1";
ar["2"] = "2";
ar["3"] = "3";
ar["4"] = "4";
ar["5"] = "5";
ar["6"] = "6";
ar["7"] = "7";
ar["8"] = "8";
ar["9"] = "9";
 
ar[":"] = ":";
ar[";"] = ";";
ar["<"] = "<";
ar["-"] = "=";
ar[">"] = ">";
ar["?"] = "?";
ar["/"] = "@";
ar["_"] = "_"; // comma (,)
ar["`"] = "`"; // dot (.)
 
// CYRILIC
ar["А"] = "A";
ar["Б"] = "b";
ar["В"] = "B";
ar["Г"] = "g";
ar["Д"] = "d";
ar["Е"] = "E";
ar["Ё"] = "E";
ar["Ж"] = "j";
ar["З"] = "3";
ar["И"] = "i";
ar["Й"] = "^";
ar["К"] = "K";
ar["Л"] = "l";
ar["М"] = "M";
ar["Н"] = "H";
ar["О"] = "0";
ar["П"] = "n";
ar["Р"] = "P";
ar["С"] = "C";
ar["Т"] = "T";
ar["У"] = "Y";
ar["Ф"] = "f";
ar["Х"] = "X";
ar["Ц"] = "c";
ar["Ч"] = "4";
ar["Ш"] = "h";
ar["Щ"] = "m";
ar["Ъ"] = "[";
ar["Ы"] = "\\\\";
ar["Ь"] = "]";
ar["Э"] = "e";
ar["Ю"] = "k";
ar["Я"] = "a";
ar["("] = "<";
ar[")"] = ">";
ar[","] = "_";
ar["."] = "`";
s = document.getElementById("inp").value;
s = s.toUpperCase();
s2 = '';
error = '';
for (i in s) {
if (ar[s[i]] != undefined) {
s2 += ar[s[i]];
}
else {
s2 += "`";
error = 1;
};
};
document.getElementById("outp").value = s2;
document.getElementById("outp2").innerHTML = error ? '(disallowed symbols has been replaced with dot)' : '';
};
 
</script>
 
</head>
 
<body>
 
<h1>Heliothryx Localization Tool: Text Converter</h1>
 
<img align="right" src="font.png" style="margin-right: 1em; margin-bottom: 1em;">
 
 
<p>This is procedural font. To minimize program size, only necessary characters are implemented:</p>
 
<p>
<ul>
<li>Numbers;</li>
<li>Latin characters from A to Z;</li>
<li>Cyrilic (Russian) characters which can't be replaced by matching Latin characters or numeric symbols;</li>
<li>Some punctuation.</li>
</ul>
</p>
 
<p>Actually this is part of ASCII table starting from '0' (0x30). </p>
 
<p>Note that not all latin characters are in fact implemented, for example, 'S' can be successfully replaced by number 5, so other symbol are placed in place of 'S'. Some punctuation symbols are also replaced, for example, dot (.) in ASCII table have 0x2E code which is outside our range, so it is implemented in place of useless grave accent symbol (`). </p>
 
<p>To make process of writing string constants easier, this tool has been made. Write any text to first field, hit Enter and take string that you can use in your code. If you try to use unsupported characters, they will be replaced by dot and you will get warning. </p>
 
 
<div style="clear: both;">&nbsp;</div>
 
<form>
 
<div style="border: 1px solid #99CCAA; padding: 8px; background-color: #CCFFDD; display: table;">
<input size=40 id="inp"> <input type="submit" value="Convert (Enter)" onclick="convert(); return false;"> <br>
<input size=40 id="outp"> <span style="color: red; font-weight: bold;" id="outp2"></span>
</div>
 
</form>
 
<small>Developed by: Roman Shuvalov</small>
 
</body>
 
</html>
/programs/games/heliothryx/readme.utf8.txt
8,3 → 8,9
Heliothryx -- game that is developed for contest.
Developer: Roman Shuvalov (http://board.kolibrios.org/memberlist.php?mode=viewprofile&u=6469)
 
 
For Localization:
 
Text strings are encoded in special format.
Please check out special tool (localization-tool/index.html).
There are instructions and text converter.