Pages

Subscribe:

Labels

Tuesday, July 31, 2012

Development : Image Shifting, Delete Location



 ------------------------------------------------------------------------------------------------------------ 
Changes :
1. 2 frames added, menushiftsettingframe and locselectshiftsettingframe. This is where the user can shift the background images. (Picture 1 and Picture 2)
2. DraggableComponent.java and DraggableImageComponent.java added. These are needed to enable the image to be moved using mouse-click.
3. The images being used for main menu and location setting background are saved into JPEG file,
because mbg_str and lbg_str cannot be used.

Progress & its' problems :
1. Instead of saving the image location, the background image is cropped based on the panel size, currently 600 x 340 for both frame.
Clipping algorithm has not been applied, therefore, the codes can only clip the image on the same location.
Clipping algorithm will be applied later on.

2. If the user want to change the image for main menu background and location background after he loaded one, the menushiftsettingframe and locselectshiftsettingframe will not show the new selected image.
It will show the first image being chosen instead, but the shown image will take the new selected image size.
This part can work properly when a JOptionPane is being used. Still trying to find out on how to solve this matter.

3. 'Delete Location' button is added to Location Setting.
Works properly, but after the user delete the location for the second time (and more), the deleted location
is not removed from the screen and it cannot be selected. (Picture 3)

4. 'Location Shifting' have not done, still doing research.
------------------------------------------------------------------------------------------------------------


Picture 1

Picture 2


Picture 3

Monday, July 30, 2012

Development : Zoom (2)

Zooming is added in. The repositioning, joining of pieces, and rotating multipiece when scaling have been corrected. 
Zoom Out

However, it is not working well with high resolution image or big number of pieces. It...is...too...slow... ~>.<~
This may be caused by the excessive call of repaint function, since it is called every time a piece is moved. Recalculation for every scaling done may be another cause.

Another problem is the scroll bar does not change according to the puzzle size. I have tried setting the maximum and minimum size of the scroll bar, setting model of the scroll bar, set viewport of the scrollpane, override the setpreferredsize of the the scrollpane, but none seems to work.
The scroll bar just shrink once and goes back to the original size. Some articles and forum discussions categorize this as a bug. Some concluded with the solution to this matter, for example : https://forums.oracle.com/forums/thread.jspa?threadID=1361016 or http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4297009. However, it did not work in this application. Is this really a bug? Or is it a bug that I created?
Is it the time to give up on the zoom? I...do...not...know............

HWAITING MM12/2C!

Development : Click Sound + Fixed Mosaic Option Integrated with Ghost Image


Snapping and clicking sound are added! It has been integrated with the fixed mosaic option and the ghost image option.

Fixed Photomosaic Option
The fixed mosaic option is done so that in the final image, the tile size will be big enough to see the individual tile image clearly. Still finding the best combination of tile size and minimum percentage needed to get a good quality of the photomosaic.



Currently, the sound is available only when pieces are joining, when main menu button is clicked, and when in game panel button is clicked.
These functions have been integrated with sebastian's ghost image function and the instruction on the bottom side.
Ghost Image and Instruction





Friday, July 27, 2012

FYP meeting 8: 25/7/12 & 26/07/12


Location: SIM & Online

Members attended: Wilson, Sebastian, Santy, Jennisa, Octa

-        Met up with supervisor again, showed our current progress thus far. Discussion about adding a storyline to the game, have dependencies for the locations. Allow the game creator to customize game flow
-        Of all the task distributed, task done:
·        Creator GUI re-design, from tab pane to panel-by-panel
·        Zoom function for the game
·        Image backdrop for help with game play
·        Disclaimer panel
·        Fixed mosaic setting in game
·        Automatically complete puzzle option
-        Mosaic progress as well as game option is put on hold till outstanding task is done
-        Discussed about the game saving option, feel that the saving of game progress should be implemented as it would cater for better usability of the game.
-        Saving of game progress was changed to “code/keyword usage” instead of installing/saving of additional save files
-        Sound and music elements to be added in
-        Shifting of background images in editor is to be continued, and after which the location position shift can be done next
-        Editor have been made to not be dependent on a resource folder (it can access its own resource instead of copying out its content), hopefully this can help us proceed with the applet version idea
-        Consolidating of all task done is scheduled to be on 2nd of August

Monday, July 23, 2012

Development : Disclaimer Use frame

Disclaimer Use frame added!!


Currently still working on converting jar to applet...

Development : Puzzled Editor GUI (Updated)

Changed the user interface of the Puzzled Editor.





Friday, July 20, 2012

Development : Zoom

Zooming is done by transforming the drawing of pieces.
protected void draw (Graphics g){
Image img = getImage();
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
AffineTransform at;
at = AffineTransform.getScaleInstance(scale,scale);
at.translate(getPuzzleX(),getPuzzleY());
g2.drawImage(img, at,null);
}

The result:
initially
zoom out once








zoom out twice

Though it may look correct, I could not manageto set the boundary box and the updated relative position of the piecescorrectly. Therefore, when it is zoomed, the pieces cannot be moved properly.






When moved
After repaint













Thefunction that is used to scale the piece :
public void scale (double scale, int width, int height)
{
this.scale = scale;
double halfWidth = 0.5 * scale *MenuListener.getFrameWidth();
double halfHeight = 0.5 * scale *MenuListener.getFrameHeight();
double x,y;
x = halfWidth - scale * this.curWidth;
y = halfHeight - scale * this.curHeight
this.curWidth = (int)(scale*this.curWidth);
this.curHeight= (int)(scale*this.curHeight);
//debug string
System.out.println ("half width :" +halfWidth);
System.out.println ("current width: "+ this.curWidth);
System.out.println ("Puzzle X :" +getPuzzleX());
System.out.println ("X : " + x);

//this.setPuzzlePosition((int)x,(int)y);
recomputeImageData();
}

Part of the result of the debug string:


The “Puzzle X “should have determined the topleft corner of the piece. However, it showed unexpected result. Therefore, whenthe setPuzzlePosition is uncommented, all the pieces’ positions are wrong.


Currently, I am still finding way to get the re-positioningcorrect.