Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (670)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
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 4 ... 10
 11 
 on: 2016-04-30 17:42:34 
Started by Omar - Last post by Amryu
Hi Omar,

guess thats ok but who would ever use this feature?
No one knows it exists and this game requires the mouse
anyways so I think it's unnecessary. Well it's your game,
I'm just trying to help you Smiley

Greetings
Amryu

 12 
 on: 2016-04-30 17:22:03 
Started by J0 - Last post by J0
Woah, that was quick! Cheesy
So is there no way to do what I was looking for?
I really don't want a custom texture persecutioncomplex

 13 
 on: 2016-04-30 17:19:25 
Started by J0 - Last post by SHC
I'd not use the default cursors, at least in games. Disable the cursor completely, and draw your own cursor, with a custom texture.

 14 
 on: 2016-04-30 17:16:40 
Started by J0 - Last post by J0
Hi lads!

So I have this OpenGL Display embedded inside a JFrame, and within the Display I'm showing, (very basic) UI elements. So far so good, everything works fine. However, I would like to change the cursor from
java.awt.Cursor.DEFAULT_CURSOR
to
java.awt.Cursor.HAND_CURSOR
when hovering above buttons, because that's a lot nicer (notice I used the AWT Cursor fields, but I'm not necessarily looking for a solution involving those).

At first I tried to call
javax.swing.JComponent.setCursor()
on the parent
JFrame
every time the mouse moves to or out of a button.. You'd think that would work, but it turns out the cursor keeps flickering between default and hand — I'm guessing that's because of OpenGL messing with Swing Roll Eyes

Of course, I guess I could just hide the cursor and draw another image at the mouse position, but that does not sound very pretty, now does it? persecutioncomplex

So yeah if someone actually knows how to handle cursors on top of OpenGL Displays that would be great!

J0 Smiley

 15 
 on: 2016-04-30 17:14:47 
Started by Ecumene - Last post by Spasi
I was looking for a tutorial like that! I'm implementing the countdown and a bunch of other stuff now.

Note that you don't have to use a CountDownLatch for synchronization/communication, that's just an example. The only important detail is: most GLFW functions are called from the main thread, the per-window threads only deal with rendering.

This does imply that, at some point, you have to have synchronization points and/or pass messages between threads. Neither GLFW nor LWJGL have any special requirements for how that happens, it's entirely up to the application and how it's designed. Fortunately, Java has a very rich set of concurrency primitives (like CountDownLatch) and concurrent data structures that can be used for that purpose.

I meant to ask, does input handling per window still work regardless of the main thread?

The only thread that deals with window/input events is the main thread. It works fine regardless of how many windows or rendering threads you have.


 16 
 on: 2016-04-30 16:33:57 
Started by Omar - Last post by Omar
Hey Amryu,

For the main menu, it is actually intentional to keep the entry brightful even after you hover outside of it.
This is because you can also toggle between entries with the keyboard "Up" and "Down" arrows, and it allows
the user to know at which entry he/she is at the current moment.

Omar

 17 
 on: 2016-04-30 16:22:06 
Started by Omar - Last post by Amryu
Hi Omar,

works really nicely now. Maybe you could fix the main menu:

If you hover over an entry it brightens. If you now point somewhere
else where no other entry is the last menu item you selected is
still brightened. You may want to fix this.

Greetings
Amryu

 18 
 on: 2016-04-30 16:05:24 
Started by JaredBGreat - Last post by JaredBGreat
Someone may have come up with something like this before, wouldn't really surprise me.  But after trying to figure out a way to get random number per location (for generating terrain), and experimenting with creating per location seeds for Java.Random I realized this could probably be done much better with a home-brew variation on Xorshift.  The idea is really simple, use the coords as the basis for (extra) shifts (along with hopefully good ones, just for safety):

The basis is like this:

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  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
/**
     * Should produce a random long from seed at coordinates x and y
     *
     * @param seed
     * @param x
     * @param y
     * @return
     */

    public static long longFromSeed(long seed, int x, int y) {
        long out = seed;
        out ^= lshift(out, 29);
        out ^= rshift(out, 17);
        out ^= lshift(out, (x % 19) + 7);
        out ^= rshift(out, (y % 13) + 31);
        out ^= lshift(out, 4);
        return out;
    }
   
   
    /**
     * Should produce a random long from seed at coordinates x, y, t
     *
     * @param seed
     * @param x
     * @param y
     * @return
     */

    public static long longFromSeed(long seed, int x, int y, int t) {
        long out = seed;
        out ^= lshift(out, (t % 13) + 7);
        out ^= lshift(out, 29);
        out ^= rshift(out, 17);
        out ^= lshift(out, (x % 19) + 7);
        out ^= rshift(out, (y % 13) + 31);
        out ^= lshift(out, 4);    
        out ^= rshift(out, ((t * 5) % 23) + 11);
        return out;
    }
   
   
    /**
     * should generate num long values using longFromSeed.
     *
     * @param seed
     * @param x
     * @param y
     * @param num
     * @return
     */

    public static long[] longsFromSeed(long seed, int x, int y, int num) {
        long[] out = new long[num];
        out[0] = longFromSeed(seed, x, y);
        for(int i = 1; i < num; i++) {
            out[i] = longFromSeed(out[i-1], x, y);
        }
        return out;
    }


/**
     * Performs left bit shift (<<) with wrap-around.
     *
     * @param in
     * @param dist
     * @return
     */

    private static long lshift(long in, long dist) {
        long out = in << dist;
        out += (in >>> (64 - dist));    
        return out;
    }
   
   
    /**
     * Performs right bit shift (>>) with wrap-around.
     *
     * @param in
     * @param dist
     * @return
     */

    private static long rshift(long in, long dist) {
        long out = in >>> dist;
        out += (in << (64 - dist));    
        return out;
    }


The second method is for creating fake sequence, with using "t" as a kind of fake iteration of calls (obviously, does not get the same number as call t time, but not the point).  The third is to get a bunch of number by using traditional repetition of getting the next number.

Beyond that the full class does include methods for deriving other types, as well as instance methods that use a pre-store seed.  (For terrain gen, only one is needed per world, as however it might be devided up into sub-section, all you need are the coords.)

The full class, which I plan on using in a project I'm working on (with further development), I've put on pastebin to keep this short.
http://pastebin.com/9qXZhS45

 19 
 on: 2016-04-30 15:52:35 
Started by Ecumene - Last post by Ecumene
I meant to ask, does input handling per window still work regardless of the main thread?

 20 
 on: 2016-04-30 15:50:32 
Started by Ecumene - Last post by Ecumene
You cannot call glfwPollEvents before glfwInit. If glfwSetErrorCallback was above the glfwPollEvents call, you'd see the error.

Also, calling glfwInit and handling the event loop in arbitrary threads is not supported. The design of GLFW is similar to AWT/Swing/JavaFX; event processing must happen in a single thread. See the Threads sample for the correct way to handle multiple windows/threads.

I was looking for a tutorial like that! I'm implementing the countdown and a bunch of other stuff now.

Pages: 1 [2] 3 4 ... 10
 
IanParcs (36 views)
2016-04-18 14:18:53

KaiHH (36 views)
2016-04-18 08:35:41

KaiHH (67 views)
2016-04-15 12:43:58

theagentd (69 views)
2016-04-14 02:16:17

theagentd (76 views)
2016-04-14 02:15:43

IanParcs (92 views)
2016-04-12 03:51:16

IanParcs (37 views)
2016-04-12 03:50:03

IanParcs (33 views)
2016-04-12 03:49:54

IanParcs (30 views)
2016-04-12 03:49:52

IanParcs (39 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30
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!