Subversion Repositories Kolibri OS

Rev

Rev 5225 | Rev 5291 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5225 Rev 5243
Line 22... Line 22...
22
    
22
    
23
    #include "rs/rskeyboard.h"
23
    #include "rs/rskeyboard.h"
Line -... Line 24...
-
 
24
#endif
24
#endif
25
 
Line 25... Line 26...
25
 
26
 
26
 
27
 
Line 160... Line 161...
160
    int i;
161
    int i;
161
    int amp = 29000;
162
    int amp = 29000;
162
    for (i = 0; i < snd->length_samples; i++) {
163
    for (i = 0; i < snd->length_samples; i++) {
163
		snd->data[i] = ( 1.0 - 1.0*i/snd->length_samples ) * sin( ( (1.0 - 0.48*i/snd->length_samples) * freq ) *i) * amp;
164
		snd->data[i] = ( 1.0 - 1.0*i/snd->length_samples ) * sin( ( (1.0 - 0.48*i/snd->length_samples) * freq ) *i) * amp;
164
	};
165
	};
-
 
166
	
-
 
167
	
-
 
168
	/*
-
 
169
	
-
 
170
	// ok
-
 
171
	
-
 
172
	rs_sgen_init(2, snd->length_samples);
-
 
173
	rs_sgen_func_pm(1, 880.0, 21.0, 0.3, 110.0, 0.3);
-
 
174
	rs_sgen_func_normalize(1, 1.0);
-
 
175
	rs_sgen_func_lowpass(0, 1, 1.0, 0.0, 1.0);
-
 
176
	rs_sgen_wave_out(0);
-
 
177
	
-
 
178
	memcpy(snd->data, rs_sgen_reg.wave_out, snd->length_samples*2 );
-
 
179
	
-
 
180
	rs_sgen_term();
-
 
181
	
-
 
182
	*/
-
 
183
	
165
	rskos_snd_update_buffer(&snd->hbuf, snd->data, snd->length_samples);
184
	rskos_snd_update_buffer(&snd->hbuf, snd->data, snd->length_samples);
166
};
185
};
Line 167... Line 186...
167
 
186
 
168
void soundbuf_play(rs_soundbuf_t *snd) {
187
void soundbuf_play(rs_soundbuf_t *snd) {
Line 194... Line 213...
194
    game.bullet_index = 0;
213
    game.bullet_index = 0;
Line 195... Line 214...
195
    
214
    
Line 196... Line 215...
196
    game.status = STATUS_MENU;
215
    game.status = STATUS_MENU;
197
    
216
    
198
    game.window_scale = 2;
217
    game.window_scale = 2;
199
    #ifdef RS_LINUX
218
    #ifndef RS_KOS
200
        game.window_scale = 3;
219
        game.window_scale = 3;
Line 201... Line 220...
201
        window_scale_str[3] = '3';
220
        window_scale_str[3] = '3'; 
Line 419... Line 438...
419
        memcpy(game.tex_rocks[i].data, rs_gen_reg.tex_out, rock_size*rock_size*4 );
438
        memcpy(game.tex_rocks[i].data, rs_gen_reg.tex_out, rock_size*rock_size*4 );
420
    };
439
    };
421
    rs_gen_term();
440
    rs_gen_term();
Line 422... Line 441...
422
    
441
    
423
 
442
 
424
    #ifdef RS_LINUX
443
    #ifndef RS_KOS
Line 425... Line 444...
425
        rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 0); 
444
        rs_audio_init(RS_AUDIO_FMT_MONO16, RS_AUDIO_FREQ_16000, 0); 
426
    #endif
445
    #endif
Line 444... Line 463...
444
void GameTerm() {
463
void GameTerm() {
Line 445... Line 464...
445
 
464
 
Line 446... Line 465...
446
 
465
 
447
    DEBUG10("--- Game Term ---");
466
    DEBUG10("--- Game Term ---");
448
 
467
 
Line 449... Line 468...
449
    #ifdef RS_LINUX
468
    #ifndef RS_KOS
Line 509... Line 528...
509
            case RS_KEY_LEFT:
528
            case RS_KEY_LEFT:
510
                BIT_SET(game.keyboard_state, RS_ARROW_LEFT_MASK);
529
                BIT_SET(game.keyboard_state, RS_ARROW_LEFT_MASK);
Line 511... Line 530...
511
 
530
 
512
                if ( (game.menu_index == MENU_SETTINGS) && (game.menu_item_index == MENU_ITEM_WINDOW_SCALE) ) {
531
                if ( (game.menu_index == MENU_SETTINGS) && (game.menu_item_index == MENU_ITEM_WINDOW_SCALE) ) {
-
 
532
                    game_change_window_scale(-1);
513
                    game_change_window_scale(-1);
533
                    game_ding(1);
Line 514... Line 534...
514
                };
534
                };
515
 
535
 
516
                //PlayBuffer(hBuff, 0);
536
                //PlayBuffer(hBuff, 0);
517
                break;
537
                break;
Line 518... Line 538...
518
            case RS_KEY_RIGHT:
538
            case RS_KEY_RIGHT:
519
                BIT_SET(game.keyboard_state, RS_ARROW_RIGHT_MASK);
539
                BIT_SET(game.keyboard_state, RS_ARROW_RIGHT_MASK);
-
 
540
                
520
                
541
                if ( (game.menu_index == MENU_SETTINGS) && (game.menu_item_index == MENU_ITEM_WINDOW_SCALE) ) {
Line 521... Line 542...
521
                if ( (game.menu_index == MENU_SETTINGS) && (game.menu_item_index == MENU_ITEM_WINDOW_SCALE) ) {
542
                    game_change_window_scale(1);
522
                    game_change_window_scale(1);
543
                    game_ding(1);
523
                };
544
                };
Line 589... Line 610...
589
            break;
610
            break;
590
    };
611
    };
Line 591... Line 612...
591
 
612
 
Line -... Line 613...
-
 
613
};
-
 
614
 
-
 
615
void GameMouseDown(int x, int y) {
-
 
616
    game.tx = x;
-
 
617
    game.ty = y;
-
 
618
    DEBUG10f("Mouse Down %d, %d \n", x, y);
-
 
619
};
-
 
620
 
-
 
621
void GameMouseUp(int x, int y) {
-
 
622
    //
Line 592... Line 623...
592
};
623
};
593
 
624
 
Line 594... Line 625...
594
 
625
 
Line 619... Line 650...
619
    
650
    
Line 620... Line 651...
620
    
651
    
-
 
652
    rskos_resize_window( GAME_WIDTH * scale, GAME_HEIGHT * scale );
-
 
653
 
-
 
654
    window_scale_str[3] = scale + '0';
621
    rskos_resize_window( GAME_WIDTH * scale, GAME_HEIGHT * scale );
655
    
Line 622... Line 656...
622
 
656
    
Line 623... Line 657...
623
    window_scale_str[3] = scale + '0';
657