Merge remote-tracking branch 'origin/main' into Kronjuwild

This commit is contained in:
Joshua 2024-11-14 17:14:13 +01:00
commit c8528a6b58
5 changed files with 55 additions and 145 deletions

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="91d861bd-39f2-4f7d-9002-31d86c6d3b79" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Record" />
<option value="Enum" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: -1
}</component>
<component name="ProjectId" id="2o43faNdzvB3omBPjZ0MFw1dSOh" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Downloaded.Files.Path.Enabled": "false",
"Repository.Attach.Annotations": "false",
"Repository.Attach.JavaDocs": "false",
"Repository.Attach.Sources": "false",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "ole",
"last_opened_file_path": "C:/Users/OleWachtel/Desktop/Uni/WeSe2425/programmieren-projekt",
"project.structure.last.edited": "Libraries",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.2",
"settings.editor.selected.configurable": "preferences.lookFeel"
},
"keyToStringList": {
"GitStage.ChangesTree.GroupingKeys": [
"directory",
"module",
"repository"
]
}
}]]></component>
<component name="RunManager">
<configuration name="HalloSchiffeVersenken" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="HalloSchiffeVersenken" />
<module name="SchiffeVersenken" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.HalloSchiffeVersenken" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="91d861bd-39f2-4f7d-9002-31d86c6d3b79" name="Changes" comment="" />
<created>1730115126753</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1730115126753</updated>
</task>
<task id="LOCAL-00001" summary="add Java Project">
<option name="closed" value="true" />
<created>1730115284405</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1730115284405</updated>
</task>
<task id="LOCAL-00002" summary="add SoundHandler to Play sounds and Mute global">
<option name="closed" value="true" />
<created>1730129036486</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1730129036486</updated>
</task>
<task id="LOCAL-00003" summary="delete Sounds.java">
<option name="closed" value="true" />
<created>1730129210987</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1730129210987</updated>
</task>
<task id="LOCAL-00004" summary="add classes blank">
<option name="closed" value="true" />
<created>1730201990808</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1730201990808</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="add Java Project" />
<MESSAGE value="add SoundHandler to Play sounds and Mute global" />
<MESSAGE value="delete Sounds.java" />
<MESSAGE value="add classes blank" />
<option name="LAST_COMMIT_MESSAGE" value="add classes blank" />
</component>
</project>

BIN
libs/jlayer-1.0.3.jar Normal file

Binary file not shown.

36
makefile Normal file
View File

@ -0,0 +1,36 @@
MAIN_CLASS := HalloSchiffeVersenken
JAR_NAME := schiffeVersenken.jar
SRC_DIR := src
OUT_DIR := bin
LIB_DIR := libs
JC := javac
JCFLAGS := -d $(OUT_DIR)/ -cp "$(LIB_DIR)/*"
JR := java
SEPERATOR := :
ifeq ($(OS),Windows_NT)
SEPERATOR := ;
endif
.SUFFIXES: .java
.PHONY: classfiles clean
classfiles: $(SRC_DIR)/*
$(JC) $(JCFLAGS) $(SRC_DIR)/*
jar: classfiles
jar --create --file=$(OUT_DIR)/$(JAR_NAME) --main-class=$(MAIN_CLASS) -C $(OUT_DIR)/ .
test-jar: jar
# $(JR) -cp "$(OUT_DIR)/:$(LIB_DIR)/*" $(MAIN_CLASS)
$(JR) -jar $(OUT_DIR)/$(JAR_NAME)
test: classfiles
$(JR) -cp "$(OUT_DIR)$(SEPERATOR)$(LIB_DIR)/*" $(MAIN_CLASS)
clean:
rm $(OUT_DIR)/*.class

View File

@ -11,9 +11,9 @@ public class HalloSchiffeVersenken {
/*
System.out.println("sound");
SoundHandler.playSound("hit");
Thread.sleep(3000);
System.out.println("sound");
SoundHandler.playSound("hit");
Thread.sleep(10000);
SoundHandler.setSoundOn(false);
System.out.println("sound off");
SoundHandler.playSound("hit");

View File

@ -10,22 +10,30 @@ import java.util.Map;
public class SoundHandler {
private static boolean soundOn = true;
// Wenn fehler beim erstellen von .jar mit sound hier gucken
private static HashMap<String, String> sounds = new HashMap<String, String>(Map.of(
"hit", "~/../Sound/water-drip.mp3"
"hit", "./Sound/water-drip.mp3"
));
public static void playSound(String soundName) {
if (soundOn) {
try {
Player player = new Player(new FileInputStream(sounds.get(soundName)));
player.play();
} catch (JavaLayerException | FileNotFoundException e) {
System.out.println("dslkfsfnsldfnlsnfsdnölscls");
e.printStackTrace();
}
new Thread(new Runnable() {
@Override
public void run() {
try {
Player player = new Player(new FileInputStream(sounds.get(soundName)));
player.play();
} catch (JavaLayerException | FileNotFoundException e) {
e.printStackTrace();
}
}
}).start();
}
}
static void add(String soundName, String path){
sounds.put(soundName, path);
}