[Tux4kids-tuxtype-dev] Patch produced

sumit sinha sumit9sinha9 at gmail.com
Sun Apr 5 09:24:23 UTC 2009


Hi,

I have produced a patch for the the following modifications to the code (in
the c file <src\titlescreen.c>)

- The separation of the menu buttons from each other was a constant 60
previously. As such the separation remained same on changing screen size.
Now the separation changes with screen size.

- The distance of the buttons from the 4 edges of the screen now aligns with
screen size. The buttons are placed symmetrically from the opposite edges.

Overall, the menu aligns accordingly with the changes in screen size.

I would be grateful if the mentors could review my patch and provide
feedback.

I have now become very comfortable with the source code and am very eager to
send another patch if required.

Thanks
-Sumit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/tux4kids-tuxtype-dev/attachments/20090405/ef024d98/attachment.htm 
-------------- next part --------------
diff -Naur old/titlescreen.c new/titlescreen.c
--- old/titlescreen.c	2009-03-05 18:56:10.000000000 +0530
+++ new/titlescreen.c	2009-04-05 14:28:31.000000000 +0530
@@ -693,7 +693,7 @@
       /* --- erase the last menu --- */
       for (i = 1; i <= TITLE_MENU_ITEMS; i++)
       {
-        text_dst[i].x = screen->w/2 - 70;//290;
+        text_dst[i].x = menu_button[1].x + 50;
         text_dst[i].w = reg_text[i][menu_depth]->w;
         text_dst[i].h = reg_text[i][menu_depth]->h;
         SDL_BlitSurface(CurrentBkgd(), &menu_button[i], screen, &menu_button[i]);
@@ -933,8 +933,8 @@
   spkrdest.h = speaker->h;
 
   /* --- setup menu item destinations --- */
-  menu_button[1].x = screen->w/2 - 120; //240;
-  menu_button[1].y = 100;
+  menu_button[1].x = (screen->w - menu_width[1])/2;
+  menu_button[1].y = (screen->h - 250)/6;
   menu_button[1].w = menu_width[1];  //calc from width of widest menu item
   menu_button[1].h = 50;
 
@@ -943,26 +943,28 @@
   menu_gfxdest[1].w = 40;
   menu_gfxdest[1].h = 50;
 
-  text_dst[1].x = screen->w/2 - 70;//290;
+  text_dst[1].x = menu_button[1].x + 50;
   text_dst[1].y = menu_button[1].y + 15;
 
+  int MENU_ITEM_GAP = menu_button[1].y;
+
   /* FIXME each menu item drawn hardcoded 60 pixels below last - */
   /* perhaps increment should be "menu_button[j-1].h + MENU_ITEM_GAP" */
   for (i = 2; i < 6; i++) 
   {
     /* --- setup location of button text --- */
-    text_dst[i].x = screen->w/2 - 70;
-    text_dst[i].y = text_dst[i - 1].y + 60;
+    text_dst[i].x = text_dst[i-1].x;
+    text_dst[i].y = text_dst[i-1].y + menu_button[i-1].h + MENU_ITEM_GAP;
 
     /* --- setup location of button background --- */
     menu_button[i].x = menu_button[i - 1].x;
-    menu_button[i].y = menu_button[i - 1].y + 60;
+    menu_button[i].y = menu_button[i - 1].y + menu_button[i-1].h + MENU_ITEM_GAP;
     menu_button[i].w = menu_button[i - 1].w;
     menu_button[i].h = menu_button[i - 1].h;
 
     /* --- setup location of animated icon --- */
     menu_gfxdest[i].x = menu_gfxdest[i - 1].x;
-    menu_gfxdest[i].y = menu_gfxdest[i - 1].y + 60;
+    menu_gfxdest[i].y = menu_gfxdest[i - 1].y + menu_button[i-1].h + MENU_ITEM_GAP;
     menu_gfxdest[i].w = menu_gfxdest[i - 1].w;
     menu_gfxdest[i].h = menu_gfxdest[i - 1].h;
   }


More information about the Tux4kids-tuxtype-dev mailing list