{"id":79,"date":"2011-07-28T14:03:59","date_gmt":"2011-07-28T14:03:59","guid":{"rendered":"http:\/\/www.benbarefield.com\/blog\/?p=79"},"modified":"2011-07-28T14:03:59","modified_gmt":"2011-07-28T14:03:59","slug":"scala-xna","status":"publish","type":"post","link":"https:\/\/www.benbarefield.com\/blog\/2011\/07\/28\/scala-xna\/","title":{"rendered":"Scala XNA"},"content":{"rendered":"<p>One of the things that I thought would be a really cool demonstration of Scala.Net was to have an XNA application that was coded completely in Scala. I have mixed news on the subject. I did successfully get an XNA window opened and the game loop running. However, as far as I can tell, all of the ways to draw in XNA rely on generics, which are not yet supported in Scala.Net.<\/p>\n<p>After a short email exchange with <a href=\"http:\/\/lamp.epfl.ch\/~magarcia\/\">Miguel<\/a>, I was able to get Scala compiling against some of the XNA assemblies. This allowed me to extend the Game class and open an XNA window. The problem I was having was compiling the Scala against multiple dependent dlls. I expected the \u201cXassem-path\u201dargument to take multiple parameters, one for each of the assemblies. Instead, the solution was to add another \u2013Xassem-extdirs path that contained the XNA assemblies (and mscorlib.) My compile looks like:<\/p>\n<p>&lt;Scala.Net directory&gt;\\bin\\scalacompiler.exe&#160; <br \/>\u2013target:msil&#160; <br \/>\u2013Xassem-extdirs &lt;Scala.Net directory&gt;\\bin    <br \/>-Xassem-extdirs &lt;directory with XNA assemblies&gt;    <br \/>-Xshow-class &lt;Scala class with main defined&gt;    <br \/>-Xassem-name &lt;Name of MSIL file to output&gt;    <br \/>&lt;scala files&gt;<\/p>\n<p>After running ilasm on the MSIL file generated, corflags needs to be run on the resulting executable to put it into <a href=\"http:\/\/www.benbarefield.com\/blog\/?p=77\">32 bit mode<\/a>. Running the executable opens the game window.<\/p>\n<p>This is certainly a proof of concept; unfortunately that is as far as I could reasonably get. Miguel seems committed to getting Generics support in Scala.Net, so it should be possible to build a full game soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the things that I thought would be a really cool demonstration of Scala.Net was to have an XNA application that was coded completely in Scala. I have mixed news on the subject. I did successfully get an XNA &hellip; <a href=\"https:\/\/www.benbarefield.com\/blog\/2011\/07\/28\/scala-xna\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,28,22],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-net","category-scala","category-xna"],"_links":{"self":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":0,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.benbarefield.com\/blog\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}