Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 / Newbie & Debugging Questions / Re: Game graphics on: 2009-02-17 20:29:04
What is the difference between paintComponent and paint?

What is the difference between overriding paintComponent/paint and this way of doing it:

Graphics2D g = (Graphics2D)strategy.getDrawGraphics();
...
g.dispose();
strategy.show();

Not to mention what is each line doing in the second case?  Like what data is in "g", what data is in "strategy"?  How do Graphics2D and BufferStrategy work together?


My problems were mostly from some sort of incongruence between the way I coded painting and key events.  They were interfering with each other and weren't working properly.  Maybe I was just coding poorly, but that was a very difficult problem to work around at the time.
2  Game Development / Newbie & Debugging Questions / Game graphics on: 2009-02-17 03:25:02
Graphics have always been confusing to me since the beginning of my java experience.  After some reading I understand that the whole Graphics thing is first sent to some sort of event handler, where it is actually drawn on the screen.

I was getting along fine by trying things and tweaking it until it worked, until I tried to make a real game, with a lot of things going on, and more complex controls and movement.  I ran into some problems due to the gap between my understanding of what was going on and how Graphics actually worked.  I eventually worked around it, but it was ugly.  I thought concurrency would solve my problems, but that was just horrendous.

Since then I've been afraid of Graphics.  I felt like there should be a more tame version of Graphics, or there must be at least some sort of convention when working with it that I wasn't aware of.

I try to read tutorials, but reading tutorials is how I got in the position I am in, so I'm not so sure what is good and what isn't, what I can combine and what conflicts.  I also looked into full screen and it seems like that might be simpler to deal with, but I guess you could say I'm afraid that I'll learn all about it and end up having a useless heap of knowledge that I can't handle.


It just seems so confusing and wrong to me that I feel like I'm missing something.  So how do "real" java game programmers implement graphics without running into problems when dealing with graphics that are relatively mundane for games?
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (32 views)
2014-07-18 06:55:21

Zero Volt (28 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (25 views)
2014-07-16 23:30:00

Cero (40 views)
2014-07-16 00:42:17

Riven (42 views)
2014-07-14 18:02:53

OpenGLShaders (29 views)
2014-07-14 16:23:47

Riven (29 views)
2014-07-14 11:51:35

quew8 (26 views)
2014-07-13 13:57:52

SHC (63 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!