<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Tuto_Gideros_Game_Template1_Part_2_Init</id>
	<title>Tuto Gideros Game Template1 Part 2 Init - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Tuto_Gideros_Game_Template1_Part_2_Init"/>
	<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_2_Init&amp;action=history"/>
	<updated>2026-11-18T01:34:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_2_Init&amp;diff=23843&amp;oldid=prev</id>
		<title>MoKaLux: Created page with &quot;__TOC__ == the init.lua file == In the &#039;&#039;init.lua&#039;&#039; file we will initialize some global variables.  It is nothing too fancy and mostly uses Gideros standard API.  In this file...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Tuto_Gideros_Game_Template1_Part_2_Init&amp;diff=23843&amp;oldid=prev"/>
		<updated>2024-10-25T17:11:16Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__TOC__ == the init.lua file == In the &amp;#039;&amp;#039;init.lua&amp;#039;&amp;#039; file we will initialize some global variables.  It is nothing too fancy and mostly uses Gideros standard API.  In this file...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
== the init.lua file ==&lt;br /&gt;
In the &amp;#039;&amp;#039;init.lua&amp;#039;&amp;#039; file we will initialize some global variables.&lt;br /&gt;
&lt;br /&gt;
It is nothing too fancy and mostly uses Gideros standard API.&lt;br /&gt;
&lt;br /&gt;
In this file we will initialize:&lt;br /&gt;
* some additional plugins you may have&lt;br /&gt;
* some global app variables, like the user screen size and the app size (mobile friendly)&lt;br /&gt;
* we also setup our fonts variables here because we may use them in more than one scene&lt;br /&gt;
* we setup a table to hold the overall theme of our app. Mostly UI related like app background and buttons&lt;br /&gt;
* finally we also store all tweens in a table we can refer to in other scenes&lt;br /&gt;
&lt;br /&gt;
All of the above variables may be used in multiple if not all scenes of our game, so imho it makes sense to centralize them all here.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- plugins&lt;br /&gt;
&lt;br /&gt;
-- global app variables&lt;br /&gt;
screenwidth, screenheight = application:get(&amp;quot;screenSize&amp;quot;) -- the actual user screen size!&lt;br /&gt;
myappleft, myapptop, myappright, myappbot = application:getLogicalBounds()&lt;br /&gt;
myappwidth, myappheight = myappright - myappleft, myappbot - myapptop&lt;br /&gt;
--print(myappleft, myapptop, myappright, myappbot)&lt;br /&gt;
--print(myappwidth, myappheight)&lt;br /&gt;
ismyappfullscreen = false&lt;br /&gt;
&lt;br /&gt;
-- global ttf fonts&lt;br /&gt;
myttf = TTFont.new(&amp;quot;fonts/Cabin-Regular-TTF.ttf&amp;quot;, 2.8*8) -- UI&lt;br /&gt;
myttf2 = TTFont.new(&amp;quot;fonts/Cabin-Regular-TTF.ttf&amp;quot;, 1.5*8) -- HUD&lt;br /&gt;
&lt;br /&gt;
-- global ui theme&lt;br /&gt;
application:setBackgroundColor(0x46464a)&lt;br /&gt;
g_ui_theme = {}&lt;br /&gt;
g_ui_theme.pixelcolorup = 0xb29058&lt;br /&gt;
g_ui_theme.pixelcolordown = 0xc26966&lt;br /&gt;
g_ui_theme.textcolorup = 0xf49c13&lt;br /&gt;
g_ui_theme.textcolordown = 0xffb889&lt;br /&gt;
g_ui_theme._textcolordisabled = 0x87837f&lt;br /&gt;
g_ui_theme.tooltiptextcolor = 0xfaff89&lt;br /&gt;
g_ui_theme.exit = 0xf41212&lt;br /&gt;
g_ui_theme.tooltipoffsetx = -7*8&lt;br /&gt;
g_ui_theme.tooltipoffsety = 1*4&lt;br /&gt;
&lt;br /&gt;
-- tweens table for transitions&lt;br /&gt;
tweens = {&lt;br /&gt;
	&amp;quot;inBack&amp;quot;, -- 1&lt;br /&gt;
    &amp;quot;outBack&amp;quot;, -- 2&lt;br /&gt;
    &amp;quot;inOutBack&amp;quot;, -- 3&lt;br /&gt;
    &amp;quot;inBounce&amp;quot;, -- 4&lt;br /&gt;
    &amp;quot;outBounce&amp;quot;, -- 5&lt;br /&gt;
    &amp;quot;inOutBounce&amp;quot;, -- 6&lt;br /&gt;
    &amp;quot;inCircular&amp;quot;, -- 7&lt;br /&gt;
    &amp;quot;outCircular&amp;quot;, -- 8&lt;br /&gt;
    &amp;quot;inOutCircular&amp;quot;, -- 9&lt;br /&gt;
    &amp;quot;inCubic&amp;quot;, -- 10&lt;br /&gt;
    &amp;quot;outCubic&amp;quot;, -- 11&lt;br /&gt;
    &amp;quot;inOutCubic&amp;quot;, -- 12&lt;br /&gt;
    &amp;quot;inElastic&amp;quot;, -- 13&lt;br /&gt;
    &amp;quot;outElastic&amp;quot;, -- 14&lt;br /&gt;
    &amp;quot;inOutElastic&amp;quot;, -- 15&lt;br /&gt;
    &amp;quot;inExponential&amp;quot;, -- 16&lt;br /&gt;
    &amp;quot;outExponential&amp;quot;, -- 17&lt;br /&gt;
    &amp;quot;inOutExponential&amp;quot;, -- 18&lt;br /&gt;
    &amp;quot;linear&amp;quot;, -- 19&lt;br /&gt;
    &amp;quot;inQuadratic&amp;quot;, -- 20&lt;br /&gt;
    &amp;quot;outQuadratic&amp;quot;, -- 21&lt;br /&gt;
    &amp;quot;inOutQuadratic&amp;quot;, -- 22&lt;br /&gt;
    &amp;quot;inQuartic&amp;quot;, -- 23&lt;br /&gt;
    &amp;quot;outQuartic&amp;quot;, -- 24&lt;br /&gt;
    &amp;quot;inOutQuartic&amp;quot;, -- 25&lt;br /&gt;
    &amp;quot;inQuintic&amp;quot;, -- 26&lt;br /&gt;
    &amp;quot;outQuintic&amp;quot;, -- 27&lt;br /&gt;
    &amp;quot;inOutQuintic&amp;quot;, -- 28&lt;br /&gt;
    &amp;quot;inSine&amp;quot;, -- 29&lt;br /&gt;
    &amp;quot;outSine&amp;quot;, -- 30&lt;br /&gt;
    &amp;quot;inOutSine&amp;quot;, -- 31&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Next? ==&lt;br /&gt;
That&amp;#039;s it! In the next part we will code our &amp;#039;&amp;#039;main.lua&amp;#039;&amp;#039; file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prev.: [[Tuto Gideros Game Template1 Part 1 Project Setup]]&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Next: [[Tuto Gideros Game Template1 Part 3 Main]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Tutorial - Gideros Game Template1]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
{{GIDEROS IMPORTANT LINKS}}&lt;/div&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
</feed>