{"id":96,"date":"2015-07-23T17:49:00","date_gmt":"2015-07-23T17:49:00","guid":{"rendered":"https:\/\/therenaissanceraven.com\/?p=96"},"modified":"2015-07-23T17:49:00","modified_gmt":"2015-07-23T17:49:00","slug":"libgdx-getting-started-running-desktop","status":"publish","type":"post","link":"https:\/\/therenaissanceraven.com\/?p=96","title":{"rendered":"*libGDX* Getting started &#8211; Running Desktop."},"content":{"rendered":"<p>Coming straight from creating your very first libGDX project, your main class and project folder should look like the following:<\/p>\n<div style=\"clear: both; text-align: center;\"><a href=\"http:\/\/4.bp.blogspot.com\/-JS1T-L5oeYc\/VbFE6Y6KZCI\/AAAAAAAAAWo\/UK8KvUuEm2M\/s1600\/Pic%2B2-1.PNG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/4.bp.blogspot.com\/-JS1T-L5oeYc\/VbFE6Y6KZCI\/AAAAAAAAAWo\/UK8KvUuEm2M\/s1600\/Pic%2B2-1.PNG\" \/><\/a><\/div>\n<p>Now we are going to enable the feature that I believe is one of the best reasons for using libGDX, that is testing the game in the desktop mode. To do that, we need to open &#8220;Run\/Debug Configurations&#8221; window -&gt; click the green arrow on the top left and select &#8220;application&#8221; and edit it as follows:<\/p>\n<p><a href=\"http:\/\/1.bp.blogspot.com\/-nVsqHNY0J34\/VbFE6GRMuUI\/AAAAAAAAAWs\/c4cRLUj-bXo\/s1600\/Pic%2B2-2.PNG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/1.bp.blogspot.com\/-nVsqHNY0J34\/VbFE6GRMuUI\/AAAAAAAAAWs\/c4cRLUj-bXo\/s1600\/Pic%2B2-2.PNG\" \/><\/a><\/p>\n<p>Click &#8220;ok&#8221; and continue. Now the desktop launcher should be the default debugging launcher and when you &#8220;run&#8221; or &#8220;shift+f10&#8221;, the following should happen:<\/p>\n<p><a href=\"http:\/\/3.bp.blogspot.com\/-bHo4d-YPqQQ\/VbFE6A6vWQI\/AAAAAAAAAWk\/bYNd9gGwpEU\/s1600\/Pic%2B2-3.PNG\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/3.bp.blogspot.com\/-bHo4d-YPqQQ\/VbFE6A6vWQI\/AAAAAAAAAWk\/bYNd9gGwpEU\/s1600\/Pic%2B2-3.PNG\" \/><\/a><\/p>\n<p>Note: The most common error is the resource file not found, make sure your working directory in the run configurations is set to the assets folder under android.<\/p>\n<p>A final note is on how to change the screen size of the desktop version. This can be done in the desktop launcher class by adding the commands below:<br \/><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;\">\n<table>\n<tbody>\n<tr>\n<td>\n<pre style=\"line-height: 125%; margin: 0;\">1<br \/><br \/>2<br \/><br \/>3<br \/><br \/>4<br \/><br \/>5<br \/><br \/>6<br \/><br \/>7<br \/><br \/>8<br \/><br \/>9<\/pre>\n<\/td>\n<td>\n<pre style=\"line-height: 125%; margin: 0;\"><span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #008800; font-weight: bold;\">class<\/span> <span style=\"color: #bb0066; font-weight: bold;\">DesktopLauncher<\/span> <span style=\"color: #333333;\">{<\/span><br \/><br \/> <span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #008800; font-weight: bold;\">static<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">main<\/span> <span style=\"color: #333333;\">(<\/span>String<span style=\"color: #333333;\">[]<\/span> arg<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{<\/span><br \/><br \/>  LwjglApplicationConfiguration config <span style=\"color: #333333;\">=<\/span> <span style=\"color: #008800; font-weight: bold;\">new<\/span> LwjglApplicationConfiguration<span style=\"color: #333333;\">();<\/span><br \/><br \/>        config<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">width<\/span> <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">800<\/span><span style=\"color: #333333;\">;<\/span><br \/><br \/>        config<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">height<\/span> <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">480<\/span><span style=\"color: #333333;\">;<\/span><br \/><br \/>  <span style=\"color: #008800; font-weight: bold;\">new<\/span> <span style=\"color: #0066bb; font-weight: bold;\">LwjglApplication<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #008800; font-weight: bold;\">new<\/span> AdlermacGame<span style=\"color: #333333;\">(),<\/span> config<span style=\"color: #333333;\">);<\/span><br \/><br \/><br \/> <span style=\"color: #333333;\">}<\/span><br \/><br \/><span style=\"color: #333333;\">}<\/span><br \/><br \/><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Congratulations, your first game is now a simple picture, but hey, at least something was created, right?<\/p>\n<p>Now its time to actually start making something that moves, or has a time line that we can use to make our game, but before we can begin that, we will start our journey by creating some mental framework for our game to stand upon <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coming straight from creating your very first libGDX project, your main class and project folder should look like the following: Now we are going to enable the feature that I believe is one of the best reasons for using libGDX, that is testing the game in the desktop mode. To do that, we need to&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":0,"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/therenaissanceraven.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}