Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java Game Development Conspiracy Theory

  1. #1
    Member Cronus's Avatar
    Join Date
    Feb 2013
    Location
    Gothenburg, Sweden
    Posts
    41
    My Mood
    Inspired
    Thanks
    6
    Thanked 7 Times in 6 Posts

    Default Java Game Development Conspiracy Theory

    Hi,

    I'm currently studying the source code of Minicraft(this link will take you to s3.amazonaws.com, don't worry, it's hosted and made by Amazon, the most legitimate site on the web), a video game Notch made for the Ludum Dare competition. Now, I've noticed something almost all open source Java games have:

    int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();

    What does this do? What does getRaster(), getDataBuffer(), and getData() do? Why is this stored in the variable "pixels"? I can't see any connection, please help!

    #YOLO


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Java Game Development Conspiracy Theory

    Pretty must does what it says, gets the pixel information and saves it in a an integer array.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Member Cronus's Avatar
    Join Date
    Feb 2013
    Location
    Gothenburg, Sweden
    Posts
    41
    My Mood
    Inspired
    Thanks
    6
    Thanked 7 Times in 6 Posts

    Default Re: Java Game Development Conspiracy Theory

    Thanks for the answer! What can you do with the information?

  4. #4
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Java Game Development Conspiracy Theory

    It means you have decently quick access to the pixel information drawn on screen. By manipulating the values you can then manipulate what is drawn on screen.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  5. The Following User Says Thank You to newbie For This Useful Post:

    Cronus (October 5th, 2013)

  6. #5
    Member Cronus's Avatar
    Join Date
    Feb 2013
    Location
    Gothenburg, Sweden
    Posts
    41
    My Mood
    Inspired
    Thanks
    6
    Thanked 7 Times in 6 Posts

    Default Re: Java Game Development Conspiracy Theory

    Thank you so much for the awesome answer! You're the best.

Similar Threads

  1. JAVA game development issue
    By david37370 in forum Java Theory & Questions
    Replies: 9
    Last Post: June 23rd, 2013, 03:39 AM
  2. Concerning Java and game development
    By Zziko0 in forum Java Theory & Questions
    Replies: 7
    Last Post: June 21st, 2013, 07:15 PM
  3. Undead Liberty (Java Game Development)
    By Dwaq in forum Paid Java Projects
    Replies: 4
    Last Post: May 2nd, 2012, 06:52 PM
  4. Any good books for java game development?
    By u-will-neva-no in forum Java Theory & Questions
    Replies: 1
    Last Post: September 23rd, 2011, 05:30 AM
  5. Theory behind 2d Game making?
    By DarrenReeder in forum Java Theory & Questions
    Replies: 3
    Last Post: January 28th, 2010, 02:54 AM