[Sugar-devel] SugarGames, GTK3 and fonts ?

Alan Jhonn Aguiar Schwyn alanjas at hotmail.com
Wed Sep 25 10:54:35 EDT 2013


SugarGames is a "bit" deprecated but works. There are a lot of activities that uses it.In my case, all my activities (except one) uses SugarGames library.
To do a toolbar, only add a few lines in activity.py like the patch attached.I test on sugar-build and works good!
You can use PyGame directly, but when activity loads, it open another window andyou not have the sugar toolbars.
And yes.. Pygame is the better python game library!
Regards!
Alan

Date: Wed, 25 Sep 2013 13:23:07 +0200
Subject: Re: [Sugar-devel] SugarGames, GTK3 and fonts ?
From: laurent.bernabe at gmail.com
To: alanjas at hotmail.com
CC: gonzalo at laptop.org; sugar-devel at lists.sugarlabs.org

I've applied the patch : but, as Gonzalo Odiard made me notice, perhaps I'd better not rely on deprecated sugargame library any more : right ?So I think I have to use plain gtk3 fonts and canvas (is there one ? I did not find any note on the official python GTK3 tutorial : http://python-gtk-3-tutorial.readthedocs.org/en/latest/), and also make an activity class for the integration with the olpc (toolbar).

Or can I use Pygames without the sugargame layer ? Because PyGame make animations coding easier : I remember that in GTK2 I had some pains for using threads : because in PyGTK2 there was a kind of restriction (though I can't remember which) with threads coding.

Regards

2013/9/25 laurent bernabe <laurent.bernabe at gmail.com>

Thank you very much : I'll apply those changes today.


2013/9/25 Alan Jhonn Aguiar Schwyn <alanjas at hotmail.com>




Copy the patch to your GIT folder and do:
git apply 0001-....
After, if you like the changes, can commit them.
In Pygame, when you do:


font = pygame.font.Font(None, 30)
It selects the default font of the system (I don't know the name).
If you want to see all fonts:


all_fonts = pygame.font.get_fonts()
Or load a specific font:
font = pygame.font.Font("path/to/the/font/my_font.ttf", 30)
Regards!


Alan

Date: Tue, 24 Sep 2013 20:32:27 +0200
Subject: Re: [Sugar-devel] SugarGames, GTK3 and fonts ?
From: laurent.bernabe at gmail.com


To: alanjas at hotmail.com
CC: gonzalo at laptop.org; sugar-devel at lists.sugarlabs.org



Thanks for your patch Alan : how must I apply them ? (I have not used patch before).
Yes, I am very happy that you purpose me to develop the GTK2 version :)I have tried to do my best to code in respect with pep8 (using autopep8 program) and pyflakes.



What are the default fonts in Sugar ? (Sorry, I did not look for standards)
Regards

2013/9/24 Alan Jhonn Aguiar Schwyn <alanjas at hotmail.com>






I have this patchs for you.One to evite track .pyc and other extensions that no have sense add to git.
The second, it's a few of changes for that you code works with Sugargames


library.You must make another few of changes. I use the default font, for example.
If you want, you can do the GTK3 version and I translate to GTK2 :-)
Regards!



Alan

Date: Tue, 24 Sep 2013 14:56:31 -0300
Subject: Re: [Sugar-devel] SugarGames, GTK3 and fonts ?
From: gonzalo at laptop.org



To: laurent.bernabe at gmail.com
CC: alanjas at hotmail.com; sugar-devel at lists.sugarlabs.org




No problem.In fact, tusmath is a c game, and that is a problem,because is not multiplatform.Go ahead, but look at it to see what they do.
Gonzalo





On Tue, Sep 24, 2013 at 2:49 PM, laurent bernabe <laurent.bernabe at gmail.com> wrote:

Oups sorry
I did not notice that there was a similar game.
In fact, I am lacking ideas.

Regards


2013/9/24 Gonzalo Odiard <gonzalo at laptop.org>


If you add a mode similar to tuxmath,may be we can kill that game finally......
While the pedagogy of tuxmath is not the best,every deployment ask for it 






Gonzalo

On Tue, Sep 24, 2013 at 2:37 PM, laurent bernabe <laurent.bernabe at gmail.com> wrote:






Thank you.
So I think I'll try to develop for both GTK2 and GTK3.



It's a game, and I have nearly finished it for OLPC 0.100 : https://git.sugarlabs.org/hittheballs/hittheballs

It's a very simple game where balls with operations goes across a screen area, and user must choose good one(s).
Regards



2013/9/24 Alan Jhonn Aguiar Schwyn <alanjas at hotmail.com>







My case:
- I use Ubuntu with sugar-emulator 0.96 to test GTK2 activities. Only with a link of my GIT folderto ~/Activities and I'm ready to test it!







- For latest: I download the sugar-build and works. But in certain moment, it begin with a grade of complexthat I don't like. Now with the broot system, it's a bit complicated. But "is what you get".







To make a GTK2 and GTK3 activity you need make 2 codes, and maybe, two differentactivities. There are ways in python to check wich version of gtk you have in the systemand run a gtk2 or gtk3 activity. But that needs extra work to update both "branchs".







>So what do you advice me ? (developping in GTK2, GTK3, and/or web activity)
I don't know wich type of activity you want to do. It's a game?







Date: Tue, 24 Sep 2013 19:21:17 +0200
From: laurent.bernabe at gmail.com
To: alanjas at hotmail.com







CC: gonzalo at laptop.org; sugar-devel at lists.sugarlabs.org
Subject: Re: [Sugar-devel] SugarGames, GTK3 and fonts ?








Hello
In fact I am developping against GTK3 because I have the latest sugar-build, which holds the 0.100 version.
Otherwise, I can download the 0.94 or some versions under in SugarOnAStick format, or in a VirtualBox format : but this way I have difficulties for transferring easily the project from my host system to the guest sugar one. I tried, in VirtualBox, to use the guest additions in order to share a folder between the host and guest systems (some years ago), but I did not manage.








Also, I don't know how to develop the application so that it supports both gtk2 and gtk3.
And I was also planning to port the activity to a web acitvity, instead of a gtk one, but it may not be available to many OLPC that way. And I don't know where to start.








So what do you advice me ? (developping in GTK2, GTK3, and/or web activity)
Regards.


2013/9/24 Alan Jhonn Aguiar Schwyn <alanjas at hotmail.com>











Hi,
You only will make a GTK3 version?The latest sugar (0.100) is not used in any deployment:in all countries we have Sugar 0.94 or less.
Would be good have a GTK2 version of that activity.








Regards!
Alan

Date: Tue, 24 Sep 2013 16:45:13 +0200
From: laurent.bernabe at gmail.com
To: gonzalo at laptop.org








CC: sugar-devel at lists.sugarlabs.org
Subject: Re: [Sugar-devel] SugarGames, GTK3 and fonts ?

Thank you very much.








I'll try with Python/Cairo/Gtk3.

2013/9/24 Gonzalo Odiard <gonzalo at laptop.org>

If you are not porting a existing olpcgames application,I suggest you use something else.
You can use any of the html5 frameworks, or plain python/cairo stuff.sugargames de not have to much development, 
and pygame/gtk do not work really well together.
Gonzalo


On Tue, Sep 24, 2013 at 11:16 AM, laurent bernabe <laurent.bernabe at gmail.com> wrote:










Hello everyone,
As I am developping my game HitTheBalls for sugar 0.100 (I have, I think, the latest sugar-build), I am planning to switch it from OLPCGames 1.6 to sugargames.











But the sugargames tells that pango font is not supported. So, what is the best way to get started with fonts in SugarGames ? Do you have some links ? I searched over the web, and I found tutorials for Gtk3 and PangoCairo, but I don't know if these can work with SugarGames.











Regards

_______________________________________________

Sugar-devel mailing list

Sugar-devel at lists.sugarlabs.org

http://lists.sugarlabs.org/listinfo/sugar-devel







_______________________________________________
Sugar-devel mailing list
Sugar-devel at lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel 		 	   		  



_______________________________________________
Sugar-devel mailing list
Sugar-devel at lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel 		 	   		  







 		 	   		  

 		 	   		  



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130925/3cfc905b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-add-sugar-toolbar.patch
Type: application/octet-stream
Size: 2660 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130925/3cfc905b/attachment-0001.obj>


More information about the Sugar-devel mailing list