• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Print in a game

LittleAngel

Member
Hi,

I didn' find any instruction to print a page.
Do you have any idea how to do this for a windows game and also for a html5 game?
I would make a coloring game and after to print the page.

Thanks for your help !
 

LittleAngel

Member
Thank you very much !
Indeed this can be a good solution for a Windows program, but for a html5 game, this is not the right solution. Perhaps make a php function?
 

jo-thijs

Member
If php could do that, some magic must be at hand...
That or your server is allowed to communicate with the printers of your clients.

In javascript though, you can use window.print() to print the window.
This might not be optimal, but it's the closest I thing I could find by now.
You can create javascript extensions for GameMaker, so you can use this.
 

LittleAngel

Member
Ah yes !
"You can create javascript extensions for GameMaker"
At first I thought to call an external php, but do a java extension is much better, I had not thought.
Thank you very much.
 
This may be a dumb question, cause I'm not very familiar with using Studio with HTML5, but couldn't you just use the print functionality of the browser it's being run in?
 

LittleAngel

Member
Yes of course, it possible but I want to launch it from the game (to be more convenient for children).

For Html5 game, just create a .js file :

function printer () { window.print() }

Then create an extension with the same name.
In Game Maker just call with:

printer()

It works like a charm !
Thank you.
 
Top