Skip to content

Commit

Permalink
Merge pull request #77 from ryankirkpatrick97/master
Browse files Browse the repository at this point in the history
F17_lab05
  • Loading branch information
scottpchow23 authored Nov 16, 2017
2 parents 065b572 + 62c23d1 commit 57ae519
Show file tree
Hide file tree
Showing 126 changed files with 2,007 additions and 1,575 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Package Files #
*.war
*.ear
*.jar

# Temp Files #
*~
*~
22 changes: 22 additions & 0 deletions Todo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Ryan Kirkpatrick and Ryan Lorica

### List of things that can be done (no particular order):

* Make this todo list once complete into issues.
* Add manifest for jar compilation
* Separate each of the guis. There are ones for the rules, the welcome, player
names, initial bets, and the actual game
* Idea for possibly setting players or similar objects as observers to a main
subject class that would control the flow of the game from player to player.
* Do composition for a lot of the gui elements like menubar
* Music stops looping after a while
* Current player should be displayed at the bottom without any notice of the
other players. After one player finishes, another should rotate to the front,
and start their turn. Also, we need to implement it in such a way that the player
class can affect these positions.
* Closing the naming players Gui doesn't stop the program from running. This can
be seen, because the music continues to play.
* Clean up the case statements of that are caused by number of players. These look very redundant, and they should be able to be refactored. There is also a block in the NameGui that can also be fixed.
* Make renaming with the menubar work properly.
* Create a main controller or something of sort to hold consistent variables, such as numPlayers, playerNames, and amountBet.
* The way players and player positions are handled needs an overhaul of refactoring.
64 changes: 32 additions & 32 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@

<!-- modified build.xml for CS56 Blackjack Project
name: Eric Palyan, W14 -->

<!-- modified build.xml for CS56 Blackjack Project
name: David Tsu, F16 -->

<property environment="env"/> <!-- load the environment variables -->
<property environment="env"/> <!-- load the environment variables -->
<property name="webRoot" value="${env.HOME}/"/>
<property name="webBaseUrl" value="http://www.cs.ucsb.edu/~${env.USER}"/>
<property name="course" value="cs56"/>
<property name="quarter" value="F16"/>
<property name="projectName" value="blackjack"/>
<property name="mainClass" value="edu.ucsb.cs56.projects.game.blackjack.BlackjackGui"/>
<property name="mainClass" value="edu.ucsb.cs56.projects.game.blackjack.Main"/>
<property name="projectPath" value="${course}/projects/game/${projectName}"/>
<property name="javadocDest" value="../cs56-games-blackjack_javadoc_davidtsu_chavez95/javadoc"/>
<property name="javadocURL" value="../cs56-games-blackjack_javadoc_davidtsu_chavez95/javadoc"/>

<property name="javadocDest" value="../cs56-games-blackjack_javadoc_davidtsu_chavez95/javadoc"/>
<property name="javadocURL" value="../cs56-games-blackjack_javadoc_davidtsu_chavez95/javadoc"/>
<property name="imagesDest" value="$../cs56-games-blackjack_javadoc_davidtsu_chavez95/images"/>


<path id="project.class.path">
<pathelement location="build"/>
<pathelement location="lib/junit-4.8.2.jar"/>
</path>

<!-- Compile src code -->
<target name="compile" description="compiles src code into .class files and stores them in build directory">
<mkdir dir="build"/>
Expand All @@ -42,7 +42,7 @@
<fileset dir="images" includes="*.gif"/>
</copy>
</target>

<!-- copy images to web -->
<target name="images" depends="compile,jar" description="copy images to web">
<delete dir="${webRoot}/${projectPath}/images"/>
Expand All @@ -51,14 +51,14 @@
<fileset dir="images" includes="*.gif"/>
</copy>
</target>

<!-- Run the Gui -->
<target name="run" depends="compile, jar" description="run the BlackjackGui">
<java fork="true" classname="${mainClass}">
<java fork="true" classname="${mainClass}">
<classpath refid="project.class.path"/>
</java>
</target>

<!-- Clean the directories -->
<target name="clean" description="delete unnecessary files and directories">
<delete failonerror="false" verbose="true">
Expand All @@ -70,7 +70,7 @@
<delete dir="temp" quiet="true"/>
<delete dir="build/images" quiet="true"/>
</target>

<!-- Run JUnit tests -->
<target name="test" depends="compile" description="run JUnit tests">
<junit haltonerror="no" haltonfailure="no">
Expand All @@ -81,32 +81,32 @@
<include name="**/*Test.java"/>
</fileset>
</batchtest>
<formatter type="plain" usefile="false"/>
<formatter type="plain" usefile="false"/>
</junit>
</target>

<!-- Javadoc -->
<target name="javadoc" depends="compile" description="prepare and post javadoc">
<delete dir="javadoc" quiet="true"/>
<javadoc destdir="javadoc" author="true" version="true" use="true">
<fileset dir="src" includes="**/*.java"/>
<target name="javadoc" depends="compile" description="prepare and post javadoc">
<delete dir="javadoc" quiet="true"/>
<javadoc destdir="javadoc" author="true" version="true" use="true">
<fileset dir="src" includes="**/*.java"/>
<classpath refid="project.class.path"/>
</javadoc>
<!-- delete the old javadoc -->
<delete quiet="true" dir="${javadocDest}"/>
<delete quiet="true" dir="${javadocDest}"/>
<!-- copy everything you just made to the javadoc destination, and then make it readable -->
<copy todir="${javadocDest}">
<fileset dir="javadoc"/>
</copy>
<!-- Note: this only does the chmod command on the
<copy todir="${javadocDest}">
<fileset dir="javadoc"/>
</copy>
<!-- Note: this only does the chmod command on the
javadoc subdirectory and its contents. You MIGHT have to
MANUALLY do the chmod on the parent directories. However,
you should only need to do that once. -->
<chmod dir="${javadocDest}" perm="755" type="dir" includes="**"/>
<chmod dir="${javadocDest}" perm="755" type="file" includes="**/*"/>
<echo>Javadoc deployed to ${javadocURL}</echo>
</target>
you should only need to do that once. -->
<chmod dir="${javadocDest}" perm="755" type="dir" includes="**"/>
<chmod dir="${javadocDest}" perm="755" type="file" includes="**/*"/>
<echo>Javadoc deployed to ${javadocURL}</echo>
</target>

<!-- JAR -->
<target name="jar" depends="compile" description="JAR up files and put into dist directory">
<mkdir dir="dist"/>
Expand All @@ -116,5 +116,5 @@
</manifest>
</jar>
</target>

</project>
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed dist/cs56_F16_blackjack.jar
Binary file not shown.
Binary file removed dist/cs56_W13_blackjack.jar
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
93 changes: 93 additions & 0 deletions src/edu/ucsb/cs56/projects/game/blackjack/BetGui.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package edu.ucsb.cs56.projects.game.blackjack;
import javax.swing.*;
import java.awt.*;

public class BetGui implements Gui{
JPanel outerPanel;

JFrame betFrame;
JPanel betPanel;
JLabel betTitleLabel;

JLabel betAmountLabel;
int amountBet;

JTextField betText;
JButton betButton;

JButton betAmount1;
JButton betAmount2;
JButton betAmount3;
JButton betAmount4;
JButton betAmount5;


/** creates window for betting
*/
public void display() {

// create the frame and panels, as well as set the layout
betFrame = new JFrame();
betPanel = new JPanel(new GridLayout(7,0,5,0));
betTitleLabel = new JLabel();

// set the main text and center it
betTitleLabel.setText("<html>How much would you<br>like to bet?</html>");
betTitleLabel.setHorizontalAlignment(JLabel.CENTER);

// by default have the $25 bet selected
betAmountLabel = new JLabel("$25");
betAmountLabel.setHorizontalAlignment(JLabel.CENTER); // center the label
amountBet = 25;

betText = new JTextField("Or enter your desired bet amount here");

// create bet amount buttons and assign ActionListeners
betAmount1 = new JButton("$25");
betAmount2 = new JButton("$50");
betAmount3 = new JButton("$100");
betAmount4 = new JButton("$250");
betAmount5 = new JButton("$500");

// create button to confirm selected bet amount
betButton = new JButton("Confirm Bet");
//betButton.addActionListener(new BeginGameListener());
// add widgets to panel
betPanel.add(betTitleLabel);
betPanel.add(betAmountLabel);
betPanel.add(betAmount1);
betPanel.add(betAmount2);
betPanel.add(betAmount3);
betPanel.add(betAmount4);
betPanel.add(betAmount5);
betPanel.add(betText);
betPanel.add(betButton);
betText.selectAll();

// create the outer panel to center the widgets
outerPanel = new JPanel();
outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.PAGE_AXIS));
outerPanel.add(Box.createHorizontalGlue());
outerPanel.add(betPanel);
outerPanel.add(Box.createHorizontalGlue());
// add the panel to the frame and set frame attributes
betFrame.add(outerPanel);
/*
// Since this is the only frame before the game starts, if this window
// is closed the application should terminate
betFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// If the betting frame is brought up at the end of a round and closed using the 'x' button the game
// should not be terminated.
if(!exit_on_close)
*/
betFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

betFrame.pack();
betFrame.setLocationRelativeTo(null); // center window
betFrame.setVisible(true);
}




}
Loading

0 comments on commit 57ae519

Please sign in to comment.