memory plugin-newbie plugin dev. questions (1 Viewer)

newbie23

Portal Member
August 6, 2005
7
0
During the last days I have been working on a small plugin that allows you to play the game 'connect four' (try to place four disks of your color on a horizontal, diagonal or vertical row). I have a first version ready (that allows to play human versus human and human versus pc opponent)

A small screenshot

connectfour.jpg


I have however some problems.

-the board and the buttons to select the columns are created during initialization. The board consists of a twodimensional array of GUIImages. On my development machine it shows correctly, but on my other pc (with release 0.1.3.0) the board is not shown. The buttons on top are created identically and are shown on both machines

The code to create the board and buttons is :


Code:
for (int i=0;i<game.Width;i++)	{
	for(int j=0;j<game.Height;j++)
					{
						xpos=xoffset+i*xdistance;//set correct positions
	ypos=yoffset+j*ydistance;
						GUIImage imagetest= new GUIImage(GetID,40, xpos,ypos, 64, 64,boardbg, 0);
						imagetest.AllocResources();
	imageboard[i,j]=imagetest;
	GUIControl aaa=(GUIControl)imagetest	;	
	Add(ref aaa);
		}
}


and 


for (int i=0;i<game.Width;i++)
	{
GUIButtonControl test=new GUIButtonControl(GetID,200+i,xoffset+i*xdistance,yoffset,60,40,"menu_list_focus.png","menu_list_nofocus.png");		
test.AllocResources();
GUIControl bbb=(GUIControl)test;
Add(ref bbb);
	}


The above code is called from the following
Code:
public override bool OnMessage(GUIMessage message)	{
switch ( message.Message )
{
case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT			
base.OnMessage(message);
				
	CreateBoard();
CreateColumnButtons();
 break;

Is this the correct way to create the board and visualize it? Why is it not shown on my second pc? Remember that I am quite new to mediaportal,c# and OO-programming, so please provide detailed descriptions.

Kind Regards
 

Users who are viewing this thread

Top Bottom