Example #1
0
 /*
 ====================================================================
 Get a specific pixel value in a nation's flag.
 ====================================================================
 */
 public int nation_get_flag_pixel(Nation nation, int x, int y)
 {
     return SDL_Surface.GetPixel(nation_flags, x, nation.flag_offset + y);
 }
Example #2
0
 public static SDL_Surface nation_draw_flag(Nation nation, SDL_Surface surf)
 {
     if (surf==null){
         throw new Exception("the Surface is null");
     }
     SDL_Surface.copy_image(surf,Nation.nation_flags,20,3,Nation.nation_flag_width,
                             Nation.nation_flag_height,0,(Nation.nation_flags.h-nation.flag_offset-Nation.nation_flag_height));
     return surf;
 }
Example #3
0
 /*
 ====================================================================
 Get nation index (position in list)
 ====================================================================
 */
 public static int nation_get_index(Nation nation)
 {
     int i;
     for (i = 0; i < nation_count; i++)
         if (nation == nations[i])
             return i;
     return 0;
 }
Example #4
0
 /*
 ====================================================================
 Get the player who controls nation
 ====================================================================
 */
 public static Player player_get_by_nation(Nation nation)
 {
     foreach (Player player in players)
     {
         for (int i = 0; i < player.nation_count; i++)
             if (nation.ID == player.nations[i].ID)
                 return player;
     }
     return null;
 }