Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3
1  Discussions / Miscellaneous Topics / Re: What are Anti-Virus Developers Protecting us From? on: 2014-04-18 16:20:27
kaspersky removes files without asking and you can't restore it. It destroyed my custom sound-driver and it killt the software I used for playing with www.hackthissite.org and some other stuff. (And yes the software was clean)
I agree, Kaspersky treats the term  "malicious software" too widely.
2  Discussions / Miscellaneous Topics / Re: What are Anti-Virus Developers Protecting us From? on: 2014-04-14 09:29:02
They are, in fact, a massive con... Everything else is either selling fear or misguidedly unhelpful.
Agree.

The only AV checker you ever need is MS Security Essentials on Windows.
MSSE overlooks many of threats
3  Game Development / Newbie & Debugging Questions / Re: How to create a control panel next to a Canvas object in a JFrame? on: 2014-04-14 09:18:39
I wanted to do something like this. It's basically a JFrame consisting of a Canvas on one side, and something on the other side.
Most likely you should use JSplitPane
4  Game Development / Newbie & Debugging Questions / Re: Swing JComboBox problem. on: 2014-04-09 10:44:58
I think it's what you looking for: http://tips4java.wordpress.com/2013/11/17/combo-box-with-custom-renderer/
5  Game Development / Newbie & Debugging Questions / Re: My most inefficient way of implementing running texts. How to optimize? on: 2014-04-09 10:25:36
Couldn't find the right way to make it stop adding text to the already-36-characters-long "line" variable (not the "lines" ArrayList variable.).
I think you should check max height of the text that can be inserted in the window.

Also, IIRC, if the word > MAX_STRING_LENGTH it should be split on 2 parts:
first part =< MAX_STRING_LENGTH, the remainder is moved on the next line.
6  Game Development / Newbie & Debugging Questions / Re: Pasting PrintScreen from clipboard. on: 2014-04-08 07:36:17
look at this http://forum.codecall.net/topic/58122-java-copy-image-from-clipboard/
7  Game Development / Newbie & Debugging Questions / Re: My most inefficient way of implementing running texts. How to optimize? on: 2014-04-06 06:46:51
If we deal with Swing it is enough to add JPanel.setDoubleBuffered( true ).
8  Game Development / Newbie & Debugging Questions / Re: My most inefficient way of implementing running texts. How to optimize? on: 2014-04-05 19:30:15
Maybe it will help you:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
package com.company;

import javax.swing.*;

public class Main
{

    public static void main( String[] args )
    {
        JFrame frame = new TextLayoutLineBreakerMeasurer();
        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

        frame.setSize( 200, 200 );
        frame.setVisible( true );
    }
}


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  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
package com.company;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;

public class TextLayoutLineBreakerMeasurer extends JFrame
{
    String m = "HAPPENING TOMORROW!!";

    int i;

    final javax.swing.Timer t;

    public TextLayoutLineBreakerMeasurer() throws HeadlessException
    {
        t = new javax.swing.Timer( 200,
                new ActionListener()
                {
                    public void actionPerformed( ActionEvent e )
                    {
                        if( ++i == m.length() )
                        {
                            t.stop();
                        }
                        repaint();
                    }
                }
        );
        t.start();
    }

    public void paint( Graphics g )
    {
        String s = m.substring( 0, i );
        if( s.isEmpty() )
        {
            return;
        }
        Graphics2D graphics2D = ( Graphics2D ) g;
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        Font font = new Font( "Arial", Font.PLAIN, 24 );
        AttributedString messageAS = new AttributedString( s );
        messageAS.addAttribute( TextAttribute.FONT, font );
        AttributedCharacterIterator messageIterator = messageAS.getIterator();
        FontRenderContext messageFRC = graphics2D.getFontRenderContext();
        LineBreakMeasurer messageLBM = new LineBreakMeasurer( messageIterator,
                messageFRC );

        Insets insets = getInsets();
        float wrappingWidth = getSize().width - insets.left - insets.right;
        float x = insets.left;
        float y = insets.top;

        while( messageLBM.getPosition() < messageIterator.getEndIndex() )
        {
            TextLayout textLayout = messageLBM.nextLayout( wrappingWidth );
            y += textLayout.getAscent();
            textLayout.draw( graphics2D, x, y );
            y += textLayout.getDescent() + textLayout.getLeading();
            x = insets.left;
        }
    }
}
9  Game Development / Newbie & Debugging Questions / Re: My most inefficient way of implementing running texts. How to optimize? on: 2014-04-05 13:55:03
It seems to me that your task is the job for java.awt.font.LineBreakMeasurer.
10  Game Development / Newbie & Debugging Questions / Re: Why a NaN variable is not equal to Double.NaN? on: 2014-04-02 04:48:06
how do I fix it?
Do the following:
1  
2  
3  
4  
double x = ... 
if (Double.isNaN(x)) {
    ...
}
11  Game Development / Newbie & Debugging Questions / Re: Problem with Writing text to a File on: 2014-04-01 05:48:35
I've meant this.
Have a look also at readers' comments below.
12  Game Development / Newbie & Debugging Questions / Re: Problem with Writing text to a File on: 2014-03-31 07:07:18
I guess you get the encrypted text as a byte[] via something like this:
1  
public static byte[] encrypt(String text, PublicKey key)

so you can write raw bytes then read them and decrypt via
1  
public static String decrypt(byte[] text, PrivateKey key)
.
13  Game Development / Newbie & Debugging Questions / Re: Troubles Implementing Map Scrolling on: 2014-03-29 17:19:11
I hope this might help you...
14  Game Development / Newbie & Debugging Questions / Re: Good Java Game Development Books on: 2014-03-24 05:21:50
I'd recommend you to have a look at this book (first that come in mind):
http://www.brackeen.com/javagamebook/.
15  Discussions / General Discussions / Re: Making everything by yourself. And loving it! on: 2014-03-10 09:42:09
Yes, you have no need to reinvent the bicycle unless it is the pleasure itself.  Smiley
16  Game Development / Newbie & Debugging Questions / Re: Sorting ArrayList with almost differnet Objects on: 2014-02-24 07:02:13
I think you should write so:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public int compare(Entity e1, Entity e2) {
        if (e1.getX() < e2.getX())
         return -1;
        if (e1.getX() > e2.getX())
         return 1;
        if (e1.getY() < e2.getY())
         return -1;
        if (e1.getY() > e2.getY())
         return 1;
        return 0;
 }
}
17  Game Development / Newbie & Debugging Questions / Re: Class Cast Exception I cant fix on: 2014-02-11 05:31:29
Do that in the following way:

1  
2  
3  
new Mesh(vertices.toArray( new Transform[ vertices.size() ]),
                        quads.toArray( new Quad[ quads.size() ]),
                        tris.toArray( new Tri[ tris.size() ]))

18  Game Development / Newbie & Debugging Questions / Re: Image on: 2014-02-04 15:37:38
I'd recommend you to read this.
19  Game Development / Newbie & Debugging Questions / Re: Where are the texture coordinates going wrong? on: 2014-01-14 06:20:04
Are you sure everything it's ok in these lines?

96            Vector2f t1 = t.get((int)(f.get(i).getTextureIndices().getX()) - 1);
97            Vector2f t2 = t.get((int)(f.get(i).getTextureIndices().getX()) - 1);
98            Vector2f t3 = t.get((int)(f.get(i).getTextureIndices().getX()) - 1);
20  Java Game APIs & Engines / Java 2D / Re: JTextfield and graphics on: 2013-12-26 07:45:58
In  addition to previous post:

The custom drawing is done by extending a JPanel and overrides the paintComponent() method.

1  
2  
3  
4  
5  
6  
7  
@Override
public void paintComponent(Graphics g) {  // graphics subsystem passes a Graphis2D subclass object as argument
  super.paintComponent(g);           // paint parent's background
  Graphics2D g2d = (Graphics2D) g;   // downcast the Graphics object back to Graphics2D
  // Perform custom drawing using g2d handle
  ......
}
21  Game Development / Newbie & Debugging Questions / Re: Math problem with array .length on: 2013-08-20 11:15:40
This might help you.
22  Game Development / Newbie & Debugging Questions / Re: Sound Problem in my Game on: 2013-07-15 11:16:46
Maybe this is the same problem:

]http://stackoverflow.com/questions/8281942/java-audioclip-no-sound-no-error?rq=1]
23  Game Development / Networking & Multiplayer / Re: General networking questions on: 2013-07-13 06:16:47
You may want to look at the posts:
http://www.java-gaming.org/topics/p2p-multiplayer-game/29920/msg/275708/view.html#msg275708

http://www.java-gaming.org/topics/kryonet-p2p-through-the-server/28985/view.html
24  Game Development / Newbie & Debugging Questions / Re: Multiplayer pong on: 2013-07-08 15:25:59
I was wrong about using p2p model in sauerbraten ...
it rather uses thick client - thin server model.
25  Game Development / Newbie & Debugging Questions / Re: Multiplayer pong on: 2013-07-08 06:39:07
Kryonet is designed for client-server model. You may to have a look at Sauerbraten game, IIRC it uses peer-to-peer model.
It's written in C++ using enet library.
26  Game Development / Newbie & Debugging Questions / Re: Couldn't read Pixmap from PNG file / incorrect header check? on: 2013-06-22 10:52:18
This can help as a hint:

http://stackoverflow.com/questions/11399350/gzinflate-in-java
27  Game Development / Newbie & Debugging Questions / Re: AWTException createBufferStratergy on: 2013-05-22 11:04:45
Maybe this will help.
28  Game Development / Newbie & Debugging Questions / Re: KeyListener on an Array (2D Dungeon Crawler) on: 2013-05-17 10:21:39
Try to use the recommendations from here:
Quote
Note:

To fire keyboard events, a component must have the keyboard focus.

To make a component get the keyboard focus, follow these steps:

    Make sure the component's isFocusable method returns true. This state allows the component to receive the focus. For example, you can enable keyboard focus for a JLabel component by calling the setFocusable(true) method on the label.
    Make sure the component requests the focus when appropriate. For custom components, implement a mouse listener that calls the requestFocusInWindow method when the component is clicked.

29  Game Development / Newbie & Debugging Questions / Re: how to check collision between object from the same arrayList on: 2013-04-29 14:00:31
I think this could be useful for you.
30  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Problems with key-framed (MD2) animations on: 2013-04-23 16:10:03
I think _nextFrame < _keyframes.size() should be in line 639 (and 671 too):

1  
2  
3  
4  
5  
6  
//line 639 
for (_nextFrame = 0; _nextFrame < _keyframes.size() - 1; _nextFrame++) {
    if (getMinTime() <= _keyframes.get(_nextFrame)._time) {
        break;
    }
}
Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (13 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!