Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
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  Java Game APIs & Engines / Java 2D / Re: maybe simple problem (translate) on: 2005-04-15 14:41:48
maybe x,y changes (-> the mouse is moved) during the execution of paint()?
2  Java Game APIs & Engines / Java 2D / Re: simple 2d polygon intersection on: 2005-04-08 22:59:29
'nother hint:
area.intersect(otherArea);
(!area.isEmpty())

Smiley
3  Java Game APIs & Engines / JOGL Development / Re: Eclipse plugin for JOGL on: 2005-04-07 19:07:30
this would save you 15 clicks at most Roll Eyes

every jogl tut starts off with how to install it (besides, eclipse automatically includes it if you have it in the /ext/ dir), not to mention that newbies who fail at this should start with some other graphicslib Tongue
4  Java Game APIs & Engines / JOGL Development / Re: painting? on: 2005-04-07 11:58:04
works equally nice, thanks Cheesy
5  Java Game APIs & Engines / JOGL Development / painting? on: 2005-04-06 21:03:44
hey guys Smiley

I'm currently rewriting the display class of my game for jogl. Now, after getting the image and shape drawing to work I'd like to integrate the drawing into the game's thread, ie, get rid of the animator object.

but, if I just call the display method, or the frame's repaint method....

ok scratch that I just figured it out, it's the GLCanvas' repaint() which needs to be called, not the frame's Tongue

thought I'd post it anyways if anyone else is having this problem (had been searching >45 minutes for a solution on google .\/.) Smiley
6  Game Development / Newbie & Debugging Questions / Re: Am I VERY new to the world of Java, so plz hel on: 2005-04-03 07:18:09
Quote
Another thing, I'm using BlueJ. Is it possible to create RPG's on there?


bluej is an ide for java, why shouldn't you be able to do this particular thing? o-O

anyways, google will answer most of your questions ( http://www.google.com/search?q=java+tutorial+game ) Wink
7  Java Game APIs & Engines / Java 2D / Re: transform image on: 2005-03-31 19:31:15
don't know, but guess yes, the transforming needs to be done with a copy of the raster anyways, so why not?

but that doesn't really matter, as the error message is the same if I draw it to another image >_>
8  Java Game APIs & Engines / Java 2D / Re: transform image on: 2005-03-31 10:28:57
oh, right, I should have given more info... Tongue

win2ksp4, jre1.5.0 (which is not reported to have that bug), source image is built like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
palette = new IndexColorModel(8, 256, palR, palG, palB, 0);

imageData = new byte[imageBytes];

model = new MultiPixelPackedSampleModel(DataBufferInt.TYPE_BYTE, this.pcxwidth, this.pcxheight, 8);
buffer = new DataBufferByte(imageData, imageBytes);
raster = WritableRaster.createWritableRaster(model, buffer, zeropoint);

new BufferedImage(palette, raster, false, null);


the transform can be any with non-null shear or scale values:

1  
2  
3  
4  
5  
AffineTransform gt = new AffineTransform();
gt.translate (0, bi.getHeight());
gt.scale (1, -1d);
g.transform (gt);
g.drawImage (image, null, null);


the flipping destination image is the code from the jumping into jogl tutorial (I think that's what it was called), to get a drawPixels() compatible raster

1  
2  
3  
4  
5  
6  
raster = Raster.createInterleavedRaster (DataBuffer.TYPE_BYTE, bi.getWidth(), bi.getHeight(), 4, null);

colorModel= new ComponentColorModel (ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {8,8,8,8}, true, false, ComponentColorModel.TRANSLUCENT, DataBuffer.TYPE_BYTE);

new BufferedImage (colorModel,
raster, false, null);


heh, seems to be more or less the same as in the bug report... *tries the workaround*

\\ edit

forgot to mention, it's the same problem if srcImg == dstImg

1  
2  
3  
4  
5  
6  
7  
Graphics2D g = bi.createGraphics();

AffineTransform gt = new AffineTransform();
gt.translate (0, bi.getHeight());
gt.scale (1, -1d);
g.transform (gt);
g.drawImage(bi, null, null);

or
1  
g.drawImage(bi, gt, null);
9  Java Game APIs & Engines / Java 2D / Re: transform image on: 2005-03-31 00:04:55
viewed 55 times and no idea? It still refuses to do anything else than translating coordinates, whenever I try to get it to shear or rotate any image it gives that very same error. I don't need this now, but sooner or later I'm bound to need it, and I've really ran out of ideas what could be causing this Sad
10  Java Game APIs & Engines / Java 2D / Re: Using fullscreen on: 2005-03-28 22:38:03
well I don't see any call to setFullscreenWindow in your code Tongue

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
        // initialize the main app frame
           gf = new Frame();

        // we don't need statusbars in fullscreen =P
       gf.setUndecorated(true);
        // in fullscreen you probably want a fixed framerate
       gf.setIgnoreRepaint(true);

        // gets us fullscreen
       ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        gd = ge.getDefaultScreenDevice();
        gd.setFullScreenWindow(gf);
        // fiddle around with that
       gd.setDisplayMode(new DisplayMode(1024, 768, 16, 75));

        // create buffer
       gf.createBufferStrategy(2);
        // and get strategy
       b = gf.getBufferStrategy();


this sets up a fullscreen frame. get the graphics object by calling the strategy's getdrawgraphics() method
11  Game Development / Newbie & Debugging Questions / Re: why is "Reference" abstract?? on: 2005-03-28 14:29:09
I'm developing a 2d fighting game engine which uses a state-type scripting language, which uses objects. Every instance (which consists of multiple components, like, spritesheet, animation, etc, etc) has a referencetable (-> hashmap<string, reference>), which is used to store the references for later access.

this works well with a single character, but, to make throw-like moves or other actions which influence other instances (-> characters) work, you may want to store the reference to the target. now, if some other instance prevents one of the objects from being unloaded this may become veeery memory-intensive. that's why I want to give the option to make references weak.

it's not exactly necessary but may come in handy...
12  Game Development / Newbie & Debugging Questions / Re: why is "Reference" abstract?? on: 2005-03-27 13:16:40
Quote

Um, because I'd pointed you at the docs, pointed out it was abstract, and you complained it still didn't work, and seemed annoyed at me for telling you to read the docs. And because I wasn't sure what in particular you meant by the title.

So, I guessed maybe you simply didn't know what abstract meant.


hadn't I known what "abstract" was, I'd have complained about the errors when trying to instantiate it, rather than about it being abstract, no? Smiley

Quote

Ah, I think I'm beggining to understand. You're want to use the crap^H^H^H^H"advanced feature that we all love" in java 5 to make - in one/two lines of source - a generified data structure that either stores weak references or real ones?


yes. this would be line of code if there was a non-weak/soft/phantom reference class available (and I still wonder, why isn't there?? doesn't make much sense to me...), but I guess I'll have to workaround >_>

like,
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
HashMap<String, Object> table; 
 
// setter

if(weak)
  table.put(name, new WeakReference<blah>(value);
else
  table.put(name, value);
 
// getter
Object value = table.get(name);
return (value instanceof Reference) ? ((Reference) value).get() : value;


I thought about this, but it seems somewhat not elegant to me :|
13  Game Development / Newbie & Debugging Questions / Re: why is "Reference" abstract?? on: 2005-03-27 11:49:20
Quote
Think of abstract as meaning "incomplete" - an abstract class is one that needs you to write some extra code to make it into a "real" class (a non-abstract one). If you read the docs, and read the first few sentences, you will see why: this is a "base class" that only contains SOME of the code needed to make various types of reference class; you need to implement the rest of the code to make an actual reference class.


What makes you think I didn't knew that? o-O

ok, I'll reformulate the question:

"why is there no non-weak/soft/phantom reference class available?"
14  Game Development / Newbie & Debugging Questions / Re: why is "Reference" abstract?? on: 2005-03-27 10:51:50
I suspect you're not reading my post carefully enough. Tongue

Quote
I'd like to give the option to make these weak.

my first thought was something like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
HashMap<String, Reference<blah>> table;

// setter

if(weak)
  table.put(name, new WeakReference<blah>(value);
else
  table.put(name, new Reference<blah>(value);

// getter

return table.get(name).get();


go figure.

Quote
Because there is no situation where you would ever want or be able to create a Reference.


now, if this isn't one? no need to be so aggressive, man... >_>
15  Game Development / Newbie & Debugging Questions / why is "Reference" abstract?? on: 2005-03-26 22:45:48
*points to topic*

yeah, why?

In my game engine, objects are refered to as "references", which are stored in a hashmap, and I'd like to give the option to make these weak. I was rather surprised when I noticed I couldn't just put references (or weakreferences) into the hashmap instead of the objects themselves.

ideas/alternatives/opinions?
16  Java Game APIs & Engines / Java 2D / Re: Sprite Sheet on: 2005-03-22 00:10:40
Quote
could it be because of drawing all the tiles slows it down?


you do use bufferstrategy and the sprite IS drawn every tick? then I have no idea what might be wrong Tongue

Quote

Also, is there a way to draw an image iunto a createImage() variable?


uh... what? do you mean into an imageproducer? o_O

Quote
Also can you explain that drawImage code you posted.


how about reading the docs...?

Quote
And is it true I can only have a heightxwidth of 256


noone ever said that. sprites above 256x256 are just not accelerated (so you should not use them. you may, though)
17  Game Development / Newbie & Debugging Questions / Re: ClassCastException and BufferStrategy on: 2005-03-15 18:05:30
what? bufferstrategy from a frame can't be accelerated? Shocked
18  Game Development / Performance Tuning / Re: sort out hashmap entries by key on: 2005-03-15 14:44:04
ah.... right. thanks Smiley

1  
2  
3  
4  
5  
6  
7  
        HashMap<String, String> timerdata = new HashMap<String, String>();
        Iterator<Entry<String, String>> keys = data.entrySet().iterator();
        while(keys.hasNext()){
            Entry<String, String> temp = keys.next();
            if(temp.getKey().charAt(0) == '~')
                timerdata.put(temp.getKey().substring(1), temp.getValue());
        }
19  Game Development / Performance Tuning / Re: sort out hashmap entries by key on: 2005-03-15 13:30:31
well of course it's not...

Quote
sort out entries selectively by key, that is, only keys which start with ~ should remain
20  Game Development / Performance Tuning / Re: sort out hashmap entries by key on: 2005-03-15 13:07:37
1  
2  
3  
4  
5  
6  
7  
        HashMap<String, String> timerdata = new HashMap<String, String>();
        Iterator<String> keys = data.keySet().iterator();
        while(keys.hasNext()){
            String temp = keys.next();
            if(temp.charAt(0) == '~')
                timerdata.put(temp.substring(1), data.get(temp));
        }


may not be the fastest, but it works Smiley

thanks for your advice Smiley
21  Game Development / Performance Tuning / sort out hashmap entries by key on: 2005-03-14 19:02:21
hey there Smiley

I came accross this problem today:

I have a HashMap<String, String>, and I want to sort out entries selectively by key, that is, only keys which start with ~ should remain (and the ~s should be removed in the process).

My first thought was to get some queue object from the keys, process them and call remove(key) on the hashmap. but this seems rather slow to me and it's not possible to remove the ~s in front of all keys in the process. :\

How would you do this? I'm not quite sure - especially  about performance aspects - on this one >_>
22  Game Development / Newbie & Debugging Questions / Re: Java 5.0 commonness? on: 2005-03-13 12:06:10
true, true... Tongue
23  Game Development / Newbie & Debugging Questions / Re: Java 5.0 commonness? on: 2005-03-12 10:00:14
I wonder why...? Does it bring any disadvantages?
24  Java Game APIs & Engines / Java 2D / Re: Pressing 2 keys at once! on: 2005-03-11 19:22:17
Quote
ok thanks, ill try
Whats the best way to keep track of the players true x,y values?


this was what I was refering to in my previous post Smiley

anyways, for 8-direction movement, I'd probably use something like this

AffineTransform playercoords;
static final AffineTransform moveupaffine = AffineTransform.getTranslateInstance(0, -10), moverighttaffine = AffineTransform.getTranslateInstance(10, 0), moveuprightaffine = AffineTransform.getTranslateInstance(8, -8 );
int movement;

// press button
if(e.getKeyCode() == KeyEvent.VK_D)
 { //move right, set first bit
    movement += 1
 }
if(e.getKeyCode() == KeyEvent.VK_W)
 { //move up, set 2nd bit
    movement += 2
 }

// release button
if(e.getKeyCode() == KeyEvent.VK_D)
 { // stop moving right, unset first bit
    movement -= 1
 }
if(e.getKeyCode() == KeyEvent.VK_W)
 { //move up, unset 2nd bit
    movement -= 2
 }
// missing break, I'm lazy Tongue
switch(movement){
// right
 case 1:
   coords.concatenace(moverightaffine);

// up
 case 2:
   coords.concatenace(moveupaffine);

// up-right
 case 3:
   coords.concatenace(moveuprightaffine);

}

that way, you can easily check what direction the char is moving, check for specific directions (binary AND operator) etc.

may be necessary to add a check if the movement variable isn't out of range (who knows, maybe someone manages to push a button twice without releasing...)
25  Game Development / Shared Code / Re: SCHOOL OR COLLEGE MADE USING JAVA 2D on: 2005-03-05 10:56:20
it's funny how people use the word "need" in requests like this Grin
26  Java Game APIs & Engines / Java 2D / drawing image from colormodel & raster on: 2005-03-01 14:32:18
hey there Smiley

I'm currently using BufferedImages for graphics, the sprites are stored as writableraster and indexcolormodel, the images are constructed by
new BufferedImage(this.palette, this.imageData, false, null);

now, I'd like to use volatileimages instead, but I couldn't figure out how to draw this data (raster + colormodel) without using the mentioned constructor... Tongue

thanks in advance Smiley
27  Java Game APIs & Engines / Java 2D / Re: AffineTransform to String to AffineTransform on: 2005-03-01 12:59:46
that's what I was trying to point out - use tcp for this kind of transfer Tongue
28  Java Game APIs & Engines / Java 2D / Re: Avoidance of Garbage Collection on: 2005-03-01 12:44:51
*tries*
29  Java Game APIs & Engines / Java 2D / Re: AffineTransform to String to AffineTransform on: 2005-02-28 20:02:40
Quote
Udp don't have guaranteed delivery but the content sent is guaranteed to be the same as recieved.


umm... how can the content sent be guaranteed to be the same as received if some packages may just get lost on the way?? o_O
30  Java Game APIs & Engines / Java 2D / Re: AffineTransform to String to AffineTransform on: 2005-02-28 19:10:30
most probable, but not 100% guaranteed with udp Smiley
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.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (20 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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!