Jump to content


Active Members
  • Posts

  • Joined

  • Last visited

About danielbrthwt

  • Birthday 02/19/1996

Profile Information

  • Gender
  • Location
    New Zealand
  • Interests

Recent Profile Visitors

3,679 profile views

danielbrthwt's Achievements


Newbie (1/14)

  1. I started by learning Python and from there it was really easy to pick up other languages like Java and C++, Python was great for me because it helped me understand some of the basic concepts of programming in a very understandable way
  2. The directory is D:, and i tried it the directory as \\.\D: because i read somewhere that that's how you are ment to access logical drives but that dident work ether it just said that the parameter was in correct for this line RandomAccessFile rawAccess = new RandomAccessFile( cd, "r" ); [/CODE] i'm thinking that many the RandomFileAccess class cant access logical drives so ill have a look for a different class to read the data
  3. I thought that making some software that rips audio CD's and movies would be an interesting project, so to start i am trying to make something that takes the songs on a audio CD and saves to the hard rive as a WAV file, the only problem is that i cant seem to find much information on how to do this in Java and what i have found dosent, below is the code i have tried but when i run it i get access denied errors even when i run it as administrator import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.util.Scanner; public class learning { public static void main(String[] args) throws IOException { File cd = new File( "D:" ); RandomAccessFile rawAccess = new RandomAccessFile( cd, "r" ); byte[] content = new byte[2352]; rawAccess.readFully(content); System.out.println(content); } } [/CODE]. And the error i get is [CODE] Exception in thread "main" java.io.FileNotFoundException: D: (Access is denied) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<init>(Unknown Source) at learning.main(learning.java:13) [/CODE] Is there any way to read from the CD drive in Windows/Linux using java ?
  4. I am making a android game and at the moment i am working on a simple menu, this menu has 2 buttons one that generates a random map and lets you play it and one that takes you to a list of pre made levels. The problem is that if i press the random map button and run the game activity if i press the back button to return to the menu activity and try to play a random game again it crashes The following is the function that gets called when you press the random map button public void playRandom( View view ) { Intent intent = new Intent(this, CUBEGameActivity.class); intent.putExtra(EXTRA_MESSAGE, "RANDOM"); startActivity(intent); } [/CODE] how can i stop this, any help would be great Cheers Daniel
  5. I am trying to create a simple game for android, to start i am trying to make the square move down the y axis but the way i am doing it dosent move the square at all and i cant find any tutorials for GLES20 The on draw frame function in the render class updates the users position based on accleration dew to gravity, gets the transform matrix from the user class which is used to move the square down, then the program draws it. All that happens is that the square is drawn, no motion happens public void onDrawFrame(GL10 gl) { user.update(0.0, phy.AccelerationDewToGravity); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Re draws black background GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 12, user.SquareVB);//triangleVB); GLES20.glEnableVertexAttribArray(maPositionHandle); GLES20.glUniformMatrix4fv(maPositionHandle, 1, false, user.getTransformMatrix(), 0); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); } The update function in the player class is public void update(double vh, double vv) { Vh += vh; // Increase horrzontal Velosity Vv += vv; // Increase vertical velosity //Matrix.translateM(mMMatrix, 0, (int)Vh, (int)Vv, 0); Matrix.translateM(mMMatrix, 0, mMMatrix, 0, (float)Vh, (float)Vv, 0); }
  6. Thanks heaps it turns out it was the problem and now it works CHEERS !!
  7. Thanks i dident know that Open GL ES 1 was legacy i should probley use 2 before they conpleatly remove it
  8. Hey im trying to create a game for android but i am having some trouble with the Open GL im using, it works on the android emulator but not the actual phone, there both running the same OS which is 2.3.3. Has anyone else encountered these problems and how would you go about fixing them CODE LINKS : Player class ( One that contains the object coordinates ) - http://pastebin.com/mt0vxbCe OpenGLRender class - http://pastebin.com/YhbDbuX9 OpenGLSurfaceView - http://pastebin.com/4UejZgsm
  9. Thanks guys this will be great hopefully i can learn some things and understand the books online
  10. I am currently a collage student and I have been teaching my self programming for 2 years now and i have gotten quite interested in Artificial Intellengence but i cant find many books for learning this that are easy to understand is there anything anyone can recommend Cheers Daniel
  11. Me and a friend are thinking of making a 2D physics simulator for a school project but we have little knowledge of how to program GUIs with drawable objects does anyone have and good books or websites to learn from
  12. I was hoping to create a 14, 14 square and then make it so i can see through the square to what ever is underneath transparent
  13. I am designing a GUI in java and i need to make a transparent box that is resizeable and all i have found is how to make the whole frame transparent This is my GUI code import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JOptionPane; public class FloodItSolverGUI extends JFrame { private JButton scanButton; private JButton startButton; private JPanel window; private Board board = new Board(); private String[][] rawData; public FloodItSolverGUI( String[][] Data ) { super("Flood-It Solver"); setLayout( new FlowLayout() ); rawData = Data; scanButton = new JButton( "Scan Board" ); add( scanButton ); startButton = new JButton( "Start" ); add(startButton); ButtonHandler handler = new ButtonHandler(); scanButton.addActionListener(handler); startButton.addActionListener(handler); } private class ButtonHandler implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { if ( arg0.getActionCommand() == "Scan Board" ) { JOptionPane.showMessageDialog(FloodItSolverGUI.this, String.format("%s", "Sorry This Feture Is Not Available Yet")); } else if ( arg0.getActionCommand() == "Start" ) { String Result = ""; int[] results = board.runBot(rawData, 0); for ( int i = 0; i &lt; results.length; i++ ) { if ( results[i] != 0) Result += String.format("%d\n", results[i]); } JOptionPane.showMessageDialog(FloodItSolverGUI.this, Result); } } } }
  14. The problem was what you said but the clone() method didn't make a new/unconnected copy of my array of objects it just made a reference which is what it was doing in the first place so i made my own copy method which seemed to fix things public Square[][] copy( Square[][] board ) { Square[][] newBoard = new Square[14][14]; for ( int a = 0; a &lt; board.length; a++ ) { for ( int b = 0; b &lt; board[a].length; b++ ) { int col = board[a][b].getNum(); int score = board[a][b].getScore(); int gId = board[a][b].getGroupid(); int[][] groupArray = board[a][b].getGroupArray(); newBoard[a][b] = new Square(); newBoard[a][b].tempChange(col); newBoard[a][b].setScore(score); newBoard[a][b].addToGroup(gId); newBoard[a][b].setGroupArray(groupArray); } } return newBoard; } P.S int0x80 thanks for the tip that will be helpful when posting thing in the future :D
  15. It could be i will have a look can you give me an example of what to look for, also i debugged my program and saw that even tho i was cloneing the array Square board = new Square[14][14]; Square newBoard; newBoard = board.clone(); newBoard2[0][0].tempChange(4); when i changed a value in newBoard it still changed in board
  • Create New...