mirror of https://github.com/fltk/fltk
Fix remaining VS compiler warnings in test programs
This commit is contained in:
parent
f0ff8a5083
commit
5810edaf84
|
@ -60,9 +60,9 @@
|
|||
// (b) click on a "normal block", destroy this one and adjacent blocks
|
||||
// (c) click on a "bomb", destroy all blocks of the same color
|
||||
|
||||
#define LEVEL_FACTOR 0.90 // was: 0.95
|
||||
#define NORMAL_FACTOR 0.999
|
||||
#define BOMB_FACTOR 0.995
|
||||
#define LEVEL_FACTOR 0.900f // was: 0.95
|
||||
#define NORMAL_FACTOR 0.999f
|
||||
#define BOMB_FACTOR 0.995f
|
||||
|
||||
// Set this to 1 to debug the timer callback (should be 0)
|
||||
#define DEBUG_TIMER 0
|
||||
|
@ -309,8 +309,8 @@ BlockSound::BlockSound() {
|
|||
|
||||
for (int j = max_sample; j > 0; j --, sample_ptr ++) {
|
||||
float freq = (float)j / (float)max_sample;
|
||||
float volume = 32767.0 * (0.5 * sqrt(freq) + 0.5);
|
||||
float sample = 0.0001 * ((rand() % 20001) - 10000);
|
||||
float volume = float(32767.0 * (0.5 * sqrt(freq) + 0.5));
|
||||
float sample = float(0.0001 * ((rand() % 20001) - 10000));
|
||||
|
||||
*sample_ptr = (int)(volume * freq * sample +
|
||||
(1.0 - freq) * sample_ptr[-2]);
|
||||
|
@ -785,12 +785,12 @@ int BlockWindow::handle(int event) {
|
|||
count --;
|
||||
|
||||
if (b->bomb) {
|
||||
sound_->play_explosion(0.19 + 0.005 * count);
|
||||
sound_->play_explosion(float(0.19 + 0.005 * count));
|
||||
|
||||
interval_ *= BOMB_FACTOR;
|
||||
score_ += count;
|
||||
} else {
|
||||
sound_->play_explosion(0.09 + 0.005 * count);
|
||||
sound_->play_explosion(float(0.09 + 0.005 * count));
|
||||
|
||||
interval_ *= NORMAL_FACTOR;
|
||||
score_ += count * count;
|
||||
|
@ -841,11 +841,11 @@ void BlockWindow::init() {
|
|||
// Start a new game...
|
||||
void BlockWindow::new_game() {
|
||||
// Seed the random number generator...
|
||||
srand(time(NULL));
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
init();
|
||||
|
||||
interval_ = 0.1;
|
||||
interval_ = 0.1f;
|
||||
opened_columns_ = 0;
|
||||
|
||||
strcpy(title_, "Level: 1");
|
||||
|
@ -1006,7 +1006,7 @@ void BlockWindow::timeout_cb(BlockWindow *bw) {
|
|||
|
||||
if (bw->num_columns_ == BLOCK_COLS) {
|
||||
bw->interval_ = -1.0;
|
||||
bw->sound_->play_explosion(0.8);
|
||||
bw->sound_->play_explosion(0.8f);
|
||||
bw->play_button_->label("@>");
|
||||
} else {
|
||||
bw->opened_columns_ ++;
|
||||
|
|
|
@ -658,8 +658,8 @@ void find2_cb(Fl_Widget* w, void* v) {
|
|||
int found = textbuf->search_forward(pos, e->search, &pos);
|
||||
if (found) {
|
||||
// Found a match; select and update the position...
|
||||
textbuf->select(pos, pos+strlen(e->search));
|
||||
e->editor->insert_position(pos+strlen(e->search));
|
||||
textbuf->select(pos, pos + (int)strlen(e->search));
|
||||
e->editor->insert_position(pos + (int)strlen(e->search));
|
||||
e->editor->show_insert_position();
|
||||
}
|
||||
else fl_alert("No occurrences of \'%s\' found!", e->search);
|
||||
|
@ -773,11 +773,11 @@ void replace2_cb(Fl_Widget*, void* v) {
|
|||
|
||||
if (found) {
|
||||
// Found a match; update the position and replace text...
|
||||
textbuf->select(pos, pos+strlen(find));
|
||||
textbuf->select(pos, pos + (int)strlen(find));
|
||||
textbuf->remove_selection();
|
||||
textbuf->insert(pos, replace);
|
||||
textbuf->select(pos, pos+strlen(replace));
|
||||
e->editor->insert_position(pos+strlen(replace));
|
||||
textbuf->select(pos, pos + (int)strlen(replace));
|
||||
e->editor->insert_position(pos + (int)strlen(replace));
|
||||
e->editor->show_insert_position();
|
||||
}
|
||||
else fl_alert("No occurrences of \'%s\' found!", find);
|
||||
|
@ -807,10 +807,10 @@ void replall_cb(Fl_Widget*, void* v) {
|
|||
|
||||
if (found) {
|
||||
// Found a match; update the position and replace text...
|
||||
textbuf->select(pos, pos+strlen(find));
|
||||
textbuf->select(pos, pos + (int)strlen(find));
|
||||
textbuf->remove_selection();
|
||||
textbuf->insert(pos, replace);
|
||||
e->editor->insert_position(pos+strlen(replace));
|
||||
e->editor->insert_position(pos + (int)strlen(replace));
|
||||
e->editor->show_insert_position();
|
||||
times++;
|
||||
}
|
||||
|
|
|
@ -754,11 +754,11 @@ void MenuInit(void)
|
|||
/***************************************************************/
|
||||
|
||||
// FLTK-style callbacks to Glut menu callback translators:
|
||||
void setlevel(Fl_Widget*, void *value) {setlevel(fl_intptr_t(value));}
|
||||
void setlevel(Fl_Widget*, void *value) {setlevel(fl_int(value));}
|
||||
|
||||
void choosefract(Fl_Widget*, void *value) {choosefract(fl_intptr_t(value));}
|
||||
void choosefract(Fl_Widget*, void *value) {choosefract(fl_int(value));}
|
||||
|
||||
void handlemenu(Fl_Widget*, void *value) {handlemenu(fl_intptr_t(value));}
|
||||
void handlemenu(Fl_Widget*, void *value) {handlemenu(fl_int(value));}
|
||||
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
|
|
Loading…
Reference in New Issue