Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (575)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (623)
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]
1  Game Development / Networking & Multiplayer / NIO write taking up all the process resources on: 2006-05-14 07:24:13
How should the writing to a non-blocking nio channel be handled?
if (key.isAcceptable()) {
~ codes ~
client.register(selector, SelectionKey.OP_READ |  SelectionKey.OP_WRITE);
}  else if (key.isConnectable()) {
~ codes ~
client.register(selector, SelectionKey.OP_READ |  SelectionKey.OP_WRITE);
} else if (key.isReadable()) {
~ codes ~
} else if (key.isWritable()) {
~ codes ~
<== writes data to the channel here ==>

Apperently if I use that the select will keep returning, therefore eating up the resources.
According to this page,
if the socket is registered with the Selector in WRITE mode, then the call will always return immediately, because it has at least one socket which is ready to be written to.

Now my problem, since calling register() function in a thread other than the one that calls select() will cause blocking problem. How would I write data to the channel if I can't register the channel to write state?
2  Java Game APIs & Engines / Java 2D / Re: Drawing outside of the viewable area.. on: 2006-02-07 22:05:19
Hum.. Thanks for the tip but that's not exactly what I want. Because all the stuff in the drawing would have different coordinations and I only want to display a perticular view. Also there are many objects so I don't want to translate all their coordinates first before drawing it.
3  Java Game APIs & Engines / Java 2D / Drawing outside of the viewable area.. on: 2006-02-07 21:29:43
Hi I'm trying to draw something out of viewing area, but somehow things outside of Canvas bound will not be drawed. Is there anyway I can still draw those? I need to copy the image there and be able to move it around... Any ideas?

Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
g.fillRect(-800, -600, 800, 600);

--- other drawings

g.copyArea(-800, -600, 800, 600, 800, 600);

Pages: [1]
ClaasJG (19 views)
2015-04-27 13:36:51

BurntPizza (33 views)
2015-04-23 03:42:11

theagentd (35 views)
2015-04-22 16:23:07

Riven (50 views)
2015-04-16 10:48:47

Duke0200 (59 views)
2015-04-16 01:59:01

Fairy Tailz (42 views)
2015-04-14 20:13:12

Riven (45 views)
2015-04-12 21:36:37

bus hotdog (61 views)
2015-04-10 02:39:32

CopyableCougar4 (66 views)
2015-04-10 00:51:04

BurntPizza (71 views)
2015-04-06 22:06:58
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

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