From 32a7b22bdf44a62e2a128f8d31c96274ec735dba Mon Sep 17 00:00:00 2001 From: mirac Date: Tue, 26 Nov 2013 20:39:38 +0100 Subject: [PATCH] license fix, prerelease HA version 1.1b --- HomeLESS_Hit_Analyzer/GUI_methods.pde | 415 +++++++++ .../HomeLESS_Hit_Analyzer.pde | 166 ++++ HomeLESS_Hit_Analyzer/System_methods.pde | 839 ++++++++++++++++++ .../ballistics/01_AAS400_Hawke_16J.bal | 22 + .../ballistics/ballistics.txt | 43 + HomeLESS_Hit_Analyzer/ballistics_methods.pde | 28 + HomeLESS_Hit_Analyzer/files_methods.pde | 654 ++++++++++++++ HomeLESS_Hit_Analyzer/gpl-2.0.txt | 138 +++ HomeLESS_Hit_Analyzer/graphics/arrow_down.png | Bin 0 -> 197 bytes .../graphics/arrow_down_1.png | Bin 0 -> 197 bytes .../graphics/arrow_down_2.png | Bin 0 -> 197 bytes .../graphics/arrow_down_3.png | Bin 0 -> 196 bytes HomeLESS_Hit_Analyzer/graphics/arrow_left.png | Bin 0 -> 196 bytes .../graphics/arrow_left_1.png | Bin 0 -> 196 bytes .../graphics/arrow_left_2.png | Bin 0 -> 197 bytes .../graphics/arrow_left_3.png | Bin 0 -> 197 bytes .../graphics/arrow_right.png | Bin 0 -> 197 bytes .../graphics/arrow_right_1.png | Bin 0 -> 197 bytes .../graphics/arrow_right_2.png | Bin 0 -> 199 bytes .../graphics/arrow_right_3.png | Bin 0 -> 199 bytes HomeLESS_Hit_Analyzer/graphics/arrow_up.png | Bin 0 -> 187 bytes HomeLESS_Hit_Analyzer/graphics/arrow_up_1.png | Bin 0 -> 187 bytes HomeLESS_Hit_Analyzer/graphics/arrow_up_2.png | Bin 0 -> 187 bytes HomeLESS_Hit_Analyzer/graphics/arrow_up_3.png | Bin 0 -> 186 bytes .../graphics/correction_reset_1.png | Bin 0 -> 188 bytes .../graphics/correction_reset_2.png | Bin 0 -> 189 bytes .../graphics/correction_reset_3.png | Bin 0 -> 189 bytes HomeLESS_Hit_Analyzer/graphics/minus_1.png | Bin 0 -> 157 bytes HomeLESS_Hit_Analyzer/graphics/minus_2.png | Bin 0 -> 157 bytes HomeLESS_Hit_Analyzer/graphics/minus_3.png | Bin 0 -> 156 bytes HomeLESS_Hit_Analyzer/graphics/plus_1.png | Bin 0 -> 176 bytes HomeLESS_Hit_Analyzer/graphics/plus_2.png | Bin 0 -> 176 bytes HomeLESS_Hit_Analyzer/graphics/plus_3.png | Bin 0 -> 176 bytes .../graphics/scale_reset_1.png | Bin 0 -> 244 bytes .../graphics/scale_reset_2.png | Bin 0 -> 245 bytes .../graphics/scale_reset_3.png | Bin 0 -> 244 bytes .../graphics/scroll_down_1.png | Bin 0 -> 236 bytes .../graphics/scroll_down_2.png | Bin 0 -> 236 bytes .../graphics/scroll_down_3.png | Bin 0 -> 236 bytes .../graphics/scroll_up_1.png | Bin 0 -> 214 bytes .../graphics/scroll_up_2.png | Bin 0 -> 214 bytes .../graphics/scroll_up_3.png | Bin 0 -> 215 bytes .../graphics/sensitivity_down_1.png | Bin 0 -> 240 bytes .../graphics/sensitivity_up_1.png | Bin 0 -> 266 bytes HomeLESS_Hit_Analyzer/ha.ini | 17 + HomeLESS_Hit_Analyzer/languages/english.lng | 28 + HomeLESS_Hit_Analyzer/targets/airgun_cz.tgt | 13 + HomeLESS_Hit_Analyzer/targets_methods.pde | 406 +++++++++ HomeLESS_Hit_Analyzer_license.txt | 1 - gpl-2.0.txt | 138 +++ 50 files changed, 2907 insertions(+), 1 deletion(-) create mode 100644 HomeLESS_Hit_Analyzer/GUI_methods.pde create mode 100644 HomeLESS_Hit_Analyzer/HomeLESS_Hit_Analyzer.pde create mode 100644 HomeLESS_Hit_Analyzer/System_methods.pde create mode 100644 HomeLESS_Hit_Analyzer/ballistics/01_AAS400_Hawke_16J.bal create mode 100644 HomeLESS_Hit_Analyzer/ballistics/ballistics.txt create mode 100644 HomeLESS_Hit_Analyzer/ballistics_methods.pde create mode 100644 HomeLESS_Hit_Analyzer/files_methods.pde create mode 100644 HomeLESS_Hit_Analyzer/gpl-2.0.txt create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_down.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_down_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_down_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_down_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_left.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_left_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_left_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_left_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_right.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_right_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_right_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_right_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_up.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_up_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_up_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/arrow_up_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/correction_reset_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/correction_reset_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/correction_reset_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/minus_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/minus_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/minus_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/plus_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/plus_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/plus_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scale_reset_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scale_reset_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scale_reset_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scroll_down_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scroll_down_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scroll_down_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scroll_up_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scroll_up_2.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/scroll_up_3.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/sensitivity_down_1.png create mode 100644 HomeLESS_Hit_Analyzer/graphics/sensitivity_up_1.png create mode 100644 HomeLESS_Hit_Analyzer/ha.ini create mode 100644 HomeLESS_Hit_Analyzer/languages/english.lng create mode 100644 HomeLESS_Hit_Analyzer/targets/airgun_cz.tgt create mode 100644 HomeLESS_Hit_Analyzer/targets_methods.pde delete mode 100644 HomeLESS_Hit_Analyzer_license.txt create mode 100644 gpl-2.0.txt diff --git a/HomeLESS_Hit_Analyzer/GUI_methods.pde b/HomeLESS_Hit_Analyzer/GUI_methods.pde new file mode 100644 index 0000000..6c744c0 --- /dev/null +++ b/HomeLESS_Hit_Analyzer/GUI_methods.pde @@ -0,0 +1,415 @@ +/* +This GUI_methods.pde is part of HomeLESS Hit Analyzer. + +HomeLESS Hit Analyzer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or any later version. + +HomeLESS: Hit Analyzer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with . If not, see . +*/ +public int x_position, y_position, lenght; +public int backround_color = 180; +public int video_width = 640, video_height = 480; +public int x_window_size, y_window_size; +//language pack +public String s_Correction,s_Caliber,s_Infobox,s_Duration,s_Targets_list,s_New_shoot,s_Target_select,s_Sound,s_SLH,s_Lets_fire,s_Time,s_Reset,s_Export,s_Points,s_Hits,s_Total,s_Target,s_About,s_found_target_files, s_Save, s_Shooting_style, s_Training, s_Sport, s_Combat, s_Hunting, s_Shooter; +public String s_shooting_time, s_shooting_prepare; +String[] images; + + + +public void create_window() +{ + if(video_height == 480) //640*480 + { + x_window_size = video_width + 330; + y_window_size = video_height + 160; + } + else // higher resolution + { + x_window_size = video_width + 340; + y_window_size = video_height + 130; + } + size(x_window_size, y_window_size); + background(backround_color); + frameRate(30); + float f_video_width = video_width; + float f_video_height = video_height; + f_resolution_ratio = (f_video_width / f_video_height); +}; + + + + +public void create_correction_buttons() +{ + x_position = video_width + 60; + y_position = 105; + fill(0, 0, 0, 255); + textSize(16); + text(s_Correction, x_position -30 , y_position - 55, 200, 30); + + //off over click + images = new String[]{ "graphics/arrow_up_1.png", "graphics/arrow_up_2.png", "graphics/arrow_up_3.png" }; + btnCorrection_up = new GImageButton(this,"arrow_up",images, x_position, y_position - 30); + btnCorrection_up.tag = "Correction_up"; + + images = new String[]{ "graphics/arrow_left_1.png", "graphics/arrow_left_2.png", "graphics/arrow_left_3.png" }; + btnCorrection_left = new GImageButton(this,"arrow_left",images, x_position - 30, y_position); + btnCorrection_left.tag = "Correction_left"; + + images = new String[]{ "graphics/arrow_down_1.png", "graphics/arrow_down_2.png", "graphics/arrow_down_3.png" }; + btnCorrection_down = new GImageButton(this,"arrow_down",images, x_position, y_position); + btnCorrection_down.tag = "Correction_down"; + + images = new String[]{ "graphics/arrow_right_1.png", "graphics/arrow_right_2.png", "graphics/arrow_right_3.png" }; + btnCorrection_right = new GImageButton(this,"arrow_right",images, x_position + 30 , y_position); + btnCorrection_right.tag = "Correction_right"; + + images = new String[]{ "graphics/minus_1.png", "graphics/minus_2.png", "graphics/minus_3.png" }; + btnMinus = new GImageButton(this,"minus",images, x_position - 30 , y_position - 30); + btnMinus.tag = "Correction_minus"; + + images = new String[]{ "graphics/plus_1.png", "graphics/plus_2.png", "graphics/plus_3.png" }; + btnPlus = new GImageButton(this,"plus",images, x_position + 30 , y_position - 30); + btnPlus.tag = "Correction_plus"; + + images = new String[]{ "graphics/scale_reset_1.png", "graphics/scale_reset_2.png", "graphics/scale_reset_3.png" }; + btnScale_reset = new GImageButton(this,"scale_reset",images, x_position + 60 , y_position - 30); + btnScale_reset.tag = "Reset_scale"; + + images = new String[]{ "graphics/correction_reset_1.png", "graphics/correction_reset_2.png", "graphics/correction_reset_3.png" }; + btnCorrection_reset = new GImageButton(this,"correction_reset",images, x_position + 60 , y_position); + btnCorrection_reset.tag = "Correction_reset"; + + +}; + + +public void create_sensitivity_buttons() +{ + + x_position = video_width + 30; + y_position = 140; + fill(0, 0, 0, 255); + textSize(16); + text(s_Sensitivity, x_position, y_position, 200, 30); + + images = new String[]{ "graphics/sensitivity_down_1.png", "graphics/sensitivity_down_2.png", "graphics/sensitivity_down_3.png" }; + btnSensitivity_down = new GImageButton(this,"sensitivity_down",images, x_position, y_position +25); + btnSensitivity_down.tag = "Sensitivity_down"; + + images = new String[]{ "graphics/sensitivity_up_1.png", "graphics/sensitivity_up_2.png", "graphics/sensitivity_up_3.png" }; + btnSensitivity_up = new GImageButton(this,"sensitivity_down",images, x_position +30, y_position +25); + btnSensitivity_up.tag = "Sensitivity_up"; +} + + +public void create_shooting_conditions() +{ + x_position = video_width + 170; + y_position = 75; + fill(0, 0, 0, 255); + textSize(16); + text(s_Conditions, x_position-5, y_position -25, 200, 30); + text(s_Caliber, x_position, y_position, 200, 30); + txtCaliber = new GTextField(this, String.valueOf(txt_projectile_diameter), x_position + 80, y_position, 60, 20); + txtCaliber.addEventHandler(this, "handle_txtCaliber"); + text(s_Time, x_position, y_position +30, 200, 30); + txtShooting_Time = new GTextField(this, String.valueOf(f_shooting_time), x_position + 80 , y_position + 30, 60, 20); + txtShooting_Time.addEventHandler(this, "handle_txtShooting_Time"); + text(s_Duration, x_position, y_position + 60, 200, 30); + txtDuration = new GTextField(this, String.valueOf(duration), x_position + 80, y_position + 60, 60, 20); + txtDuration.addEventHandler(this, "handle_txtDuration"); + +}; + +public void create_target_selection_combo() +{ + x_position = video_width + 160; + y_position = 200; + fill(0, 0, 0, 255); + textSize(16); + cboTarget_selection = new GCombo(this, s_targets_names, 3, x_position, y_position, 150); + text(s_Target_select, x_position - 130 , y_position , 130, 30); + + + for (int i = 1 ; i <= i_number_of_tgt_files; i++) // get index of selected target + { + + if(s_selected_target_name.equals(s_targets_names[i])) + { + cboTarget_selection.setSelected(i-1); + } + } + + + //cboTarget_selection.setSelected(0); + +}; + + +public void create_button_save_changes() +{ + x_position = video_width + 30; + y_position = 235; + fill(0, 0, 0, 255); + textSize(16); + btnSave = new GButton(this, s_Save , x_position, y_position, 120, 25); + btnSave.tag = "Save"; +}; + + + + +public void create_shooting_style_option() + { + + + x_position = video_width + 30; + y_position = 295; + fill(0, 0, 0, 255); + textSize(16); + + text(s_Shooting_style, x_position , y_position - 25, 200, 30); + + //training - no shootlog + text(s_Training, x_position +20, y_position, 200, 30); + optTraining = new GOption(this, "", x_position, y_position, 120); + //sport + text(s_Sport, x_position +20 , y_position + 25, 200, 30); + optSport = new GOption(this, "", x_position, y_position + 25, 120); + //combat + text(s_Combat, x_position +125 , y_position, 200, 30); + optCombat = new GOption(this, "", x_position + 100, y_position, 120); + //hunting + text(s_Hunting, x_position +125 , y_position + 25, 200, 30); + optHunting = new GOption(this, "", x_position + 100, y_position + 25, 120); + optGroup_shooting_style.addOption(optTraining); + optGroup_shooting_style.addOption(optSport); + optGroup_shooting_style.addOption(optCombat); + optGroup_shooting_style.addOption(optHunting); + if(shooting_style == 1) + { + optTraining.setSelected(true); + } + if(shooting_style == 2) + { + optSport.setSelected(true); + } + if(shooting_style == 3) + { + optCombat.setSelected(true); + } + if(shooting_style == 4) + { + optHunting.setSelected(true); + } + + }; + +public void createWindowTargetsList() +{ + x_position = 10; + y_position = 20; + windowTargetsList = new GWindow[1]; + windowTargetsList[0] = new GWindow(this, s_Targets_list, x_position, y_position,200,200,false, JAVA2D); + windowTargetsList[0].setBackground(backround_color +30); + windowTargetsList[0].addDrawHandler(this, "windowDraw"); + windowTargetsList[0].addMouseHandler(this, "windowMouse"); + //windowDraw(); +} + + +public void create_sound_option() +{ + x_position = video_width + 30; + y_position = 170; + fill(0, 0, 0, 255); + textSize(16); + cbxSound = new GCheckbox(this,"", x_position, y_position, 15); + text(s_Sound, x_position + 15 , y_position - 2, 150, 30); + cbxSound.setBorder(0); + if(b_sound) + { + cbxSound.setSelected(true); + } + else + cbxSound.setSelected(false); +}; + + + +public void create_button_Lets_Fire() +{ + x_position = video_width + 30; + y_position = 350; + btnLetsFire = new GButton(this, s_Lets_fire , x_position, y_position, 110, 25); + btnLetsFire.tag = "Let's fire"; +}; + +public void create_button_Reset_Values() +{ + x_position = video_width + 230; + y_position = 350; + btnReset = new GButton(this, s_Reset , x_position, y_position, 80, 25); + btnReset.tag = "Reset"; +}; + + +public void create_ShootLog_interface() +{ + x_position = video_width + 30; + y_position = 420; + textSize(16); + text(s_Infobox, x_position , y_position -25, 100, 25); + txtShootLog = new GTextField(this, "", x_position, y_position, 280, 150, true); + txtShootLog.addEventHandler(this, "handle_txtShootLog"); + + text(s_Shooter, x_position , y_position + 156, 120, 25); + txtShootlog_filename = new GTextField(this, "Anonymous", x_position +70 , y_position +155, 120, 25); + txtShootlog_filename.addEventHandler(this, "handle_txtShootlog_filename"); + + btnExport = new GButton(this, s_Export , x_position + 200, y_position +155, 80, 25); + btnExport.tag = "Export"; + + + images = new String[]{ "graphics/scroll_up_1.png", "graphics/scroll_up_2.png", "graphics/scroll_up_3.png" }; + btnScrollUp = new GImageButton(this,"ScrollUp",images, x_position + 256 , y_position); + btnScrollUp.tag = "ScrollUp"; + + + images = new String[]{ "graphics/scroll_down_1.png", "graphics/scroll_down_2.png", "graphics/scroll_down_3.png" }; + btnScrollDown = new GImageButton(this,"scroll_down",images, x_position + 256 , y_position +126); + btnScrollDown.tag = "ScrollUp"; + + //first claering shootlog file + for(int index = 0; index < 145; index++) + { + s_shoot_logs[index] = ""; + } + + +}; + + +public void draw_current_target() +{ + x_position = video_X_offset; + y_position = 0; + fill(backround_color); + rect(x_position, y_position, 520, video_Y_offset); + textSize(40); + fill(0, 170, 30, 255); + text(s_Target + target_name, x_position, y_position, 600, 100); +}; + +public void draw_time() +{ + + x_position = video_width + 30; + y_position = 0; + fill(backround_color); + rect(x_position, y_position, 260, video_Y_offset); + textSize(40); + fill(0, 170, 30, 255); + text(s_Time, x_position , y_position , 230, 50); + fill(255, 0, 0, 255); + convert_time(); + text(s_shooting_time, x_position + 140 , y_position , 230, 50); +} + +public void draw_count() +{ + x_position = 260; + y_position = 160; + fill(0, 0, 0, 255); + //textSize(24); + textSize(200); + text("" + count, x_position, y_position, 600, 300); +} + +public void draw_stats() +{ + x_position = 10; + y_position = video_height + video_Y_offset; + fill(backround_color); + if(video_height == 480) + { + rect(x_position, y_position, 640, 100); //640*480 + } + else + { + rect(x_position, y_position, 800, 50); //800*600 + } + textSize(40); + fill(0, 170, 30, 255); + //text(s_Points, x_position, y_position, 250, 300); + text(s_Points, x_position, y_position, 250, 300); + text(s_Hits, x_position + 220, y_position, 250, 300); + text(s_Total, x_position + 410, y_position, 250, 300); + fill(255, 0, 0, 255); + + + + if(b_Shooting && b_show_last_hit) // show last hit points + { + + // sign for the last hit + //fill(0, 0, 180, 255); + text("" + round(hit_points_last), x_position +155, y_position, 250, 300); + //ellipse(x_position +145, y_position +30, 10, 10); + } + else // show actual hit points + { + fill(0, 0, 160, 255); //blue + text("" + round(hit_points_actual), x_position +155, y_position, 250, 300); + //ellipse(x_position +145, y_position +30, 10, 10); + }; + + fill(255, 0, 0, 255); + text("" + hit_counter, x_position + 330, y_position, 250, 300); + text("" + hit_points_sum, x_position +540, y_position, 250, 300); +}; + +public void create_about_text() +{ + x_position = x_window_size - 320; + y_position = y_window_size -25; + textSize(16); + text(s_About, x_position , y_position , 350, 50); +}; + +public void draw_sensitivity() +{ + if(b_Configure == true) + { + //x_position = video_width +video_X_offset - 250 ; + //y_position = video_height + video_Y_offset - 25; + x_position = video_X_offset + 10; + y_position = video_Y_offset + 8; + fill(255, 0, 0, 255); + textSize(24); + text(s_Sensitivity + nf(i_sensitivity,2) , x_position, y_position, 250, 300); + } +} + + + +public void windowDraw(GWinApplet appc) +{ + appc.stroke(255); + appc.strokeWeight(2); + appc.noFill(); + appc.fill(0, 0, 0, 255); + appc.textSize(16); + appc.text("Quit",23,23, 200, 100); + text("Quit",23,23, 200, 100); +}; + diff --git a/HomeLESS_Hit_Analyzer/HomeLESS_Hit_Analyzer.pde b/HomeLESS_Hit_Analyzer/HomeLESS_Hit_Analyzer.pde new file mode 100644 index 0000000..e255d9c --- /dev/null +++ b/HomeLESS_Hit_Analyzer/HomeLESS_Hit_Analyzer.pde @@ -0,0 +1,166 @@ +/* +****************************************** +HomeLESS - Hit Analyzer +Home Laser Shooting Simulator - Hit Analyzer +version 1.1b +by Laabicz +laabicz@gmail.com + +www.homeless-eng.webnode.com + +last rev. 26.11.2013 (dd.mm.yyyy) +****************************************** + +This HomeLESS_Hit_Analyzer.pde is part of HomeLESS Hit Analyzer. + +HomeLESS Hit Analyzer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or any later version. + +HomeLESS: Hit Analyzer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with . If not, see . + */ + + +import codeanticode.gsvideo.*; +import guicomponents.*; +import processing.opengl.*; +import controlP5.*; + + +ControlP5 controlP5; +MultiList l; + + +GSCapture video; + + +GCheckbox cbxSound, cbxShow_last_hit, cbxDiameter; + +GOptionGroup optGroup_shooting_style = new GOptionGroup(); +GOption optTraining, optSport, optCombat, optHunting; +GButton btnSave, btnNewShot, btnResetValues, btnExport, btnReset, btnLetsFire, btnTargetsList; +GImageButton btnCorrection_down, btnCorrection_up, btnCorrection_left, btnCorrection_right , btnCorrection_reset, btnScale_reset; // correction buttons +GImageButton btnScrollDown, btnScrollUp, btnMinus,btnPlus, btnSensitivity_up, btnSensitivity_down; +GButton btnNextTarget, btnPreviousTarget ; +GTextField txtCaliber, txtShootLog, txtDelay, txtShooting_Time , txtDuration, txtTarget_number, txtShootlog_filename; +GWindow[] windowTargetsList; +GTimer tmrMilisTimer, tmrSecondsTimer_Shooting_Countdown, tmrSecondsTimer_Shooting_Prepare; +GCombo cboTarget_selection; + + + +void setup() +{ + check_basic_files(); + load_ha_ini(); + load_lang_pack(); + create_window(); + load_ballistics_data(); + //load_target_file(); + //set_selected_target_name(target_number); + load_target_file(); + + + //G4P.setMouseOverEnabled(true); + //G4P.cursor(CROSS); + G4P.setColorScheme(this, GCScheme.GREY_SCHEME); + G4P.setFont(this, "Verdana", 16); + + //Optionbutton + //draw_webcam_option(); + //create_targets_list_button(); + //create_target_select(); //button + create_correction_buttons(); + create_sensitivity_buttons(); + load_target_list_combo(); //for combo + create_target_selection_combo(); //combo + //create_sound_option(); + create_shooting_conditions(); + create_shooting_style_option(); + create_button_save_changes(); + create_button_Lets_Fire(); + create_button_Reset_Values(); + + // Interfaces + create_ShootLog_interface(); + + // About + create_about_text(); + + //NameOfTimer(this,this, called function, period of calling) + create_timers(); + + //testing + //createWindowTargetsList(); + + camera_setup(); + video.start(); + if(video.available() == false) + { + x_position = 100; + y_position = 240; + fill(255, 0, 0, 255); + textSize(50); + text("NO VIDEO DATA", x_position, y_position, 600, 300); + }; + + noStroke(); + //smooth(); +}; + +void draw() +{ + // To do when video running + //if (video.available() && (b_Configure || b_Shooting)) + + + if (video.available() && (b_Configure || (b_shoot_stop == false))) + { + video.read(); + // Draw the webcam video onto the screen + draw_video(); + draw_last_hit(); + draw_current_target(); + + // Draw ghost image to calibrate + scale_the_target(); + draw_calibration_ghost_image(); + draw_shooting_prepare_countdown(); + draw_sensitivity(); + + //*** Finding position of the hit *** + find_position_of_hit(); + //*** Hit analizing *** + calculate_hit_range(); + //*** Draw a point into video *** + draw_position_of_hit(); + hit_points_calculation(); + stop_analyze_when_hit_detected(); + stop_analyze_when_hitcount_overflow(); + write_to_shoot_log(); + stop_by_style(); + } + /*else + { + x_position = 100; + y_position = 240; + fill(backround_color); + rect(x_position, y_position, 400, 60); + fill(255, 0, 0, 255); + textSize(50); + text("NO VIDEO DATA", x_position, y_position, 600, 300); + };*/ + + draw_time(); + draw_stats(); + //combo clearing utility :) + fill(backround_color); + rect(video_width + 160, 220, 151, 65); +}; + diff --git a/HomeLESS_Hit_Analyzer/System_methods.pde b/HomeLESS_Hit_Analyzer/System_methods.pde new file mode 100644 index 0000000..54f9ce2 --- /dev/null +++ b/HomeLESS_Hit_Analyzer/System_methods.pde @@ -0,0 +1,839 @@ +/* +This System_methods.pde is part of HomeLESS Hit Analyzer. + +HomeLESS Hit Analyzer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or any later version. + +HomeLESS: Hit Analyzer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with . If not, see . +*/ + + +// bolean, initial value +public boolean b_Configure = true, b_Shooting = false, b_Hit_detected = false, b_show_last_hit, b_sound, b_ballistics, b_shortcuts = true, b_shoot_stop = false, b_shooting_prepare = false, b_time_of_shooting_s = false; // Mode +public boolean b_training_style = false, b_hunting_style = false, b_combat_style = false, b_sport_style = false; //Shooting style +public boolean b_autoshootlog = true, b_autoshootlog_written = false; +public int shooting_style; + +// position of up left corner of video stream +public byte video_X_offset = 10, video_Y_offset = 50; +public int webcam_type, center_video_X, center_video_Y, correction_X, correction_Y, target_diameters_center_X, target_diameters_center_Y; +public int i_delay, i_shooting_prepare, i_time_of_shooting_s = 0;; +public float f_delay, f_10delay, dia; +public float f_shooting_time; +public int i_sensitivity = 1; +public ArrayList shoot_logs = new ArrayList(); +public int shoot_log_counter = 0, new_shooting_start_time, duration; +public int count; +public float f_resolution_ratio; + + +public void create_timers() +{ + tmrMilisTimer = new GTimer(this, this, "MilisTimerFunction", 100); + tmrSecondsTimer_Shooting_Countdown = new GTimer(this, this, "tmrSecondsTimer_Shooting_Countdown", 1000); + tmrSecondsTimer_Shooting_Prepare = new GTimer(this, this, "tmrSecondsTimer_Shooting_Prepare", 1000); + //tmrTimer.start(); + //tmrTimer.stop(); +}; + +public void tmrSecondsTimer_Shooting_Countdown() +{ + if(b_sport_style || b_hunting_style) + { + f_shooting_time--; + if(f_shooting_time == 0) + { + tmrSecondsTimer_Shooting_Countdown.stop(); + } + } + + + // for shotting style except training + if((b_time_of_shooting_s == true)) + { + i_time_of_shooting_s++; + //System.out.println("i_time_of_shooting_s: " + i_time_of_shooting_s); + } +} + + +public void tmrSecondsTimer_Shooting_Prepare() +{ + i_shooting_prepare--; + if(i_shooting_prepare == 0) + { + b_Configure = false; + //cbxConfigure.setSelected(false); + b_Shooting = true; + //tmrSecondsTimer_Shooting_Countdown.start(); + + if(b_training_style == false) + { + tmrSecondsTimer_Shooting_Countdown.start(); + b_time_of_shooting_s = true; + } + + tmrSecondsTimer_Shooting_Prepare.stop(); + //System.out.println(" tmrSecondsTimer_Shooting_Prepare.stop(); "); + + b_shooting_prepare = false; + i_shooting_prepare = Integer.valueOf(s_shooting_prepare).intValue(); + } +} + + +// +public void MilisTimerFunction() //every 100 ms +{ + + new_shooting_start_time--; + //System.out.println("new_shooting_start_time: " + new_shooting_start_time); + if((new_shooting_start_time <= 0) && (b_Configure == false) && (b_Shooting == false) && (b_shoot_stop == false)) + { + b_Shooting = true; + new_shooting_start_time = i_delay; + + if(b_hunting_style || b_sport_style) + { + new_shooting_start_time = i_delay; + } + + // System.out.println("new_shooting ready"); + tmrMilisTimer.stop(); + }; + + +} + +public void camera_setup() +{ + if(webcam_type == 0) + { + video = new GSCapture(this, video_width, video_height, "/dev/video0"); + } + else if(webcam_type == 1) + { + video = new GSCapture(this, video_width, video_height, "/dev/video1"); + } + else if(webcam_type == 2) + { + video = new GSCapture(this, video_width, video_height, "/dev/video2"); + } + else if(webcam_type == 3) + { + video = new GSCapture(this, video_width, video_height, "/dev/video3"); + } + else if(webcam_type == 4) + { + video = new GSCapture(this, video_width, video_height, "/dev/video4"); + } + else if(webcam_type == 5) + { + video = new GSCapture(this, video_width, video_height, "/dev/video5"); + } + else + video = new GSCapture(this, video_width, video_height); + +} + + + +public void convert_time() +{ + //System.out.println("f_shooting_time: " + f_shooting_time); + float f_seconds = f_shooting_time % 60; + float f_minutes = (f_shooting_time - f_seconds) / 60 ; + String s_seconds = String.valueOf(nf((int)f_seconds,2)); + String s_minutes = String.valueOf(nf((int)f_minutes,2)); + //System.out.println("Minutes: " + s_minutes); + //System.out.println("Seconds: " + s_seconds); + s_shooting_time = s_minutes + ":" + s_seconds; + //System.out.println("Time: " + s_shooting_time); +} + + + + +public void draw_video() +{ + image(video, video_X_offset, video_Y_offset, video_width, video_height); + +}; + + + +public void draw_calibration_ghost_image() +{ + if (b_Configure) + { + fill(255, 255, 0, 100); + + //circle target + if(i_target_type == 0) + { + //black diameter + //t_black_center_image_size = round(targets_diameters[number_of_black_diameter] * target_scale); + ellipse(target_diameters_center_X + video_X_offset + correction_X , target_diameters_center_Y + video_Y_offset + correction_Y, t_black_center_image_size, t_black_center_image_size); + //white diameter + //t_white_border_image_size = round(targets_diameters[number_of_biggest_diameter] * target_scale); + ellipse(target_diameters_center_X + video_X_offset + correction_X , target_diameters_center_Y + video_Y_offset + correction_Y, t_white_border_image_size, t_white_border_image_size); + }; + + //square circle target + if(i_target_type == 1) + { + rect(A1X + video_X_offset + correction_X, A1Y + video_Y_offset + correction_Y, A2X, A2Y); + rect(B1X + video_X_offset + correction_X, B1Y + video_Y_offset + correction_Y, B2X, B2Y); + //t_black_center_image_size = round(targets_diameters[number_of_black_diameter] * target_scale); + ellipse(target_diameters_center_X + video_X_offset + correction_X , target_diameters_center_Y + video_Y_offset + correction_Y, t_black_center_image_size, t_black_center_image_size); + }; + } +}; + + + + +void draw_position_of_hit() +{ + dia = projectile_diameter * f_diameter_scale; + if((f_hit_X > 15) && (f_hit_X < video_width -15)) + { + if((f_hit_Y > 0) && (f_hit_Y < video_height)) + { + //color of hit + //fill(255, 0, 0, 255); //red + fill(0, 0, 160, 255); //blue + if(projectile_diameter == 0)// for middle evaluation + { + rect(f_hit_X + video_X_offset - 2, f_hit_Y + video_Y_offset -17, 3, 15); // up + rect(f_hit_X + video_X_offset - 2, f_hit_Y + video_Y_offset +1, 3, 15); // down + rect(f_hit_X + video_X_offset - 17, f_hit_Y + video_Y_offset -2, 15, 3); // left + rect(f_hit_X + video_X_offset + 1, f_hit_Y + video_Y_offset -2, 15, 3); // right + } + else + {// for ambient avaluation + //dia = projectile_diameter * f_diameter_scale; + ellipse(f_hit_X + video_X_offset, f_hit_Y + video_Y_offset, dia, dia); + } + } + }; +}; + +public void draw_shooting_prepare_countdown() +{ + if(b_shooting_prepare == true) + { + x_position = ((video_width + video_X_offset)/2) - 60; + y_position = ((video_height + video_Y_offset)/2) -105; + fill(0, 0, 160, 255); //blue + textSize(200); + text(String.valueOf(i_shooting_prepare), x_position, y_position, 600, 300); + } +}; + + + +public void stop_analyze_when_hitcount_overflow() +{ + if((hit_counter == 99) && (b_training_style == false)) //value 99 + { + b_Shooting = false; + b_shoot_stop = true; + b_time_of_shooting_s = false; + x_position = 140; + y_position = 200; + fill(255, 0, 0, 255); + textSize(150); + text("STOP", x_position, y_position, 600, 300); + }; +}; + + +public void stop_analyze_when_hit_detected() +{ + if(b_Shooting) + { + if((f_hit_X > 15) && (f_hit_X < 625)) + { + if((f_hit_Y > 15) && (f_hit_Y < 465)) + { + hit_points_last = hit_points_actual; + b_Shooting = false; + hit_counter++; + b_Hit_detected = true; + last_f_hit_Y = f_hit_Y; + last_f_hit_X = f_hit_X; + tmrMilisTimer.start(); + + } + } + } + +}; + +public void draw_last_hit() +{ + if(b_show_last_hit && (hit_counter > 0)) + { + //fill(255, 255, 50, 255); //yellow + //fill(0, 0, 160, 255); //blue + fill(255, 0, 0, 255); //red + if(projectile_diameter == 0)// for middle evaluation + { + rect(last_f_hit_X + video_X_offset - 2, last_f_hit_Y + video_Y_offset -17, 3, 15); // up + rect(last_f_hit_X + video_X_offset - 2, last_f_hit_Y + video_Y_offset +1, 3, 15); // down + rect(last_f_hit_X + video_X_offset - 17, last_f_hit_Y + video_Y_offset -2, 15, 3); // left + rect(last_f_hit_X + video_X_offset + 1, last_f_hit_Y + video_Y_offset -2, 15, 3); // right + } + else + ellipse(last_f_hit_X + video_X_offset, last_f_hit_Y + video_Y_offset, dia, dia); + }; +}; + +public void write_to_shoot_log() +{ + String current_shoot_log, s_hit_X_temp, s_hit_Y_temp; + int i_hit_X, i_hit_Y; + + if(b_Hit_detected && (b_training_style == false)) + { + shoot_log_counter++; + i_hit_X = int(f_hit_X); + i_hit_Y= int(f_hit_Y); + + // Add current message + shoot_logs.add(nf(shoot_log_counter,2) + " " + "X:" + nf(i_hit_X,4) + " Y:" + nf(i_hit_Y,4) + " P:" + nf(hit_points_actual,2) + " T:" +nf(i_time_of_shooting_s,4) ); + // Join logs messages into one string + txtShootLog.setText(join((String[])shoot_logs.toArray(new String[shoot_logs.size()]), '\n')); + s_hit_X_temp = (nf(f_hit_X,4,1)).substring(0,4) + "." + (nf(f_hit_X,4,1)).substring(5); + s_hit_Y_temp = (nf(f_hit_Y,4,1)).substring(0,4) + "." + (nf(f_hit_Y,4,1)).substring(5); + current_shoot_log = "X:" + s_hit_X_temp + " Y:" + s_hit_Y_temp + " P:" + String.valueOf(nf(hit_points_actual,2)) + " T:" + String.valueOf(nf(i_time_of_shooting_s,4)); + //s_current_hit_temp + //current_shoot_log_temp = current_shoot_log; + + // 20 lines of header of shootlog file + s_shoot_logs[shoot_log_counter + 20] = current_shoot_log; //first six (0~20) lines for shootlog header + //s_shoot_logs[shoot_log_counter - 1] = current_shoot_log; + current_shoot_log = ""; + + b_Hit_detected = false; + }; + // Scroll down until last event is visible. + while(txtShootLog.scroll(GTextField.SCROLL_DOWN)); +}; + +public void stop_by_style() +{ + + if(b_hunting_style && (f_shooting_time == 0)) + { + tmrSecondsTimer_Shooting_Countdown.stop(); + tmrMilisTimer.stop(); + x_position = 140; + y_position = 200; + fill(255, 0, 0, 255); + textSize(150); + text("STOP", x_position, y_position, 600, 300); + b_shoot_stop = true; + if(b_autoshootlog && (b_autoshootlog_written == false)) + { + export_file_shoot_log(); + b_autoshootlog_written = true; + System.out.println("Shootlog exported "); + }; + }; + + if(b_combat_style) + { + if(duration == hit_counter) + { + b_time_of_shooting_s = false; + x_position = 140; + y_position = 200; + fill(255, 0, 0, 255); + textSize(150); + text("STOP", x_position, y_position, 600, 300); + //b_Shooting = false; + b_shoot_stop = true; + tmrMilisTimer.stop(); + if(b_autoshootlog && (b_autoshootlog_written == false)) + { + export_file_shoot_log(); + b_autoshootlog_written = true; + System.out.println("Shootlog exported "); + }; + } + }; + + if(b_sport_style) + { + if(duration == hit_counter || (f_shooting_time == 0)) + { + x_position = 140; + y_position = 200; + fill(255, 0, 0, 255); + textSize(150); + text("STOP", x_position, y_position, 600, 300); + // b_Shooting = false; + b_shoot_stop = true; + tmrSecondsTimer_Shooting_Countdown.stop(); + tmrMilisTimer.stop(); + if(b_autoshootlog && (b_autoshootlog_written == false)) + { + export_file_shoot_log(); + b_autoshootlog_written = true; + System.out.println("Shootlog exported "); + }; + } + }; +} + +public void sensitivity_up() +{ + i_sensitivity++; + if(i_sensitivity > 99) + { + i_sensitivity = 99; + } +} + +public void sensitivity_down() +{ + i_sensitivity--; + if(i_sensitivity < 1) + { + i_sensitivity = 1; + } +} + +public void handleCheckboxEvents(GCheckbox cbox) +{ + /* + if(cbox == cbxConfigure) + { + b_shortcuts = true; + if(cbxConfigure.isSelected()) + { + b_Shooting = false; + b_Configure = true; + } + else + { + b_Configure = false; + b_Shooting = true; + } + } + */ + + /* + if(cbox == cbxShow_last_hit) + { + if(cbxShow_last_hit.isSelected()) + { + b_show_last_hit = true; + System.out.println("b_show_last_hit true " ); + } + else + { + b_show_last_hit = false; + System.out.println("b_show_last_hit false " ); + } + } + */ +} + + +void handleOptionEvents(GOption selOpt, GOption delselOpt) +{ + + + if (selOpt == this.optTraining) + { + b_training_style = true; + b_hunting_style = false; + b_combat_style = false; + b_sport_style = false; + shooting_style = 1; + } + else if (selOpt == this.optSport) + { + b_training_style = false; + b_hunting_style = false; + b_combat_style = false; + b_sport_style = true; + shooting_style = 2; + f_10delay = 1; + new_shooting_start_time = i_delay; + } + else if (selOpt == this.optCombat) + { + b_training_style = false; + b_hunting_style = false; + b_combat_style = true; + b_sport_style = false; + shooting_style = 3; + } + else //(selOpt == this.optHunting) + { + b_training_style = false; + b_hunting_style = true; + b_combat_style = false; + b_sport_style = false; + shooting_style = 4; + f_10delay = 1; + new_shooting_start_time = i_delay; + } + +} + + +void handleButtonEvents(GButton button) +{ + b_shortcuts = true;// to activate key shortcuts + + if((button == btnNewShot) && (b_Configure == false) && (b_shoot_stop == false))// && button.eventType == GButton.CLICKED) + { + b_Shooting = true; + }; + + if((button == btnLetsFire)&& (b_Configure == true)) + { + if(b_training_style == true) + { + b_Configure = false; + //cbxConfigure.setSelected(false); + b_Shooting = true; + new_shooting_start_time = i_delay; + } + + if(b_training_style == false) + { + b_shooting_prepare = true; + tmrSecondsTimer_Shooting_Prepare.start(); + new_shooting_start_time = i_delay; + } + }; + + if(button == btnReset)// && button.eventType == GButton.CLICKED) + { + for(int i = 0 ; i < shoot_log_counter ; i++ ) + { + shoot_logs.remove(0); // this remove last one + }; + + txtShootLog.setText(""); + shoot_log_counter = 0; + //from delete button + hit_points_actual = 0; + hit_points_sum = 0; + hit_counter = 0; + hit_points_last = 0; + tmrSecondsTimer_Shooting_Countdown.stop(); + tmrMilisTimer.stop(); + + b_shoot_stop = false; + b_Shooting = false; + b_Configure = true; + b_autoshootlog_written = false; + //cbxConfigure.setSelected(true); + + + f_shooting_time = Float.parseFloat(txtShooting_Time.getText()); + //System.out.println("f_shooting_time: " + f_shooting_time); + + b_time_of_shooting_s = false; + i_time_of_shooting_s = 0; + }; + + + if(button == btnSave)// && button.eventType == GButton.CLICKED) + { + save_file_ha_ini(); + }; + + + + if(button == btnExport)// && button.eventType == GButton.CLICKED) + { + export_file_shoot_log(); + }; + + +} + +void handleImageButtonEvents(GImageButton imagebutton) +{ + b_shortcuts = true;// to activate key shortcuts + + if(b_Configure) + { + if(imagebutton == btnCorrection_down)// + { + correction_Y++; + }; + + if(imagebutton == btnCorrection_left)// + { + correction_X--; + }; + + if(imagebutton == btnCorrection_right)// + { + correction_X++; + }; + + if(imagebutton == btnCorrection_up)// + { + correction_Y--; + }; + + + if(imagebutton == btnCorrection_reset)// + { + correction_Y = 0; + correction_X = 0; + }; + + if(imagebutton == btnMinus)// + { + target_scale -= 0.01; + }; + + if(imagebutton == btnPlus)// + { + target_scale += 0.01; + }; + + + if(imagebutton == btnScale_reset)// + { + target_scale = 1; + }; + + if(imagebutton == btnSensitivity_up)// + { + sensitivity_up(); + }; + + if(imagebutton == btnSensitivity_down)// + { + sensitivity_down(); + }; + + + + } + + if(imagebutton == btnScrollUp)// + { + txtShootLog.scroll(GTextField.SCROLL_UP); + }; + + if(imagebutton == btnScrollDown)// + { + txtShootLog.scroll(GTextField.SCROLL_DOWN); + }; +} + +void handleTextFieldEvents(GTextField textfield) +{ + //void +}; + +void handle_txtCaliber(GTextField textfield) +{ + + if (textfield.eventType == GTextField.ENTERED) + { + txt_projectile_diameter = Float.parseFloat(txtCaliber.getText()); + projectile_diameter = txt_projectile_diameter; + + } + + if(textfield.eventType == GTextField.CHANGED) + { + b_shortcuts = false; + } +}; + + +void handle_txtShooting_Time(GTextField textfield) //Time +{ + if (textfield.eventType == GTextField.ENTERED) + { + f_shooting_time = Float.parseFloat(txtShooting_Time.getText()); + System.out.println("f_shooting_time: " + f_shooting_time); + } + + if(textfield.eventType == GTextField.CHANGED) + { + b_shortcuts = false; + System.out.println("handle_txtShooting_Time b_shortcuts = false;"); + + } +}; + + +void handle_txtDuration(GTextField textfield) +{ + if (textfield.eventType == GTextField.ENTERED) + { + duration = Integer.parseInt(txtDuration.getText()); + System.out.println("Duration: " + duration); + } + if(textfield.eventType == GTextField.CHANGED) + { + b_shortcuts = false; + } +}; + + + +void handle_txtShootLog(GTextField textfield) +{ + if(textfield.eventType == GTextField.CHANGED) + { + b_shortcuts = false; + } +} + +void handle_txtShootlog_filename(GTextField textfield) +{ + if(textfield.eventType == GTextField.CHANGED) + { + b_shortcuts = false; + } +}; + + +public void handleComboEvents(GCombo combo) +{ + if(cboTarget_selection == combo) + { + s_selected_target_name = cboTarget_selection.selectedText(); + System.out.println(s_selected_target_name); + load_target_file(); + } +}; + + +public void keyPressed() +{ + if(b_shortcuts == true) + { + + //see ASCII + if( key == 32 || key == 110) // key == spacebar or n + { + b_Shooting = true; + //System.out.println("Spacebar or n pressed"); + }; + + if( key == 114 ) // key == r + { + for(int i = 0 ; i < shoot_log_counter ; i++ ) + { + shoot_logs.remove(0); // this remove last one + }; + txtShootLog.setText(""); + shoot_log_counter = 0; + hit_points_actual = 0; + hit_points_sum = 0; + hit_counter = 0; + hit_points_actual = 0; + hit_points_last = 0; + b_shoot_stop = false; + //System.out.println("reset key r pressed"); + }; + + + if( key == 101) // key == e + { + export_file_shoot_log(); + } + + if( key == 115) // key == s + { + //Sound handle + save_file_ha_ini(); + } + + + if(b_Configure) + { + /*** Target correction ***/ + if(key == CODED) + { + if (keyCode == LEFT) + { + correction_X--; //left + } + + if (keyCode == DOWN) + { + correction_Y++; //down + } + + if (keyCode == RIGHT) + { + correction_X++; //right + } + + if (keyCode == UP) + { + correction_Y--; //up + } + + + if( keyCode == 33) // key == PageUp + { + sensitivity_up(); + } + + if( keyCode == 34) // key == PageDown + { + sensitivity_down(); + } + + }// end of keycode sequence + + + /*** Target scale ***/ + if( key == 47) // key == / + { + correction_Y = 0; + correction_X = 0; + } + + if( key == 43 && b_Configure) // key == + + { + target_scale += 0.01; + } + + if( key == 45 && b_Configure) // key == - + { + target_scale -= 0.01; + } + + if( key == 42 && b_Configure) // key == * + { + target_scale = 1; + } + + + + + + + } + }// end of if(shortcuts) + +}; + diff --git a/HomeLESS_Hit_Analyzer/ballistics/01_AAS400_Hawke_16J.bal b/HomeLESS_Hit_Analyzer/ballistics/01_AAS400_Hawke_16J.bal new file mode 100644 index 0000000..3e53980 --- /dev/null +++ b/HomeLESS_Hit_Analyzer/ballistics/01_AAS400_Hawke_16J.bal @@ -0,0 +1,22 @@ +range shift (notation value + 500) +0 +5 +10 +15 +20 +25 +30 +35 +40 +45 +50 +55 +60 +65 +70 +75 +80 +85 +90 +95 +100 \ No newline at end of file diff --git a/HomeLESS_Hit_Analyzer/ballistics/ballistics.txt b/HomeLESS_Hit_Analyzer/ballistics/ballistics.txt new file mode 100644 index 0000000..5452988 --- /dev/null +++ b/HomeLESS_Hit_Analyzer/ballistics/ballistics.txt @@ -0,0 +1,43 @@ +ballistics + +number_weaponNameType.bal + + + +shooting range +weapon type + +wind_power = 0 (zero for no wind) +wind_angle = 0 (0-360) + +range (meters) +shift (mm) + + +for airgun +1_AAS400_Hawke_16J.bal +meters mm +range shift (notation value + 500) +0 +5 +10 +15 +20 +25 +30 +35 +40 +45 +50 +55 +60 +65 +70 +75 +80 +85 +90 +95 +100 +etc. + diff --git a/HomeLESS_Hit_Analyzer/ballistics_methods.pde b/HomeLESS_Hit_Analyzer/ballistics_methods.pde new file mode 100644 index 0000000..111631a --- /dev/null +++ b/HomeLESS_Hit_Analyzer/ballistics_methods.pde @@ -0,0 +1,28 @@ +/* +This ballistic_method.pde is part of HomeLESS Hit Analyzer. + +HomeLESS Hit Analyzer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or any later version. + +HomeLESS: Hit Analyzer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with . If not, see . +*/ + +public int y_projectile_shift; //for basic ballistics +public int real_distance, shooting_distance; +public float real_size, shooting_size; + + +public void load_ballistics_data() +{ + System.out.println("Ballistic data file loaded \n"); + y_projectile_shift = 0; +}; + + diff --git a/HomeLESS_Hit_Analyzer/files_methods.pde b/HomeLESS_Hit_Analyzer/files_methods.pde new file mode 100644 index 0000000..51bf7cb --- /dev/null +++ b/HomeLESS_Hit_Analyzer/files_methods.pde @@ -0,0 +1,654 @@ +/* +This files_method.pde is part of HomeLESS Hit Analyzer. + +HomeLESS Hit Analyzer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or any later version. + +HomeLESS: Hit Analyzer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with . If not, see . +*/ + +public String target_name, name_of_target_file; +public int i_target_type; //target_number, +public int i_number_of_tgt_files = 0; +String[] s_targets_names; +public boolean b_ha_ini_exist = false, b_english_lng_exist = false; +//dafaluts strings +String[] s_default_ha_ini = {"Webcam = 0","Video width = 640","Video height = 480","Sensitivity = 3","Style = 1","SLH = 1","language = english","Caliber = 4.5","Delay = 3","Duration = 5","Target = airgun_cz.tgt","Scale = 1.00","X correction = 5000","Y correction = 5000", "Time = 120", "Prepare = 5", "Autoshootlog = 1"}; +String[] s_ha_ini_clear_contain = {"Webcam = ","Video width = ","Video height = ","Sensitivity = ","Style = ","SLH = ","language = ","Caliber = ","Delay = ","Duration = ","Target = ","Scale = ","X correction = ","Y correction = ", "Time = ", "Prepare = ", "Autoshootlog = "}; +String[] s_ha_ini_contain = {"Webcam = ","Video width = ","Video height = ","Sensitivity = ","Style = ","SLH = ","language = ","Caliber = ","Delay = ","Duration = ","Target = ","Scale = ","X correction = ","Y correction = ", "Time = ", "Prepare = ", "Autoshootlog = "}; +String[] s_shoot_logs = new String[145]; +//String[] s_ha_ini_contain = new String[14]; +String[] s_default_english_lng = {"Shooter:","Correction:","Caliber:","Infobox:","Duration:","Targets list","New shoot","Select target:","Sound","SLH","Let's fire","Time:","Reset","Export","Points:","Hits:","Total:","Target:","HomeLESS - Hit Analyzer version 1.1b","Found target files:","Save changes", "Shooting style:", "Training", "Sport", "Combat", "Hunting", "Sensitivity: ", "Conditions: "}; +String s_language_file, s_current_language, s_shoot_log_contain ,s_shootlog_full_filename, s_Shootlog_filename; +String s_selected_target_name, s_Sensitivity, s_Conditions; + +public void check_basic_files() +{ + String path = sketchPath; + String file_name; + ArrayList allFiles = listFilesRecursive(path); + + // try to locate basic files: ha.ini, english.lng + // ha.ini + File[] files = listFiles(path); + for (int i = 0; i < files.length; i++) + { + File f = files[i]; + file_name = f.getName(); + is_ha_ini_file(file_name); + } + // ha.ini exist? + if(b_ha_ini_exist == false) + { + save_file_default_ha_ini(); + }; + + //english.lng + for (int i = 0; i < allFiles.size(); i++) + { + File f = (File) allFiles.get(i); + file_name = f.getName(); + is_english_lng_file(file_name); + } + + if(b_english_lng_exist == false) + { + save_file_default_english_lng(); + }; + + + /* + // any tgt file? + for (int i = 0; i < files.length; i++) + { + File f = files[i]; + file_name = f.getName(); + isTarget(file_name); + } + */ +} + + +public void load_ha_ini() +{ + convert_time(); + + String[] contain = loadStrings("ha.ini"); + char c_webcam_type, c_sound , c_style, c_SLH, c_autoshootlog; + String s_video_width, s_video_height, s_laguage_file, s_caliber, s_delay, s_duration, s_target, s_scale, s_correction_X, s_correction_Y, s_sensitivity; + + //fit + c_webcam_type = contain[0].charAt(9); + webcam_type = int(c_webcam_type) - 48; + + s_video_width = contain[1].substring(14); + video_width = Integer.valueOf(s_video_width).intValue(); + + s_video_height = contain[2].substring(15); + video_height = Integer.valueOf(s_video_height).intValue(); + + s_sensitivity = contain[3].substring(14); + i_sensitivity = Integer.valueOf(s_sensitivity).intValue(); + + //fit + c_style = contain[4].charAt(8); + shooting_style = int(c_style) - 48; + if(shooting_style == 1) + { + b_training_style = true; + } + if(shooting_style == 2) + { + b_sport_style = true; + } + if(shooting_style == 3) + { + b_combat_style = true; + } + if(shooting_style == 4) + { + b_hunting_style = true; + } + + c_SLH = contain[5].charAt(6); + if((int(c_SLH) - 48) == 1) + { + b_show_last_hit = true; + } + else + { + b_show_last_hit = false; + } + + + s_current_language = contain[6].substring(11); + + s_caliber = contain[7].substring(10); + txt_projectile_diameter = Float.valueOf(s_caliber).floatValue(); + projectile_diameter = txt_projectile_diameter; + + s_delay = contain[8].substring(8); + i_delay = Integer.valueOf(s_delay).intValue(); + new_shooting_start_time = i_delay; + + s_duration = contain[9].substring(11); + duration = Integer.valueOf(s_duration).intValue(); + + s_selected_target_name = contain[10].substring(9); + System.out.println(s_selected_target_name); + + s_scale = contain[11].substring(8); + target_scale = Float.valueOf(s_scale).floatValue(); + + s_correction_X = contain[12].substring(15); + correction_X = Integer.valueOf(s_correction_X).intValue(); + correction_X -= 5000; + + s_correction_Y = contain[13].substring(15); + correction_Y = Integer.valueOf(s_correction_Y).intValue(); + correction_Y -= 5000; + + s_shooting_time = contain[14].substring(7); + f_shooting_time = Float.valueOf(s_shooting_time).floatValue(); + + s_shooting_prepare = contain[15].substring(10); + i_shooting_prepare = Integer.valueOf(s_shooting_prepare).intValue(); + + c_autoshootlog = contain[16].charAt(15); + if((int(c_autoshootlog) - 48) == 1) + { + b_autoshootlog = true; + } + else + { + b_autoshootlog = false; + } + + System.out.println("Basic file ha.ini file loaded. \n"); +}; + + +public void load_lang_pack() +{ + + String path = sketchPath; + String file_name; + ArrayList allFiles = listFilesRecursive(path); + s_language_file = "languages/" + s_current_language + ".lng"; + String[] contain = loadStrings(s_language_file); + //language pack + s_Shooter = contain[0]; + s_Correction = contain[1]; + s_Caliber = contain[2]; + s_Infobox = contain[3]; + s_Duration = contain[4]; + s_Targets_list = contain[5]; + s_New_shoot = contain[6]; + s_Target_select = contain[7]; + s_Sound = contain[8]; + s_SLH = contain[9]; + s_Lets_fire = contain[10]; + s_Time = contain[11]; + s_Reset = contain[12]; + s_Export = contain[13]; + s_Points = contain[14]; + s_Hits = contain[15]; + s_Total = contain[16]; + s_Target = contain[17]; + s_About = contain[18]; + s_found_target_files = contain[19]; + s_Save = contain[20]; + s_Shooting_style = contain[21]; + s_Training = contain[22]; + s_Sport = contain[23]; + s_Combat = contain[24]; + s_Hunting = contain[25]; + s_Sensitivity = contain[26]; + s_Conditions = contain[27]; + System.out.println("Basic file lang pack loaded. \n"); +}; + + +public void load_target_list_combo() +{ + + String path = sketchPath; + String file_name; + ArrayList allFiles = listFilesRecursive(path); + String[] s_target_file_names = new String[100]; + + for (int i = 0; i < allFiles.size(); i++) + { + File f = (File) allFiles.get(i); + file_name = f.getName(); + if(isTarget(file_name)) + { + i_number_of_tgt_files++; + //System.out.println("target number " + i_number_of_tgt_files); + // list for combo: + s_target_file_names[i_number_of_tgt_files] = file_name; + //System.out.println(s_target_file_names[i_number_of_tgt_files]); + + } + } + s_targets_names = new String[i_number_of_tgt_files + 1]; + + + for (int j = 1 ; j <= i_number_of_tgt_files; j++) + { + System.out.println("target number " + j); + System.out.println(s_target_file_names[j]); + s_targets_names[j] = s_target_file_names[j]; + } +}; + + +public void load_target_file() +{ + f_targets_diameters = new float[40]; + String full_file_target_name ="targets/"; + full_file_target_name += s_selected_target_name; + String[] contain = loadStrings(full_file_target_name); + System.out.println(full_file_target_name); + + target_name = contain[0]; + i_target_type = Integer.valueOf(contain[1]).intValue(); + last_target_scale = 0; + + //circle target + if(i_target_type == 0 ) + { + //circle target i <= 11 + for(int i = 0 ; i<= 11 ; i++ ) + { + f_targets_diameters[i] = Float.valueOf(contain[i+1]).floatValue(); + //System.out.println("Diameter no.: " + i + " value: " + f_targets_diameters[i] + " field number: " + i); + } + //number_of_biggest_diameter = Integer.valueOf(contain[13]).intValue(); + set_number_of_biggest_diameter(); + target_diameters_center_X = (video_width / 2) - 1; + target_diameters_center_Y = (video_height / 2) - 1; + } + + //square circle target + if(i_target_type == 1 ) + { + //circle target i <= 11 + for(int i = 0 ; i<= 11 ; i++ ) + { + f_targets_diameters[i] = Float.valueOf(contain[i+1]).floatValue(); + //System.out.println("Diameter no.: " + i + " value: " + f_targets_diameters[i] + " field number: " + i); + } + //number_of_biggest_diameter = Integer.valueOf(contain[13]).intValue(); + set_number_of_biggest_diameter(); + + A1X = Float.valueOf(contain[13]).floatValue(); + A1Y = 0; + A2X = Float.valueOf(contain[14]).floatValue(); + A2Y = Float.valueOf(contain[15]).floatValue(); + B1X = 0; + B1Y = A2Y; + B2X = Float.valueOf(contain[16]).floatValue(); + B2Y = Float.valueOf(contain[17]).floatValue(); + CX = Float.valueOf(contain[18]).floatValue(); + CY = Float.valueOf(contain[19]).floatValue(); + } + + //elipse target + else if(i_target_type == 2 ) + { + for(int i = 0 ; i<= 11 ; i++ ) + { + f_targets_diameters[i] = Float.valueOf(contain[i+1]).floatValue(); + //System.out.println("Diameter no.: " + i + " value: " + target_diameters[i] + " field number: " + i); + } + } + + if(i_target_type == 5 ) + { + //circle target i <= 11 + for(int i = 0 ; i<= 11 ; i++ ) + { + f_targets_diameters[i] = Float.valueOf(contain[i+1]).floatValue(); + //System.out.println("Diameter no.: " + i + " value: " + target_diameters[i] + " field number: " + i); + } + } + analyze_the_target(); +} + + +public int getTargetNumber(String name) +{ + int number; + number = Integer.valueOf(name.substring(0,2)).intValue(); + return number; +} + + +public boolean isTarget(String name) +{ + if(name.endsWith("tgt") == true) + { + return true; + } + else + { + return false; + } +} + +public boolean is_ha_ini_file(String name) +{ + + if(name.equals("ha.ini")) + { + b_ha_ini_exist = true; + return true; + } + else + { + return false; + } +} + +public boolean is_english_lng_file(String name) +{ + //if(name.endsWith("tgt") == true) + if(name.equals("english.lng")) + { + b_english_lng_exist = true; + return true; + } + else + { + return false; + } +} + + + +public void save_file_ha_ini() +{ + byte byte_style = 1, byte_SLH = 1, byte_autoshootlog = 1; + + + s_ha_ini_contain[0] = "Webcam = "; + s_ha_ini_contain[1] = "Video width = "; + s_ha_ini_contain[2] = "Video height = "; + s_ha_ini_contain[3] = "Sensitivity = "; + s_ha_ini_contain[4] = "Style = "; + s_ha_ini_contain[5] = "SLH = "; + s_ha_ini_contain[6] = "Language = "; + s_ha_ini_contain[7] = "Caliber = "; + s_ha_ini_contain[8] = "Delay = "; + s_ha_ini_contain[9] = "Duration = "; + s_ha_ini_contain[10] = "Target = "; + s_ha_ini_contain[11] = "Scale = "; + s_ha_ini_contain[12] = "X correction = "; + s_ha_ini_contain[13] = "Y correction = "; + s_ha_ini_contain[14] = "Time = "; + s_ha_ini_contain[15] = "Prepare = "; + s_ha_ini_contain[16] = "Autoshootlog = "; + + //s_ha_ini_contain = s_ha_ini_clear_contain; + + if(b_show_last_hit) + { + byte_SLH = 1; + } + else + { + byte_SLH = 0; + }; + + if(b_autoshootlog) + { + byte_autoshootlog = 1; + } + else + { + byte_autoshootlog = 0; + }; + + + s_ha_ini_contain[0] += webcam_type; + s_ha_ini_contain[1] += video_width; + s_ha_ini_contain[2] += video_height; + s_ha_ini_contain[3] += i_sensitivity; + s_ha_ini_contain[4] += shooting_style; + s_ha_ini_contain[5] += byte_SLH; + s_ha_ini_contain[6] += s_current_language; + s_ha_ini_contain[7] += projectile_diameter; + s_ha_ini_contain[8] += i_delay; + s_ha_ini_contain[9] += duration; + s_ha_ini_contain[10] += s_selected_target_name; + s_ha_ini_contain[11] += target_scale; + s_ha_ini_contain[12] += (correction_X + 5000); + s_ha_ini_contain[13] += (correction_Y + 5000); + s_ha_ini_contain[14] += f_shooting_time; + s_ha_ini_contain[15] += i_shooting_prepare; + s_ha_ini_contain[16] += byte_autoshootlog; + + saveStrings("ha.ini", s_ha_ini_contain); + System.out.println("Changes in configuration has been saved into ha.ini file."); + +}; + + + + +public void save_file_default_ha_ini() +{ + saveStrings("ha.ini", s_default_ha_ini); + System.out.println("Default file ha.ini has been created."); +} + +public void save_file_default_english_lng() +{ + saveStrings("languages/english.lng", s_default_english_lng); + System.out.println("Default file ./languages/english.lng has been created"); +} + +public void export_file_shoot_log() +{ + String s_current_year, s_current_year_full, s_current_month, s_current_day, s_current_hour, s_current_minute; + String s_current_shooting_style, s_total_shooting_time_hh_mm, s_average_points; + float f_average_points = 0; + int i_line_offset = 0; + + s_current_year = String.valueOf(year() - 2000); + s_current_year_full = String.valueOf(year()); + s_current_month = String.valueOf(nf(month(),2)); + s_current_day = String.valueOf(nf(day(),2)); + s_current_hour = String.valueOf(nf(hour(),2)); + s_current_minute = String.valueOf(nf(minute(),2)); + + f_shooting_time = i_time_of_shooting_s; + float f_seconds = f_shooting_time % 60; + float f_minutes = (f_shooting_time - f_seconds) / 60 ; + String s_seconds = String.valueOf(nf((int)f_seconds,2)); + String s_minutes = String.valueOf(nf((int)f_minutes,2)); + //System.out.println("Minutes: " + s_minutes); + //System.out.println("Seconds: " + s_seconds); + s_total_shooting_time_hh_mm = s_minutes + ":" + s_seconds; + + + f_average_points = (float(hit_points_sum)/ float(hit_counter)); + s_average_points = nf(f_average_points,2,2); + // replace "," by "." + s_average_points = s_average_points.substring(0,2) + "." + s_average_points.substring(3); + + //if(b_training_style) for disable shootlog + s_current_shooting_style = "Training"; + if(b_hunting_style) + s_current_shooting_style = "Hunting"; + if(b_combat_style) + s_current_shooting_style = "Combat"; + if(b_sport_style) + s_current_shooting_style = "Sport"; + + //YYMMDDHHMM_PPP_CC_ShooterName + s_Shootlog_filename = s_current_year + s_current_month + s_current_day + s_current_hour + s_current_minute; + s_Shootlog_filename += "_" + String.valueOf(nf(hit_points_sum,3)); + s_Shootlog_filename += "_" + String.valueOf(nf(hit_counter,2)); + s_Shootlog_filename += "_" + txtShootlog_filename.getText() + ".slg"; + + + s_shoot_log_contain = txtShootLog.getText(); + s_shootlog_full_filename = "shootlogs/"; + s_shootlog_full_filename += s_Shootlog_filename; + + s_shoot_logs[0] = "Date: " + s_current_day + "." + s_current_month + "." + s_current_year_full; + s_shoot_logs[1] = "Hour: " + s_current_hour + ":" + s_current_minute; + s_shoot_logs[2] = "Name: " + txtShootlog_filename.getText(); + s_shoot_logs[3] = "Total: " + String.valueOf(hit_points_sum); + s_shoot_logs[4] = "Hits: " + String.valueOf(hit_counter); + s_shoot_logs[5] = "Average: " + s_average_points; + s_shoot_logs[6] = "Time: " + s_total_shooting_time_hh_mm; + s_shoot_logs[7] = "Caliber: " + String.valueOf(txt_projectile_diameter); + + s_shoot_logs[7] += " mm"; //metric units + + s_shoot_logs[8] = "Target name: " + target_name; + s_shoot_logs[9] = "Shooting distance: 10 meters"; + s_shoot_logs[10] = "Real distance: 5 meters "; + s_shoot_logs[11] = "Style: " + s_current_shooting_style; + s_shoot_logs[12] = ""; + s_shoot_logs[13] = ""; + s_shoot_logs[14] = ""; + // free position + s_shoot_logs[15] = ""; + s_shoot_logs[16] = ""; + s_shoot_logs[17] = ""; + s_shoot_logs[18] = s_About; + s_shoot_logs[19] = "Shootlog version: 1"; + s_shoot_logs[20] = ""; + + //s_log_logs[] from System_methods -> write_to_shoot_log() + + s_shoot_logs[hit_counter + 21] = ""; + s_shoot_logs[hit_counter + 22] = "Target file: " + s_selected_target_name; + s_shoot_logs[hit_counter + 23] = "Target type: " + String.valueOf(i_target_type); + + if(i_target_type == 0) //circle target + { + for(int number_of_diameter = 1; number_of_diameter < 11; number_of_diameter++) + { + s_shoot_logs[hit_counter + 23 + number_of_diameter] = nf((number_of_diameter),2) + ":" +String.valueOf(f_targets_diameters[number_of_diameter] * f_diameter_scale); + }; + s_shoot_logs[hit_counter + 34] = "CX:" + String.valueOf(target_diameters_center_X + correction_X); + s_shoot_logs[hit_counter + 35] = "CY:" + String.valueOf(target_diameters_center_Y + correction_Y); + s_shoot_logs[hit_counter + 36] = "MD:" + String.valueOf(number_of_black_diameter); //mark diameter (black dia.) + i_line_offset = 10; + }; + + if(i_target_type == 1) //square circle target + { + for(int number_of_diameter = 1; number_of_diameter < 11; number_of_diameter++) + { + s_shoot_logs[hit_counter + 23 + number_of_diameter] = nf((number_of_diameter),2) + ":" + String.valueOf(f_targets_diameters[number_of_diameter] * f_diameter_scale); + }; + s_shoot_logs[hit_counter + 34] = "CX:" + String.valueOf(target_diameters_center_X + video_X_offset + correction_X); + s_shoot_logs[hit_counter + 35] = "CY:" + String.valueOf(target_diameters_center_Y + video_Y_offset + correction_Y); + s_shoot_logs[hit_counter + 36] = "A1X:" + String.valueOf(A1X + correction_X); + s_shoot_logs[hit_counter + 37] = "A1Y:" + String.valueOf(A1Y + correction_Y); + s_shoot_logs[hit_counter + 38] = "A2X:" + String.valueOf(A2X); + s_shoot_logs[hit_counter + 39] = "A2Y:" + String.valueOf(A2Y); + s_shoot_logs[hit_counter + 40] = "B1X:" + String.valueOf(B1X + correction_X); + s_shoot_logs[hit_counter + 41] = "B1Y:" + String.valueOf(B1Y + correction_Y); + s_shoot_logs[hit_counter + 42] = "B2X:" + String.valueOf(B2X); + s_shoot_logs[hit_counter + 43] = "B2Y:" + String.valueOf(B2Y); + s_shoot_logs[hit_counter + 44] = "MD:" + String.valueOf(number_of_black_diameter); + i_line_offset = 18; + + } + + s_shoot_logs[hit_counter + 27 + i_line_offset] = "PS: " + String.valueOf(f_diameter_scale); //pixel scale + //s_shoot_logs[hit_counter + 28] = "Pixel scale2: " + String.valueOf(f_square_scale); //- same as the f_diameter_scale + + //X: xxxx Y: yyyy P: pp T: tttt + + saveStrings(s_shootlog_full_filename, s_shoot_logs); + + //System.out.println("Shootlog has been exported into file: " + s_shootlog_full_filename ); + + x_position = video_X_offset +10; + y_position = video_height + video_Y_offset - 60; + fill(255, 0, 0, 255); + textSize(24); + text("Shootlog has been exported into file:", x_position, y_position, 600, 30); + text(s_Shootlog_filename, x_position, y_position + 25, 600, 30); + // clearing shootlog + + for(int index = 0; index < 145; index++) + { + s_shoot_logs[index] = ""; + } + +} + + + + + + +// This function returns all the files in a directory as an array of Strings +String[] listFileNames(String dir) +{ + File file = new File(dir); + if (file.isDirectory()) { + String names[] = file.list(); + return names; + } else { + // If it's not a directory + return null; + } +} + + + +// This function returns all the files in a directory as an array of File objects +// This is useful if you want more info about the file +File[] listFiles(String dir) +{ + File file = new File(dir); + if (file.isDirectory()) { + File[] files = file.listFiles(); + return files; + } else { + // If it's not a directory + return null; + } +} + +// Function to get a list ofall files in a directory and all subdirectories +ArrayList listFilesRecursive(String dir) +{ + ArrayList fileList = new ArrayList(); + recurseDir(fileList,dir); + return fileList; +} + +// Recursive function to traverse subdirectories +void recurseDir(ArrayList a, String dir) +{ + File file = new File(dir); + if (file.isDirectory()) { + // If you want to include directories in the list + a.add(file); + File[] subfiles = file.listFiles(); + for (int i = 0; i < subfiles.length; i++) { + // Call this function on all files in this directory + recurseDir(a,subfiles[i].getAbsolutePath()); + } + } else { + a.add(file); + } +} diff --git a/HomeLESS_Hit_Analyzer/gpl-2.0.txt b/HomeLESS_Hit_Analyzer/gpl-2.0.txt new file mode 100644 index 0000000..b7cbbdc --- /dev/null +++ b/HomeLESS_Hit_Analyzer/gpl-2.0.txt @@ -0,0 +1,138 @@ +GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + +one line to give the program's name and an idea of what it does. +Copyright (C) yyyy name of author + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details +type `show w'. This is free software, and you are welcome +to redistribute it under certain conditions; type `show c' +for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' +(which makes passes at compilers) written +by James Hacker. + +signature of Ty Coon, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. \ No newline at end of file diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_down.png b/HomeLESS_Hit_Analyzer/graphics/arrow_down.png new file mode 100644 index 0000000000000000000000000000000000000000..f63fb8302e33f4d73a45ab80f3cfab5e13db7524 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg;pyTSV$qwNus|*$B_YA0-~q!^HcJZ&gTOp4nSjeWVoh2yGBOH0 zO^${Ue=V}Et%%%W!d)%b^jtcoDdMy6+rJ(5(vK${eW@2C^&z79eE*DFA9hc7s8GyS ni>MRSe*Ux%DYN0w+G&`t(VS3j3^P6PZ}tg;pyTSV$qwNus|*$B_YA0-~q!^HcJZ&gTOp4nSjeWVoh2yGBOH0 zO^${Ue=V}Et%%%W!d)%b^jtcoDdMy6+rJ(5(vK${eW@2C^&z79eE*DFA9hc7s8GyS ni>MRSe*Ux%DYN0w+G&`t(VS3j3^P6PZ}tg;pyTSV$qwNus|*$B_Ux)-CwJxY?)bEMuB-;G69!$#G15BOidMe znj8%y{#s;RTM@a%gu7a<>A7@FQ^aTCw|_hAr5{f^`cf}O>O(~H`TiNVKJ1?EP@$Nu n7Evdt$KAP}mn}PLsTu=A$_0g(ZXE_cpq&h!u6{1-oD!MPZ}tg?&;zfV$qwNus|*$B_ZL*|ND(xY=&|Pi|&Y6ELaw)!xCy>B-dcT z!FDv^>*E!Xi_GwH1VmhZ~{a(cYQmhUdeJdn(5XP=aH_MRC^*B){z(mNUE0j*^4boFyt=akR{0G~lW>Hq)$ literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_left.png b/HomeLESS_Hit_Analyzer/graphics/arrow_left.png new file mode 100644 index 0000000000000000000000000000000000000000..54b60e607d469a40f86c6f5b1d21a3002286c864 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg?&;zfV$u8dN+4H*0T1&94eN-$d5eFlTUn)M+Oy5Ne=u3{ZNsh{ z29>9Zld9t^KS#TYc}`-zw#I0SjmCx?4u|TtxRh$}w7c)0Um#Xbc2z|zI`nbfG$#*YV0j*^4boFyt=akR{0HdKnXaE2J literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_left_1.png b/HomeLESS_Hit_Analyzer/graphics/arrow_left_1.png new file mode 100644 index 0000000000000000000000000000000000000000..54b60e607d469a40f86c6f5b1d21a3002286c864 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg?&;zfV$u8dN+4H*0T1&94eN-$d5eFlTUn)M+Oy5Ne=u3{ZNsh{ z29>9Zld9t^KS#TYc}`-zw#I0SjmCx?4u|TtxRh$}w7c)0Um#Xbc2z|zI`nbfG$#*YV0j*^4boFyt=akR{0HdKnXaE2J literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_left_2.png b/HomeLESS_Hit_Analyzer/graphics/arrow_left_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a8c57afdfda354414850abb687cc1df89e27dede GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg;pyTSV$u8dN+4H*0T1&9jom))>Sx3px4(E%)BCsKg+F|9r!&~E zq%tdL@=v_;`P9t&TAMs3>1;@wy6~xEW2!U5E#og<@#Se(XYMGSa%JkQsNetMX4)&i q$SD3;T^S=SD{*I)@kiFxM(ndACDvQ0ZZ`zl$>8bg=d#Wzp$PyaU__n( literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_left_3.png b/HomeLESS_Hit_Analyzer/graphics/arrow_left_3.png new file mode 100644 index 0000000000000000000000000000000000000000..4320e9d2bb422d154dee75661d531f46c1ef5f20 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg;pyTSV$u8dN+8z(1s>)LDHR6&_hy&YCr`H8_{{mnCvBUaElj%v z8mdJdwj{^y{1mO!ZE}g_+L}vSivkjsDl$BkmAdqO?#)s)IoZ3}!C6^vZ&$DVBk6eD pM0|gEpZ4BnmhG>7Y7PcHV|gVb@hv3Q8E82JgQu&X%Q~loCIIedM8p69 literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_right.png b/HomeLESS_Hit_Analyzer/graphics/arrow_right.png new file mode 100644 index 0000000000000000000000000000000000000000..afc4d650aee84c4701ec3844e8a6ad8845927f37 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg;pyTSV$u8dvNzWO1s;|Q8!I+gR`p$LRrq&Q!Z9OV^HY)&%bQ0G z9VhHuKHUsYs(Zb}b<&bvQCH*D$6r1VEv}2oJ+rj_*|oVRs^-*vO5!+L`*-)NLtd+I qHXeJ`d&t~BeCmYg@<-g$QsYi!N_<&nvh+L9P6kg`KbLh*2~7YQ7)sdy literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_right_1.png b/HomeLESS_Hit_Analyzer/graphics/arrow_right_1.png new file mode 100644 index 0000000000000000000000000000000000000000..afc4d650aee84c4701ec3844e8a6ad8845927f37 GIT binary patch literal 197 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg;pyTSV$u8dvNzWO1s;|Q8!I+gR`p$LRrq&Q!Z9OV^HY)&%bQ0G z9VhHuKHUsYs(Zb}b<&bvQCH*D$6r1VEv}2oJ+rj_*|oVRs^-*vO5!+L`*-)NLtd+I qHXeJ`d&t~BeCmYg@<-g$QsYi!N_<&nvh+L9P6kg`KbLh*2~7YQ7)sdy literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_right_2.png b/HomeLESS_Hit_Analyzer/graphics/arrow_right_2.png new file mode 100644 index 0000000000000000000000000000000000000000..cee64a7b351dba9d99fd3f2b652e2a3866eab772 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1HbFq_W2nPqp?T7vkfLzW3kH}&M z2EHR8%s5q>PZ}tg<>}%WV$u8d@@Y;6MIM$5g&SwS+&^Q>W_HIv-G)sYtlcMy3o9jv zvpcwaQ=D{upU~%Mb=^rSxob3LMcVq=ub=h#a#ph5U*qlXT&_L-GFjYNPZ}tg<>}%WV$qwNus|*$B_ZL*|ND(xY=&|Pi|&Y6NSJm{OEWYAO4vBa zZhoK^bXF(k*hKlb8OJsXY~kHsc%m|G!!k}0d!aK=G8!9}&8sO-jPh9)8By!d7rCRU piFLKc%4H4*5`2Y~59(wwF+7Wq__l0CcRJ8k22WQ%mvv4FO#t)~Kra9Q literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_up.png b/HomeLESS_Hit_Analyzer/graphics/arrow_up.png new file mode 100644 index 0000000000000000000000000000000000000000..370c2025217bff45c9a29c3c7b0078eed09b8d74 GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW)TsStO%KKpb%$) zM`SSr178UUGiIx7z6KPG@^ogavX5ERUGk`2zALG&eH~i{5qh-5k+TXw%|o zpfRJvgrnDYQ{;?UAEl4G>~Uo2O;!qJmW#Y~T)AjUpst)J)8e$=S*9Uplw!n$;-z`Q d?1O|E7#x~~w=mw|Rs`C@;OXk;vd$@?2>`viGjsp| literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_up_2.png b/HomeLESS_Hit_Analyzer/graphics/arrow_up_2.png new file mode 100644 index 0000000000000000000000000000000000000000..bf28f5a24b2f69b4e6c1793729194a5926861897 GIT binary patch literal 187 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW)V@g-BW6&0fjgV zJR*x382Cy+m@!*r^EIGgl&6bhNX4z>gavX5ERSAaUmu(|Vc9Y@VbQy;zMCUD3T;{( z4K!wSm~iy^Zi<{S>!b8>mpzUwy~#?U%yN;pjw=^U3DlMIWLlioJIgfWj8cr4P`orx dn0=5i1A}dykeGVD-+Q1f44$rjF6*2UngD^5HRS*R literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/arrow_up_3.png b/HomeLESS_Hit_Analyzer/graphics/arrow_up_3.png new file mode 100644 index 0000000000000000000000000000000000000000..656086e2d5548bcfc8ad667f1219be83827803d5 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW)V@A&{?v(fI^%F z9+AZi416UZ%$TjR`5I6#($mE;q~ca`!UDMjmPh~p%dSWec+9A#wX1tp+D3uL6&%e8 z0S1DZ0#dV6HXE2eHt*}KXy%YQ?y`!_X495__a_>QqiiOzxSf?U&0aCXb%&11J~N3m dbxYJ37~1@W58VI4z7l8&gQu&X%Q~loCIBdsIB);} literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/correction_reset_1.png b/HomeLESS_Hit_Analyzer/graphics/correction_reset_1.png new file mode 100644 index 0000000000000000000000000000000000000000..531967e838d01d3e269d0f57aad2d05cae4c31ad GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTD77+>S)2(I2Kq1Zo zk4PZRR|3L}*(#f_0R^KyT^vIyZXLbq$i<+*!E&HW?%CzqsK9jZ>_~AN*3%CZy$>!u z7kKr*l3=Do_zv$dgII&>Vv)ani{=J;uG7{!{M7Mcte?pBr|yEWiXx{)T^nQXR#jLq et^9AR$vokf+=ufuy_!I47(8A5T-G@yGywn@p*vat literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/correction_reset_2.png b/HomeLESS_Hit_Analyzer/graphics/correction_reset_2.png new file mode 100644 index 0000000000000000000000000000000000000000..f6b48d227a1a637d33969ab75d9bfacd533f222c GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTD77FlAO9q|%PKnR^sWb*5p4XC zTzaK_tNw|1dNA)g6uYVEWz)`WCvN3Wdfnqy6dNe1$KUm?XweQm`>q#U3nSKPaJ_kT h?eJkikH7CdB~QD_%?UUE#s;*9!PC{xWt~$(697-#KuiDt literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/correction_reset_3.png b/HomeLESS_Hit_Analyzer/graphics/correction_reset_3.png new file mode 100644 index 0000000000000000000000000000000000000000..cba5d5c99e0fc7fba06eac5aeb7a713216660c4d GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTD77;17g|{Of0EIXU zJR*x382Cy+m@!*r^EIGgjHioZNX4zAR~@++6gXHMdgZQN{vF9VSGPA+)SC77gM%&w zOUtfFH7LyGec_dU^Y^tGIx}8(?D;9S^W6%i>%yTAyB54yr_lAfYjMXqk*=qw79Cjk iF1DtIY3c8IA=1mmH!{F)a=d#Wzp$P!u&O=lH literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/minus_1.png b/HomeLESS_Hit_Analyzer/graphics/minus_1.png new file mode 100644 index 0000000000000000000000000000000000000000..96baa093df938be4094347371a95b8b576b46996 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW>Fr76Q)u>^J3@B=(Y*+C(pfVzS_Syt#_8IHv_|m7LKC3PWMxQ<}i4=`njxgN@xNA1x78f literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/minus_2.png b/HomeLESS_Hit_Analyzer/graphics/minus_2.png new file mode 100644 index 0000000000000000000000000000000000000000..7d5e1a799d13d8c0a5a7271e3dffcdbc4c71c376 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW>Fp~)9}aNfI^%F z9+AZi416UZ%$TjR`5I8r#?!?yq~ca`!UDMjmPgj*?*j5BbainFi{3TOy0#*6i%BTo2#`n#17f>gTe~DWM4fuQo2P literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/minus_3.png b/HomeLESS_Hit_Analyzer/graphics/minus_3.png new file mode 100644 index 0000000000000000000000000000000000000000..ed9cd3034bf3f7ad2f0f09b6515a9c7f27f9ea51 GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW>Fp`+0f_=pb%$) zM`SSr178UUGiIx7z6KPu_H=O!skoJ#us|+><H?A8#B_M0fjgV zJR*x382Cy+m@!*r^EIHLzo(01NX4z>gavX5ERUGk`2zALG&eH~i{3RAI+LWhf=Ob9 z0NX(gsWo*nYtj-qt1A*7iy!alQhefWa=d?;e$-4?i+thuSA1did|{hca5Cg`3zps3 SlMo9un!(f6&t;ucLK6USwK1yz literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/plus_2.png b/HomeLESS_Hit_Analyzer/graphics/plus_2.png new file mode 100644 index 0000000000000000000000000000000000000000..8580ca97d9717e0b03f1f8b4af68c912d76e24cb GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW>H>^C$pQ)fkK=G z9+AZi416UZ%$TjR`5I8r-_yl0q~ca`!UDMjmPgj*?*j5BbainFi{3RAI+LWhf=Ob9 z0NX(gsWo*nYtj-qt1A*7iy!alQhefWa=d?;e$-4?i+thuSA1did|{hca5C)D7d*8* SpjirNG=rzBpUXO@geCyW*)rw; literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/plus_3.png b/HomeLESS_Hit_Analyzer/graphics/plus_3.png new file mode 100644 index 0000000000000000000000000000000000000000..1b615da1d08f7a5abd997d82e942d5debbf5cb93 GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTDW>H=v$)8oeKq1Zo zkH}&M2EGyyX3SREd<`h*@9E+gQgJIeVS!u%%cKAQWmhB!JZ4nW+Lf&`rt3iMw zPg9^t#9xbuvxkJfeK>GTzfV%s`9yz4pS*AU7NhQhduscx$gZiAS(6qh%)pSxAXp+d Sw`LO1Xa-MLKbLh*2~7YZVl-_4 literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/scale_reset_1.png b/HomeLESS_Hit_Analyzer/graphics/scale_reset_1.png new file mode 100644 index 0000000000000000000000000000000000000000..0834ce208b6b3b4779a707988be2c6d4aa452463 GIT binary patch literal 244 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTD77S1Kq1Zo zkH}&M2EGyyX3SREd<`f#+0(@_q~g}uDG#|C3^-b*|469*VjI`RPe>Ww)2^Q4le0H8_>2G`(UC nhv28%+c(6$jKBZ;Tq#rIT5s#(?^!WG=P`J?`njxgN@xNAyBS&? literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/scale_reset_2.png b/HomeLESS_Hit_Analyzer/graphics/scale_reset_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a7fc6f7d1839f811b519a525c4016898964365da GIT binary patch literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTD77WXNX4zQQ!a8IFyL?rE}ZhlKCms*@kRSbzlGaO0x~{S ze(Xu<*;g8KKkD_)3v+^{Ucb6>$?M~{$=e?J_Lqx(t(xiH+@V}DPk}>K;Mn=_yN~Cs zNVEv$u~sNG>DBTtVEtsgAS`2Y{KhM-mof}ibCho1mRzt;=jP4A=;Pc@fx#S$=cpBR o9`6!R++WN6dg{Ngd*8>X{}b@Gj$a~C2y`EVr>mdKI;Vst0Bkj0yZ`_I literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/scale_reset_3.png b/HomeLESS_Hit_Analyzer/graphics/scale_reset_3.png new file mode 100644 index 0000000000000000000000000000000000000000..27c388ea9cce18c3d4ecdd3a3580e8897628e97f GIT binary patch literal 244 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1SGw?g-n1Hdx@v7EBhTD77o4W$av#r^lpPn>Vc6;d_1rgI$gHxGG(<|0+ m2!6V~eM8*K`1`-ll`^i3_qNtOvuGR8c?_PeelF{r5}E+_ZCYOd literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/scroll_down_1.png b/HomeLESS_Hit_Analyzer/graphics/scroll_down_1.png new file mode 100644 index 0000000000000000000000000000000000000000..c2bd66968ebfd72ffe638e5613da2a696ccee5a8 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEa{HEjtmSN`?>!lvI6;>1s;*b z3=DiFAk3JpviTZNkiEpy*OmPa53?x0&cy?&Yk)%4o-U3d9^P-KIC33O;9>O3$*)Ji#N~MplN^ohNpr|CCr2W%gDuwc+_E-o`K6*43Bnm3#Z!@%6ppJYR_m z;lb^#?hebZa432o-*swFgqNdIz?ACD6PzN9E8aw9PhkuYu%5ztL4f6gfX4PH@%7xC cPHFF1B3g2tKOA{10(1t0r>mdKI;Vst0KT11ga7~l literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/scroll_down_2.png b/HomeLESS_Hit_Analyzer/graphics/scroll_down_2.png new file mode 100644 index 0000000000000000000000000000000000000000..7ab10532b7616a99354cc368ae3e561e14be2400 GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEa{HEjtmSN`?>!lvI6;>1s;*b z3=DiFAk3JpviTZNkiEpy*OmPa53{I%fbrMxtw5n_PZ!4!5AU~A9JvlC@UUF|UvF4{ zQA|o;rDs`Yp5T#gBP+w|&J#P*e@d*1GJ7kS+VK1nZ{wG3>*`DP%Dw&V`1)RPp0C7( z@Zk1VcZcOyI265)?>e<7!pl)9U`lo72~H8l6>p-lr!WQxSWjWSAi#1#Kx2E9_!lvI6;>1s;*b z3=DiFAk3JpviTZNkiEpy*OmPa53{I%_}Ynw#DGH8o-U3d9^P-KIC33O;9+@u{?~u^ zOl=c|pviA8-BIcgPc2E>)_I~L?U%&f_{?DWiEJ~b>vJsGUh;SG>#r;B^GAK3XPkYg zVc)D!lvI6;>1s;*b z3=DiFAk3JpviTZNu)@>DF~r0B?Nx8C0}4DW7b^aHKTZ3$;zFyMvF^)df-K^vjGd1t zDQ!LfAu!Z5XPwfahQgmND=O;cu4~NCth8G9`aq7i$f60>8?JG%C|fhMDjZ=FIN>UA zpxLK|QRhX64Wr)#Y4J<8_vX1gxIS;bnCR8-g?lS&PTXW$|037!lvI6;>1s;*b z3=DiFAk3JpviTZNu)@>DF~r0B?Nx8C0}4DW7b^a1KhyiS;zFyMvF^)df-K^vjGd1t zDQ!LfAu!Z5XPwfahQgmND=O;cu4~NCth8G9`aq7i$f60>8?JG%C|fhMDjZ=FIN>UA zpxLK|QRhX64Wr)#Y4J<8_vX1gxIS;bnCR8-g?lS&PTXXRe8c+e#QnUZKsPXWy85}S Ib4q9e0P5sS3IG5A literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/scroll_up_3.png b/HomeLESS_Hit_Analyzer/graphics/scroll_up_3.png new file mode 100644 index 0000000000000000000000000000000000000000..3501b28162db5aca4b7400b403c7c0b5d76d9e9a GIT binary patch literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEa{HEjtmSN`?>!lvI6;>1s;*b z3=DiFAk3JpviTZNu+r1TF~r0B?Nvvv1_goEhcDCa{tt+9bLuYn7w$9LO&~^N{%46o z!_B+Se+cxBJe;Pl#FH`I-=*vO^TMs4rcRsw*ot2!*He*mCsVDjLeCvW5vLP83KO~o z4m2<8U^=rv@e_-LV_wXX>OHod53bLfKTYK7_rkrEHBa8K-N{Y;U)v(P73c^CPgg&e IbxsLQ0I@Jm2mk;8 literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/graphics/sensitivity_down_1.png b/HomeLESS_Hit_Analyzer/graphics/sensitivity_down_1.png new file mode 100644 index 0000000000000000000000000000000000000000..70d5579c31ba6cb178fd4da49b32bae3a105db76 GIT binary patch literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^k|4~%1|*NXY)uAIEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=sUo-U3d9-U981#%rw;BkI@<6zO3dpW;_T1vN-mYtYp@A&!3tR%() zg-C0L4iBjYm2D>9-R#>YoN4b_!F{o8?OvDHC9xeHGuTwla?H4%Dp_H)E$*SV0#}ft zioV;tkFt9hEcWbOZQ8kpGdA3`&+JOULwBofoFAV&5j-Mn;-7H#NOr<`8}pQD*EIg{ h)UpSCIJEyY%d8LP>kW0>F9Kc1;OXk;vd$@?2>>ftS14nJ z@ErkR#;MwT(m=sAo-U3d9-U{y9JvlC@N^$;fBN$8%`&038QZwJEIBVNTWc7_u;)e( z7em^%-UgLz1Y*@$(Js_u>a*_u7+~g-}NpZ%PYcFF8A~V&t2hivwG6L9^HlM z@?4uHNB;i6q7+-PE$V#8Qf}=vHq7N7JC2`P{@6pEmHl6={EfeEn}vSzyaBqK!PC{x JWt~$(698??XKw%i literal 0 HcmV?d00001 diff --git a/HomeLESS_Hit_Analyzer/ha.ini b/HomeLESS_Hit_Analyzer/ha.ini new file mode 100644 index 0000000..30ea28b --- /dev/null +++ b/HomeLESS_Hit_Analyzer/ha.ini @@ -0,0 +1,17 @@ +Webcam = 0 +Video width = 640 +Video height = 480 +Sensitivity = 3 +Style = 2 +SLH = 1 +Language = english +Caliber = 4.5 +Delay = 3 +Duration = 5 +Target = ultra.tgt +Scale = 1.0 +X correction = 4895 +Y correction = 4975 +Time = 800.0 +Prepare = 1 +Autoshootlog = 1 diff --git a/HomeLESS_Hit_Analyzer/languages/english.lng b/HomeLESS_Hit_Analyzer/languages/english.lng new file mode 100644 index 0000000..b9c280e --- /dev/null +++ b/HomeLESS_Hit_Analyzer/languages/english.lng @@ -0,0 +1,28 @@ +Shooter: +Correction: +Caliber: +Infobox: +Duration: +Targets list +New shoot +Select target: +Sound +SLH +Let's fire +Time: +Reset +Export +Points: +Hits: +Total: +Target: +HomeLESS - Hit Analyzer version 1.1b +Found target files: +Save changes +Shooting style: +Training +Sport +Combat +Hunting +Sensitivity: +Conditions: diff --git a/HomeLESS_Hit_Analyzer/targets/airgun_cz.tgt b/HomeLESS_Hit_Analyzer/targets/airgun_cz.tgt new file mode 100644 index 0000000..3bd3882 --- /dev/null +++ b/HomeLESS_Hit_Analyzer/targets/airgun_cz.tgt @@ -0,0 +1,13 @@ +Airgun CZ +0 +120 +108 +96 +84 +72 +60 +48 +36 +24 +12 +7 \ No newline at end of file diff --git a/HomeLESS_Hit_Analyzer/targets_methods.pde b/HomeLESS_Hit_Analyzer/targets_methods.pde new file mode 100644 index 0000000..409bf82 --- /dev/null +++ b/HomeLESS_Hit_Analyzer/targets_methods.pde @@ -0,0 +1,406 @@ +/* +This targets_method.pde is part of HomeLESS Hit Analyzer. + +HomeLESS Hit Analyzer is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or any later version. + +HomeLESS: Hit Analyzer is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with . If not, see . +*/ + + +public int number_of_black_diameter, number_of_biggest_diameter, t_black_center_image_size, t_white_border_image_size; +public int t_black_center_image_size_autoscaled, t_white_border_image_size_autoscaled; +public float f_targets_diameters[]; +public float f_hit_X, f_hit_Y,last_f_hit_Y, last_f_hit_X, f_delta_X, f_delta_Y; +public int brightestX_high, brightestX_low, brightestY_high, brightestY_low, brightestValue, i_detection_level = 254; +public int hit_points_actual =0, hit_points_last = 0, hit_points_sum = 0, hit_counter = 0, hit_areas_ok = 0; +public float projectile_diameter, txt_projectile_diameter; +public float f_current_radius, f_maximum_radius, f_diameter_scale, f_diameter_scale_autoscaled, f_radius_scale, target_scale, f_center_range = 0, square_max_lenght, f_square_scale, last_target_scale = 0; +public float A1X_autoscaled = 0, A1Y_autoscaled = 0, A2X_autoscaled = 0, A2Y_autoscaled = 0, B1X_autoscaled = 0, B1Y_autoscaled = 0, B2X_autoscaled = 0, B2Y_autoscaled = 0, CX_autoscaled = 0, CY_autoscaled = 0; +public float A1X = 0, A1Y = 0, A2X = 0, A2Y = 0, B1X = 0, B1Y = 0, B2X = 0, B2Y = 0, CX = 0, CY = 0, areas_width, areas_height, areas_side_ratio; +public float side_A1X, side_A1Y, side_A2X, side_A2Y, side_B1X, side_B1Y, side_B2X, side_B2Y; +public float shift_Y_init; + + + +public void analyze_the_target() +{ + //Recognize target + //circle target, square circle target + if(f_targets_diameters[0] == 0) + { + circle_target_analyze(); + }; + + //square circle target + if(f_targets_diameters[0] == 1) + { + square_circle_target_analyze(); + }; + //for circle target and square circle target + //f_radius_scale = f_diameter_scale / 2; + t_black_center_image_size_autoscaled = round(f_targets_diameters[number_of_black_diameter] * f_diameter_scale); + t_white_border_image_size_autoscaled = round(f_targets_diameters[number_of_biggest_diameter] * f_diameter_scale); + +}; + +public void scale_the_target() +{ + if(i_target_type == 0) + { + circle_target_scaling(); + }; + if(i_target_type == 1) + { + square_circle_target_scaling(); + }; + +} + + + + +void find_position_of_hit() +{ + video.loadPixels(); + // reset position of the brightest pixel + brightestX_high = 0; + brightestY_high = 0; + brightestX_low = 0; + brightestY_low = 0; + brightestValue = 0; // Brightness of the brightest video pixel + //for best result must be picture monochromatic + //scanning the picture from top left to botom right + int index = 0; + i_detection_level = 255 - i_sensitivity; + for (int y = 0; y < video_height; y++) + { + for (int x = 0; x < video_width; x++) + { + // Get the color stored in the pixel + int pixelValue = video.pixels[index]; + // Determine the brightness of the pixel + float pixelBrightness = brightness(pixelValue); + // filttering the brightest pixel + if (pixelBrightness > i_detection_level) //sensitive + { + // If that value is brighter than any previous, then store the + // brightness of that pixel, as well as its (x,y) location + // This select the first brightest pixel + if (pixelBrightness > brightestValue) + { + brightestValue = int(pixelBrightness); + brightestY_high = y; + brightestX_high = x; + } + //This select the last brightest pixel + brightestY_low = y; + brightestX_low = x; + } + index++; + } + } +}; + + +public void calculate_hit_range() +{ + // This calculate the center betwen first and last brightest pixel + f_hit_Y = (brightestY_high + brightestY_low) / 2.0; // X-coordinate of the brightest video pixel + f_hit_X = (brightestX_high + brightestX_low) / 2.0; // Y-coordinate of the brightest video pixel + f_hit_Y += (y_projectile_shift * f_diameter_scale); + f_delta_X = target_diameters_center_X + correction_X - f_hit_X; // plus offset + f_delta_Y = target_diameters_center_Y + correction_Y - f_hit_Y; // plus offset + // Calculate distance from center + f_center_range = sqrt((f_delta_X * f_delta_X)+ (f_delta_Y * f_delta_Y)); + //f_center_range = round(f_center_range); + + //DEBUG accuracy + /* + System.out.println("f_center_range: " + f_center_range); + System.out.println("f_hit_X: " + f_hit_X); + System.out.println("f_hit_X: " + f_hit_X); + */ + +} + +public void hit_area_test() +{ + // make border depended on projectile diameter + //test area A + //left up corner of area A + side_A1X = A1X + correction_X; + side_A1X -= (projectile_diameter * f_radius_scale); + side_A1Y = A1Y + correction_Y; + side_A1Y -= (projectile_diameter * f_radius_scale); + //right down corner of area A + side_A2X = side_A1X + A2X; + side_A2X += (projectile_diameter * f_diameter_scale);// side_A1X is shiftet by radius, so its necesary to shift side_A2X with twice radius (diameter) + side_A2Y = side_A1Y + A2Y; + side_A2Y += (projectile_diameter * f_diameter_scale); + + if((f_hit_X > side_A1X) && (f_hit_Y > side_A1Y)) + { + if((f_hit_X < side_A2X) && (f_hit_Y < side_A2Y)) + { + hit_areas_ok = 1; + } + }; + + //test area B + //left up corner of area B + side_B1X = B1X + correction_X; + side_B1X -= (projectile_diameter * f_radius_scale); + side_B1Y = B1Y + correction_Y; + side_B1Y -= (projectile_diameter * f_radius_scale); + //right down corner of area B + side_B2X = side_B1X + B2X; + side_B2X += (projectile_diameter * f_diameter_scale); + side_B2Y = side_B1Y + B2Y; + side_B2Y += (projectile_diameter * f_diameter_scale); + + if((f_hit_X > side_B1X) && (f_hit_Y > side_B1Y)) + { + if((f_hit_X < side_B2X) && (f_hit_Y < side_B2Y)) + { + hit_areas_ok = 1; + } + }; + + + + +} + + + +public void hit_points_calculation() +{ + + //f_targets_diameters = at_airgun_cz_diameters; // this will be in combobox targets handeler + // radius scale make diameters to radius + f_maximum_radius = int((f_targets_diameters[number_of_biggest_diameter] + projectile_diameter) * f_radius_scale); + //hit_area_test(); + + if(i_target_type == 0)// cirlce target + { + for(int i = 1; i < 11 ;i++ ) + { + f_current_radius = (f_targets_diameters[i] + projectile_diameter) * f_radius_scale; + if(f_center_range <= f_current_radius) + { + hit_points_actual = i; + } + if(f_center_range > f_maximum_radius) + hit_points_actual = 0; + } + }; + + + + if(i_target_type == 1) //circle square target + { + hit_area_test(); + if(hit_areas_ok == 1) + { + for(int i = 1; i < 11 ;i++ ) + { + f_current_radius = (f_targets_diameters[i] + projectile_diameter) * f_radius_scale; + if(f_center_range <= f_current_radius) + { + hit_points_actual = i; + } + if(f_center_range > f_maximum_radius) + hit_points_actual = 0; + } + } + + if(hit_areas_ok ==0) + { + hit_points_actual = 0; + } + hit_areas_ok =0; + }; + + + if(b_Shooting) + hit_points_sum += hit_points_actual; +}; + + + +//target analyze + +public void set_number_of_biggest_diameter() +{ + if(f_targets_diameters[1] != 0) + { + number_of_biggest_diameter = 1; + } + else for(int i = 1; i <= 9; i++) + { + //System.out.println("i: " + i); // numbers of circles + if(f_targets_diameters[i] == 0) + { + number_of_biggest_diameter = (i + 1); + } + else break; + }; + //System.out.println("Number_of_biggest_diameter: " + number_of_biggest_diameter); +} + + +public void circle_target_analyze() +{ + number_of_black_diameter = int(f_targets_diameters[11]); + f_diameter_scale_autoscaled = (video_height - 24) / f_targets_diameters[number_of_biggest_diameter]; //automatic scaling for maximum diameter + f_diameter_scale = f_diameter_scale_autoscaled; //first init f_diameter_scale + f_radius_scale = f_diameter_scale / 2; //first init radius scale + i_target_type = 0; +}; + + +public void square_circle_target_analyze() +{ + float shift_X, shift_Y; + number_of_black_diameter = int(f_targets_diameters[11]); + + areas_height = A2Y + B2Y; + //areas width + if((A1X + A2X) <= B2X) + { + areas_width = B2X; + } + else + { + areas_width = A1X + A2X; + }; + + + + //System.out.println("f_resolution_ratio: " + f_resolution_ratio); + //System.out.println("areas_width: " + areas_width); + //System.out.println("areas_height: " + areas_height); + + //areas side ratio + areas_side_ratio = areas_width / (areas_height * f_resolution_ratio); + System.out.println("areas_side_ratio: " + areas_side_ratio); + + if (areas_side_ratio <= 1) + { + f_square_scale = (video_height - 50) / areas_height; + //System.out.println("f_square_scale: " + f_square_scale); + + } + else + { + f_square_scale = (video_width - 50) / areas_width; + //System.out.println("f_square_scale: " + f_square_scale); + }; + + A1X_autoscaled = A1X * f_square_scale; + A1Y_autoscaled = A1Y * f_square_scale; + A2X_autoscaled = A2X * f_square_scale; + A2Y_autoscaled = A2Y * f_square_scale; + B1X_autoscaled = B1X * f_square_scale; + B1Y_autoscaled = B1Y * f_square_scale; + B2X_autoscaled = B2X * f_square_scale; + B2Y_autoscaled = B2Y * f_square_scale; + CX_autoscaled = CX * f_square_scale; + CY_autoscaled = CY * f_square_scale; + + // first init + A1X = A1X_autoscaled; + A1Y = A1Y_autoscaled; + A2X = A2X_autoscaled; + A2Y = A2Y_autoscaled; + B1X = B1X_autoscaled; + B1Y = B1Y_autoscaled; + B2X = B2X_autoscaled; + B2Y = B2Y_autoscaled; + CX = CX_autoscaled; + CY = CY_autoscaled; + + + shift_X = (video_width - (areas_width * f_square_scale)) / 2; + shift_Y = (video_height - (areas_height * f_square_scale)) / 2; + shift_Y_init = shift_Y; + A1X += shift_X; + A1Y += shift_Y; + B1X += shift_X; + B1Y += shift_Y; + + //DEBUG accuracy + /* + System.out.println("A1X: " + A1X); + System.out.println("A1Y: " + A1Y); + System.out.println("A2X: " + A2X); + System.out.println("A2Y: " + A2Y); + System.out.println("B1Y: " + B1Y); + */ + + + target_diameters_center_X = (int)(CX + shift_X); + target_diameters_center_Y = (int)(CY + shift_Y); + + //prepare for methosd target_scale + A1X_autoscaled = A1X; + A1Y_autoscaled = A1Y; + B1X_autoscaled = B1X; + B1Y_autoscaled = B1Y; + + + + f_diameter_scale = f_square_scale;//first init f_diameter_scale + f_diameter_scale_autoscaled = f_diameter_scale; + + + + f_radius_scale = f_diameter_scale / 2.0; //first init radius scale + i_target_type = 1; +} + +public void circle_target_scaling() +{ + if(last_target_scale != target_scale) + { + f_diameter_scale = f_diameter_scale_autoscaled * target_scale; + f_radius_scale = f_diameter_scale / 2.0; + last_target_scale = target_scale; + t_black_center_image_size = round(t_black_center_image_size_autoscaled * target_scale); + t_white_border_image_size = round(t_white_border_image_size_autoscaled * target_scale); + } +} + +public void square_circle_target_scaling() +{ + //this damm method i did for 5 hours... + if(last_target_scale != target_scale) + { + f_diameter_scale = f_diameter_scale_autoscaled * target_scale; + f_radius_scale = f_diameter_scale / 2.0; + last_target_scale = target_scale; + t_black_center_image_size = round(t_black_center_image_size_autoscaled * target_scale); + t_white_border_image_size = round(t_white_border_image_size_autoscaled * target_scale); + + A2X = A2X_autoscaled * target_scale; + A2Y = A2Y_autoscaled * target_scale; + A1X = A1X_autoscaled - (((A2X_autoscaled * target_scale) - A2X_autoscaled ) / 2); + A1Y = A1Y_autoscaled + (CY_autoscaled - (CY_autoscaled * target_scale)); + + + B2X = B2X_autoscaled * target_scale; + B2Y = B2Y_autoscaled * target_scale; + B1X = B1X_autoscaled - (((B2X_autoscaled * target_scale) - B2X_autoscaled ) / 2); + B1Y = A2Y + A1Y; + } +} + + diff --git a/HomeLESS_Hit_Analyzer_license.txt b/HomeLESS_Hit_Analyzer_license.txt deleted file mode 100644 index 618c47e..0000000 --- a/HomeLESS_Hit_Analyzer_license.txt +++ /dev/null @@ -1 +0,0 @@ -HomeLEES Hit Analyzer version 1.0a is licensed under GPL. \ No newline at end of file diff --git a/gpl-2.0.txt b/gpl-2.0.txt new file mode 100644 index 0000000..b7cbbdc --- /dev/null +++ b/gpl-2.0.txt @@ -0,0 +1,138 @@ +GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + +one line to give the program's name and an idea of what it does. +Copyright (C) yyyy name of author + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details +type `show w'. This is free software, and you are welcome +to redistribute it under certain conditions; type `show c' +for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' +(which makes passes at compilers) written +by James Hacker. + +signature of Ty Coon, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. \ No newline at end of file