Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  In-Game UI + Drag?  (Read 3584 times)
0 Members and 1 Guest are viewing this topic.
Offline DarkMortar

Junior Devvie




Java Padawan


« Posted 2006-09-19 04:45:33 »

Hi,

Lets say you want to make an in-game interface without using swing. And I would also want to be able to drag the "windows" around in any desired place. The backgrounds of the windows will be various semi-transparent images with text on them and various things. Ok my question, is is this a good idea?

Like each window is a semi-transparent image with g.drawString's on them, and with MouseListener, you could drag the window by holding the top bar and dragging, and all of the coordinates would be moved by variables being added up and down depened on how u drag while holding the mouse button, along with the drawString's by use of variables after redraw. Well ok, first off, is this a good way to do it for in-game interfaces? And would it work well enough?

Also how would i do an ingame window with a window that has a scroll bar to the side with text, and you want scroll it up and down to see more of the "quest explinations" as an example. Not sure on how to do the scrolling window :/.

Offline CommanderKeith
« Reply #1 - Posted 2006-09-19 05:14:18 »

Re-creating swing will be a big bugger.  Also with your own custom UI you'll be stuck with whatever effects you've got.  If you can use Swing, its simple to completely change the look and feel of your menus.  Also you get all the widgets for free.  The only trouble is the threading issues, but that can be overcome.

If you don't want to use Swing though, then what you say sounds achieveable.

Offline Schabby

Junior Devvie




The Receding Brow Worm will eat your code!


« Reply #2 - Posted 2006-09-19 06:05:05 »

You may want to try FengGUI (http://fenggui.dev.java.net). We provide all sorts of customizable widgets including windows and scroll containers. I am happy to help you on your UI in case you encounter difficulties.

Johannes

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #3 - Posted 2006-09-19 08:44:24 »

I've made a lot og basic OpenGL GUI, namely text fields, buttons, and windows, and it really isn't that hard, nor is it complicated. You've got the right idea – it's just a lot of tedious work to get everything you want in there.

See my work:
OTC Software
Offline DarkMortar

Junior Devvie




Java Padawan


« Reply #4 - Posted 2006-09-19 23:39:12 »

Hi, thank you people for the clarifications.

The reason I am not using swing is because i want my interface "really in the game" like if you were playing a top-down rpg, i want accurate interfaces on the sides and top to be in-theme. I want my interfaces slightly transparent and within the canvas, because with swing, it must be seperate, and i decided I dont need file menus ect. Even though orginally I was going to use swing for all of it, but i decided no, for various reasons. I was asking this question to mainly see if it is "ok" to do this, and I dont think it should add too much more grafix lag.

But i still ponder on how i could make a window with a scroll-bar with text on the side, which it reads from a .txt file, like a quest explination for example, with the ability to move it anywhere you please.


Offline Schabby

Junior Devvie




The Receding Brow Worm will eat your code!


« Reply #5 - Posted 2006-09-21 08:37:28 »

How do you plan to render your stuff? With Java2D or with OpenGL?

Johannes

Offline DarkMortar

Junior Devvie




Java Padawan


« Reply #6 - Posted 2006-09-22 01:34:02 »

Java2D.

Offline Schabby

Junior Devvie




The Receding Brow Worm will eat your code!


« Reply #7 - Posted 2006-09-23 07:45:03 »

In this case FengGUI doesn't help much  Grin

I believe it is achievable to build your own GUI library on top of Java2D. But I suggest ot start with Swing as a prototype and after your game reached a certain state of development you begin to implement your own UI components. The look and feel mechanism in Swing is pretty powerfull but still too limited for games (no way to do transparent window backgrounds for example). However, I recommend to still use the Swing functionality and simply subclass those components you want to use. By overriding the paint() method you have total control over the appearance. In-game windows need to be developed from scratch though.

Quote
Like each window is a semi-transparent image with g.drawString's on them, and with MouseListener, you could drag the window by holding the top bar and dragging, and all of the coordinates would be moved by variables being added up and down depened on how u drag while holding the mouse button, along with the drawString's by use of variables after redraw. Well ok, first off, is this a good way to do it for in-game interfaces? And would it work well enough?

Sounds good to me.

Johannes

Offline DarkMortar

Junior Devvie




Java Padawan


« Reply #8 - Posted 2006-09-23 09:33:44 »

I am ok with making all of my windows from scratch, and having special sizes depending on the window. The things you can do with most of the windows shouldnt be too difficult, they will usually be able to be dragged, and buttons will semi-glow or highlight or whatever when you hoover the mouse over them, and there will be no resizing any of the windows because its harder to do that and not nessecary for this case.

but i still have no hints on how to do scrollbar with text in the interface.

Offline Anon666

Junior Devvie




aka Abuse/AbU5e/TehJumpingJawa


« Reply #9 - Posted 2006-09-23 12:50:19 »

You can use lightweight Swing components independently of the heavy weight AWT framework, it just takes abit of fiddling.

However, Swing rendering was never written with efficiency in mind - it tends not to be such a bottleneck when you have a passive (dirty) repaint system.
If you used them in an actively rendered game, you may find them to be too inefficient.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ENC

Junior Devvie





« Reply #10 - Posted 2006-10-08 09:44:03 »

Actually in need not to recreate your UI to suit your game interface. I too wanted to do it.. but is really really time consuming...

You should use Swing and maniplate its ui codes.. After all Swing is also designed to accept mulitples different UI based on the design of the programmer.. It may seem abit difficult and long at first .. but is definatly time space and resource saving to recreate everything from scratch...

During run time it will also run quite smooth regardless to the size of your UI. OF course the size matters to a certain extend.

Cjheers!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!