Commit 4f060901 authored by Jordi Mas's avatar Jordi Mas

Remove extensions

parent a73a500b
Pipeline #85308 failed with stage
in 3 minutes and 50 seconds
......@@ -75,34 +75,12 @@ dnl --- Required libraries
GTKSHARP_REQUIRED=2.99.1
MONO_REQUIRED=4.0.0
MONO_ADDINS=0.2.0
CANBERRA_GTK_REQUIRED=0.26
PKG_CHECK_MODULES(GBRAINY_CORE, mono >= $MONO_REQUIRED)
PKG_CHECK_MODULES(GBRAINY, gtk-sharp-3.0 >= $GTKSHARP_REQUIRED)
PKG_CHECK_MODULES(GBRAINY, libcanberra-gtk-3-0 >= $CANBERRA_GTK_REQUIRED)
AC_ARG_ENABLE(addins, AC_HELP_STRING([--disable-addins], [Disable mono-addins support]), , enable_addins="no")
enable_addins_sharp="${enable_addins}"
PKG_CHECK_MODULES(MONO_ADDINS,
mono-addins0.2 >= $MONO_ADDINS
mono-addins0.2-setup >= $MONO_ADDINS
mono-addins0.2-gui >= $MONO_ADDINS,
enable_addins_sharp="$enable_addins_sharp", enable_addins_sharp=no)
if test "x$enable_addins" = "xyes" -a "x$enable_addins_sharp" = "xno"; then
AC_MSG_ERROR([mono-addins was not found or is not up to date. Please install mono-addins of at least version $MONO_ADDINS, or disable mono-addins support by --disable-addins])
fi
if test "x$enable_addins" = "xyes"; then
CSC_DEFINES="$CSC_DEFINES -d:MONO_ADDINS"
fi
AM_CONDITIONAL(ENABLE_ADDINS, test "x$enable_addins_sharp" = "xyes")
PKG_CHECK_MODULES(GBRAINY_CHECK, librsvg-2.0)
dnl -- Intl
......@@ -193,7 +171,6 @@ help/Makefile
tools/Defines.cs
])
echo "Mono-addins: ${enable_addins_sharp}"
echo "NUnit: ${enable_tests}"
echo "Debug enabled: ${enable_debug}"
......
<Addin namespace="gbrainy"
version="1.00"
name="CalculationSample"
description="Calculation game Sample"
author="Jordi Mas"
url=""
defaultEnabled="true"
category="Calculation">
<Dependencies>
<Addin id="gbrainy" version="1.00"/>
</Dependencies>
<Extension path="/gbrainy/games/calculation">
<Calculation type="CalculationSample" />
</Extension>
</Addin>
/*
* Copyright (C) 2007-2008 Jordi Mas i Hernàndez <jmas@softcatala.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
using System;
using Cairo;
using System.Text;
using gbrainy.Core.Main;
using gbrainy.Core.Libraries;
public class CalculationSample : Game
{
private int number_a, number_b;
private int op1, op2, max_operand;
public override string Name {
get {return "Calculation sample";}
}
public override GameTypes Type {
get { return GameTypes.Calculation;}
}
public override string Question {
get {return String.Format ("Which two numbers when added are {0} and when multiplied are {1}?", op1, op2);}
}
protected override void Initialize ()
{
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
max_operand = 8;
break;
case GameDifficulty.Medium:
max_operand = 10;
break;
case GameDifficulty.Master:
max_operand = 15;
break;
}
number_a = 5 + random.Next (max_operand);
number_b = 3 + random.Next (max_operand);
op1 = number_a + number_b;
op2 = number_a * number_b;
Answer.Correct = String.Format ("{0} and {1}", number_a, number_b);
}
public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double x = DrawAreaX + 0.1;
base.Draw (gr, area_width, area_height, rtl);
gr.SetPangoLargeFontSize ();
gr.MoveTo (x, DrawAreaY + 0.22);
gr.ShowPangoText (String.Format ("number1 + number2 = {0}", op1));
gr.MoveTo (x, DrawAreaY + 0.44);
gr.ShowPangoText (String.Format ("number1 * number2 = {0}", op2));
gr.Color = new Color (0.9, 0.9, 0.9);
gr.DrawTextCentered (0.5, DrawAreaY, "This is an extension sample");
}
public override bool CheckAnswer (string answer)
{
string num_a = string.Empty;
string num_b = string.Empty;
bool first = true;
for (int c = 0; c < answer.Length; c++)
{
if (answer[c] < '0' || answer[c] > '9') {
first = false;
continue;
}
if (first == true)
num_a += answer[c];
else
num_b += answer[c];
}
try {
if (Int32.Parse (num_a) == number_a && Int32.Parse (num_b) == number_b ||
Int32.Parse (num_b) == number_a && Int32.Parse (num_a) == number_b)
return true;
}
catch (FormatException) {
return false;
}
return false;
}
}
TARGET = gbrainy.calculation_sample_extension.dll
all: CalculationSample.cs CalculationSample.addin.xml
gmcs -t:library CalculationSample.cs -resource:CalculationSample.addin.xml -pkg:gbrainy -out:$(TARGET)
clean:
rm $(TARGET) -r -f
TARGET = gbrainy.logic_sample_extension.dll
all: PuzzleSample.cs PuzzleSample.addin.xml
gmcs -t:library PuzzleSample.cs -resource:PuzzleSample.addin.xml -pkg:gbrainy -out:$(TARGET)
clean:
rm $(TARGET) -r -f
<Addin namespace="gbrainy"
version="1.00"
name="Puzzle Sample"
description="Puzzle Sample description"
author="Jordi Mas"
url=""
defaultEnabled="true"
category="Logic">
<Dependencies>
<Addin id="gbrainy" version="1.00"/>
</Dependencies>
<Extension path="/gbrainy/games/logic">
<Logic type="PuzzleSample" />
</Extension>
</Addin>
/*
* Copyright (C) 2008 Jordi Mas i Hernàndez <jmas@softcatala.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
using Cairo;
using System;
using gbrainy.Core.Main;
using gbrainy.Core.Libraries;
public class PuzzleSample : Game
{
public override string Name {
get {return "Puzzle sample";}
}
public override string Question {
get {return "In a party all the people is introduced to the rest. There are 28 handshakes. How many people is in the party?";}
}
protected override void Initialize ()
{
Answer.Correct = "8";
}
public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
{
base.Draw (gr, area_width, area_height, rtl);
gr.Color = new Color (0.4, 0.4, 0.4);
gr.DrawTextCentered (0.5, DrawAreaY, "This is an extension sample");
}
}
all: subdirs
.PHONY: all subdirs clean
subdirs:
${MAKE} -C Logic ${MAKECMDGOALS}
${MAKE} -C Memory ${MAKECMDGOALS}
${MAKE} -C Calculation ${MAKECMDGOALS}
clean: subdirs
TARGET = gbrainy.memory_sample_extension.dll
all: MemorySample.cs MemorySample.addin.xml
gmcs -t:library MemorySample.cs -resource:MemorySample.addin.xml -pkg:gbrainy -out:$(TARGET)
clean:
rm $(TARGET) -r -f
<Addin namespace="gbrainy"
version="1.00"
name="MemorySample"
description="Memory game Sample"
author="Jordi Mas"
url=""
defaultEnabled="true"
category="Memory">
<Dependencies>
<Addin id="gbrainy" version="1.00"/>
</Dependencies>
<Extension path="/gbrainy/games/memory">
<Memory type="MemorySample" />
</Extension>
</Addin>
/*
* Copyright (C) 2007-2008 Jordi Mas i Hernàndez <jmas@softcatala.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
using System;
using Cairo;
using System.Timers;
using System.Collections.Generic;
using gbrainy.Core.Main;
using gbrainy.Core.Libraries;
public class MemorySample : Memory
{
ArrayListIndicesRandom animals_order;
List <string> animals;
int showed;
int answer;
public override string Name {
get {return "Memory sample";}
}
public override string MemoryQuestion {
get {
return "There is a missing animal name from the previous list. Which one is missing?";}
}
protected override void Initialize ()
{
int tmp;
animals = new List <string> ();
animals.Add ("dog");
animals.Add ("cat");
animals.Add ("rat");
animals.Add ("bird");
animals.Add ("sardine");
animals.Add ("trout");
animals.Add ("monkfish");
animals.Add ("cod");
animals.Add ("salmon");
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
showed = 4;
break;
case GameDifficulty.Medium:
showed = 6;
break;
case GameDifficulty.Master:
showed = 8;
break;
}
animals_order = new ArrayListIndicesRandom (animals.Count);
animals_order.Initialize ();
answer = random.Next (showed);
tmp = animals_order [answer];
Answer.Correct = animals [tmp];
base.Initialize ();
}
public override void DrawPossibleAnswers (CairoContextEx gr, int area_width, int area_height, bool rtl)
{
double x= DrawAreaX + 0.125, y = DrawAreaY + 0.1;
int cnt = 0;
for (int i = 0; i < showed; i++)
{
if (i == answer)
continue;
gr.MoveTo (x, y);
gr.ShowPangoText (animals[animals_order[i]]);
gr.Stroke ();
if ((cnt + 1) % 3 == 0) {
y += 0.2;
x = DrawAreaX + 0.125;
} else {
x+= 0.25;
}
cnt++;
}
gr.Color = new Color (0.9, 0.9, 0.9);
gr.DrawTextCentered (0.5, DrawAreaY, "This is an extension sample");
}
public override void DrawObjectToMemorize (CairoContextEx gr, int area_width, int area_height, bool rtl)
{
base.DrawObjectToMemorize (gr, area_width, area_height, rtl);
DrawObject (gr, area_width, area_height);
}
void DrawObject (CairoContextEx gr, int area_width, int area_height)
{
double x= DrawAreaX + 0.125, y = DrawAreaY + 0.1;
for (int i = 0; i < showed; i++)
{
gr.MoveTo (x, y);
gr.ShowPangoText (animals[animals_order[i]]);
gr.Stroke ();
if ((i + 1) % 3 == 0) {
y += 0.2;
x = DrawAreaX + 0.125;
} else {
x+= 0.25;
}
}
}
}
gbrainy sample extensions
Just type 'make' to build the samples
See https://wiki.gnome.org/Apps/gbrainy/Extending for more details
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DC13845E-1990-4713-90CD-DE154D924D12}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>sample_extensions</RootNamespace>
<AssemblyName>gbrainy.calculation_sample_extension</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Mono.Cairo" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\src\Core\Core.csproj">
<Project>{9F2F1F0C-DF7E-4054-B6BA-94F3DD9FF3D9}</Project>
<Name>Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Calculation\CalculationSample.addin.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Calculation\CalculationSample.cs" />
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DC13845E-1990-4713-90CD-DC154D9B4C12}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>sample_extensions</RootNamespace>
<AssemblyName>gbrainy.logic_sample_extension</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Mono.Cairo" />
</ItemGroup>
<ItemGroup>
<Compile Include="Logic\PuzzleSample.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\src\Core\Core.csproj">
<Project>{9F2F1F0C-DF7E-4054-B6BA-94F3DD9FF3D9}</Project>
<Name>Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Logic\PuzzleSample.addin.xml">
<LogicalName>Logic.PuzzleSample.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DC13845E-1990-4713-90CD-AC154D9B4D10}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>sample_extensions</RootNamespace>
<AssemblyName>gbrainy.memory_sample_extension</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Mono.Cairo" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\src\Core\Core.csproj">
<Project>{9F2F1F0C-DF7E-4054-B6BA-94F3DD9FF3D9}</Project>
<Name>Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Memory\MemorySample.addin.xml">
<LogicalName>Memory.MemorySample.addin.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="Memory\MemorySample.cs" />
</ItemGroup>
</Project>
EXTRAFLAGS = -nowarn:0169 $(CSC_DEFINES)
#EXTRAFLAGS = -nowarn:0169 $(CSC_DEFINES)
WRAPPER = gbrainy
TARGET_CFG = ../../gbrainy.exe.config
......@@ -21,7 +21,6 @@ GBRAINY_CSDISTFILES = \
ASSEMBLIES = \
$(GBRAINY_LIBS) \
$(MONO_ADDINS_LIBS) \
-r:../../gbrainy.Core.dll \
-r:Mono.Posix
......@@ -68,7 +67,6 @@ all: ../../gbrainy.exe $(TARGET_CFG)
EXTRA_DIST = \
gbrainy.ui \
$(srcdir)/gbrainy.exe.config.in \
$(srcdir)/MonoAddinsStrings.cs \
$(srcdir)/gbrainy.ui \
$(srcdir)/Dialogs/ui/PreferencesDialog.ui \
$(srcdir)/Dialogs/ui/PlayerHistoryDialog.ui \
......
/*
* Copyright (C) 2011 Jordi Mas i Hernàndez <jmas@softcatala.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
using System;
using Mono.Unix;
// To localize Mono.Addins.Gui we should include the GUI strings in the application
// See: http://groups.google.com/group/mono-addins/browse_thread/thread/b6c1d648c3493a65
//
// This file is never compiled just used from POTFILE.in to get the strings
public class MonoAddinsStrings
{
void SingularStrings ()
{
Catalog.GetString ("Add-in Manager");
Catalog.GetString ("Additional extensions are required to perform this operation.");
Catalog.GetString ("The following add-ins will be installed:");
Catalog.GetString ("<big><b>Add-in Manager</b></big>");
Catalog.GetString ("The following add-ins are currently installed:");
Catalog.GetString ("_Install Add-ins...");
Catalog.GetString ("_Repositories...");
Catalog.GetString ("_Uninstall...");
Catalog.GetString ("Enable");
Catalog.GetString ("Disable");
Catalog.GetString ("Add-in");
Catalog.GetString ("Version");
Catalog.GetString ("Other");
Catalog.GetString ("Version:");
Catalog.GetString ("Author:");
Catalog.GetString ("Copyright:");
Catalog.GetString ("Add-in Dependencies:");
Catalog.GetString ("<b>Select the add-ins to install and click on Next</b>");
Catalog.GetString ("Show all packages");
Catalog.GetString ("Show new versions only");
Catalog.GetString ("Show updates only");
Catalog.GetString ("_Unselect All");
Catalog.GetString ("Select _All");
Catalog.GetString ("Add-in Installation");
Catalog.GetString ("Name");
Catalog.GetString ("Url");
Catalog.GetString ("Install from:");
Catalog.GetString ("Repository");
Catalog.GetString ("All registered repositories");
Catalog.GetString ("Register an on-line repository");
Catalog.GetString ("Select the location of the repository you want to register:");
Catalog.GetString ("Register a local repository");
Catalog.GetString ("Url:");
Catalog.GetString ("Browse...");
Catalog.GetString ("Path:");
/* Mono Addins 0.6 */
Catalog.GetString ("Installed");
Catalog.GetString ("Updates");
Catalog.GetString ("Gallery");
Catalog.GetString ("Repository:");
Catalog.GetString ("Install from file...");
Catalog.GetString ("No selection");
Catalog.GetString ("No add-ins found");
Catalog.GetString ("Refresh");
Catalog.GetString ("Add-in packages");
Catalog.GetString ("Install Add-in Package");
Catalog.GetString ("All repositories");
Catalog.GetString ("Manage Repositories...");
Catalog.GetString ("Add-in Repository Management");
}
void PluralStrings ()
{
int variable = 0;
// Translators: {0} is a number indicating the Addins available for update
Catalog.GetPluralString ("{0} update available", "{0} updates available", variable)
}
}
......@@ -29,10 +29,6 @@ using gbrainy.Core.Libraries;
using gbrainy.Clients.Classical.Dialogs;
using gbrainy.Clients.Classical.Widgets;
#if MONO_ADDINS
using Mono.Addins;
using Mono.Addins.Setup;
#endif
namespace gbrainy.Clients.Classical
{
......@@ -190,20 +186,7 @@ namespace gbrainy.Clients.Classical
if (show_toolbar == false)
showtoolbar_menuitem.Active = false;
#if MONO_ADDINS
extensions_menuitem.Activated += delegate (object sender, EventArgs ar)
{
if (pluggins_loaded == false)
{
session.GameManager.LoadPlugins ();
}
Mono.Addins.Gui.AddinManagerWindow.Run (app_window);
GameManagerPreload (session.GameManager);
CustomGameDialog.Clear ();
};
#else
extensions_menuitem.Visible = false;
#endif
ActiveInputControls (false);
}
......