Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 ... 10
 1 
 on: 2014-11-23 01:19:52 
Started by united121 - Last post by basil_
oh, you've been faster than me Smiley .. it "should" work.

 2 
 on: 2014-11-23 01:18:25 
Started by united121 - Last post by basil_
no worries Smiley

the args could be something like :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
int port = 7778;
String baseDir = "path_where_to_store_databases";

String[] args =
{
  "-tcp",
  "-tcpPort", Integer.toString(port),
  "-baseDir", baseDir,
  "-tcpDaemon",
  "-tcpAllowOthers"
  // "-ifExists" // do not create new databases
};

when you start the server, it's done. connecting to the server is done the same way you would connect a mysql server from java.

before doing that, it's good to test if you can connect at all. which IDE do you use? as mentioned, it probably comes with a buildin tool which can connect databases.

to create a new database, you simple connect it. if the database is not existing, it will be created by the server. then it's empty.

once connected you can issue all the usual
create table ...; select * from ...; etc etc
statements.

or you have a .sql file written before and load it into the database : http://www.h2database.com/html/grammar.html?highlight=SOURCE_DATA_TYPE&search=source#runscript

if you're used to mysql - this grammar is a bit more strict. it's basically sql99 standard. http://en.wikipedia.org/wiki/SQL:1999

tho' if you connect using jdbc : http://www.h2database.com/html/tutorial.html#connecting_using_jdbc you can pass a few hints to the server http://www.h2database.com/html/features.html#compatibility

a simple jdbc url could look like
1  
2  
3  
4  
5  
6  
7  
8  
String host = "localhost";
int port = 7779;

String database = "my_database";

String params = ";IFEXISTS=TRUE;MODE=MySQL"; // mimic mysql.

String url = "jdbc:h2:tcp://" + host + ":" + port + "/" + database + params;

after connecting this, you should see a
my_database
file under the
baseDir
directory.

 3 
 on: 2014-11-23 01:03:15 
Started by Jacob Pickens - Last post by Jacob Pickens
The game is challenger, i like it Cheesy
You forgot to rename the window title version . It still say' "Zombie Nauts - 0.4.5"

Thanks I'll fix that right now!

 4 
 on: 2014-11-23 00:56:57 
Started by Jacob Pickens - Last post by death_angel
The game is challenger, i like it Cheesy
You forgot to rename the window title version . It still say' "Zombie Nauts - 0.4.5"

 5 
 on: 2014-11-23 00:51:53 
Started by united121 - Last post by united121
It support classic SQL ( how I can send SQL command - I dont see that options ? ) and how I can create database or how I can distrube it with this program ? Cheesy sounds like I am noob but I think  that you are more familier with it and can help me

I have written this code already
1  
2  
3  
4  
5  
6  
Server serverH2 = Server.createTcpServer("-tcpPort", "8888", "-tcpAllowOthers").start();
       
        conn = DriverManager.getConnection("jdbc:h2:~/test", "root", "");
        if (conn == null) {
            throw new IllegalAccessException("Error in connection");
        }

and of cource disconnect statement.
and then the same code like with my local MySQL - correct aproach ?

or in code a need call this ? - dont try to get meaning of this words (it is Czech language)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
CREATE TABLE IF NOT EXISTS `herogame_hero` (
`ID_hero` int(11) NOT NULL,
  `jmeno` varchar(255) COLLATE utf8_bin NOT NULL,
  `zivot` int(11) NOT NULL,
  `mana` int(11) NOT NULL,
  `vydrz` int(11) NOT NULL,
  `degMana` int(11) NOT NULL,
  `degVydr` int(11) NOT NULL,
  `jmenoUtoku1` varchar(255) COLLATE utf8_bin NOT NULL,
  `utok1` int(11) NOT NULL,
  `jmenoUtoku2` varchar(255) COLLATE utf8_bin NOT NULL,
  `utok2` int(11) NOT NULL,
  `jmenoObrany` varchar(255) COLLATE utf8_bin NOT NULL,
  `obrana` int(11) NOT NULL,
  `jmenoSpecUtoku` varchar(255) COLLATE utf8_bin NOT NULL,
  `specUtok` int(11) NOT NULL,
  `picture` varchar(255) COLLATE utf8_bin NOT NULL,
  `username` varchar(255) COLLATE utf8_bin NOT NULL,
  `password` varchar(255) COLLATE utf8_bin NOT NULL
)

 6 
 on: 2014-11-23 00:46:33 
Started by MrPork - Last post by MrPork
Ummm, well I managed to solve it myself xD. I just switched the width and height of the Rectangle on creation.

 7 
 on: 2014-11-23 00:43:23 
Started by MrPork - Last post by MrPork
I'm using Slick2D and iv'e got the direction and the movement sort of working. My problem is that the rectangle I have moves in the direction that it is facing when I press the 'W' key, but it doesn't use the right edge of the rectangle to do so, I want the shorter edge to do the rotating and moving . I will provide a drawing of what is happening below the code

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
[quote]public class Player {
   private Rectangle collisionRect;
   private int speed = 3;
   private float direction = 0;
   private Vector2f angle, position;
   private Input input;
   
   public Player(int x, int y, Input input){
      position = new Vector2f();
      angle = new Vector2f();
     
      this.position.x = x;
      this.position.y = y;
      this.input = input;
      collisionRect = new Rectangle(x, y, 120, 200);
   }
   public void render(Graphics g){
      g.rotate(collisionRect.getX() + collisionRect.getWidth()/2, collisionRect.getY() + collisionRect.getHeight()/2,  direction);
      g.draw(collisionRect);
   }
   public void update(){
      collisionRect.setLocation(position.x, position.y);
     
      angle.x = (float) Math.cos(Math.toRadians(direction));
      angle.y = (float) Math.sin(Math.toRadians(direction));
   
      if(input.isKeyDown(Input.KEY_W)){
         position.x += angle.x * speed;
         position.y += angle.y * speed;
      }
      if(input.isKeyDown(Input.KEY_A)){
         direction -= 1;
      }
      if(input.isKeyDown(Input.KEY_D)){
         direction += 1;
      }
   
     
   }

}[/quote]




 8 
 on: 2014-11-23 00:40:08 
Started by united121 - Last post by basil_
no no, you just "run" the sever when you start the jvm (the game). they call it "embedded mode".

include H2 jars to classpath and use the API as described here : http://www.h2database.com/html/tutorial.html#using_server

1  
2  
3  
4  
5  
6  
7  
import org.h2.tools.Server;
...
// start the TCP Server
Server server = Server.createTcpServer(args).start();
...
// stop the TCP Server
server.stop();


the "weird" thing about it is, on one hand you simply use a jdbc connection with the
org.h2.Driver
but on the other, creating a database works usually by connecting to a non-existing database, which is then created for you.

try starting the server in a simple java application, and then connect through your IDE. eclipse, netbeans or idea have nice build-in jdbc/database support. it's really easy once you got used to it a bit Smiley

 9 
 on: 2014-11-23 00:30:57 
Started by lcass - Last post by basil_
if you bundle resource files inside the classpath (like /src/..) you need to access them like
1  
getClass().getResourceAsStream("relative_path_to_current_class_which_does_this_call/resource.vert");
or
1  
getClass().getResourceAsStream("/absolute_path_below_src/resource.vert");
easier to put everthing outside the src root and use
new File("./shader/file.vert");
./ refers to the current working directory then. running from an IDE this would be a directory next to src.

 10 
 on: 2014-11-23 00:30:32 
Started by BurntPizza - Last post by HeroesGraveDev
Added multi-document support to Paint.JAVA.



Got a semi-stable release coming soon too.

Pages: [1] 2 3 ... 10
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (27 views)
2014-11-22 12:13:56

xFryIx (69 views)
2014-11-13 12:34:49

digdugdiggy (48 views)
2014-11-12 21:11:50

digdugdiggy (42 views)
2014-11-12 21:10:15

digdugdiggy (36 views)
2014-11-12 21:09:33

kovacsa (60 views)
2014-11-07 19:57:14

TehJavaDev (64 views)
2014-11-03 22:04:50

BurntPizza (62 views)
2014-11-03 18:54:52

moogie (77 views)
2014-11-03 06:22:04

CopyableCougar4 (77 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!