[erlang-questions] GUI development with Erlang

Alan Gingras alangingras@REDACTED
Fri Dec 29 18:34:49 CET 2017


Arif,

I have now worked my way through all of your wxerlang-getting-started document.  Again, I think it is terrific.  I did have to add a "startGame" function to actually start the "chess clock" in both flavors (gen_server and wx_object).  And I modified the handle_info function for 'reset' to start tell player 1 to move.  The startGame/1 method was:

startGame( N ) ->
	?SERVER ! { reset, N }.

And the handle reset method is now:

handle_info({reset, N}, State) ->
	player1 ! {reset, N},
	player2 ! {reset, N},
	player1 ! move,
	{noreply, State};

And to get the clock going:

10> arbiter:start_link().
{ok, <0.207.0>}
11>arbiter:startGame( 10 ).
{reset,10}
12>
Or: 
52> wo_arbiter:start_link ().
{wx_ref,35,wxFrame,<0.363.0>}
53> wo_arbiter: startGame( 10 ).
{reset,10}
54>

Thanks again for the tutorial.  I hope other find it as instructive as I did.

Sincerely yours,
Alan 




More information about the erlang-questions mailing list