首页 \ 问答 \ 如何在Phaser Framework中截取画布截图?(How do I take a screenshot of canvas in Phaser Framework?)

如何在Phaser Framework中截取画布截图?(How do I take a screenshot of canvas in Phaser Framework?)

我正在使用Phaser Framework制作游戏。 我尝试使用todateurl但它没有定义,我做错了什么?

var game = new Phaser.Game(1000, 700, Phaser.CANVAS, 'game');
game.state.add('boot', boots);
game.state.add('load', loads);  
game.state.start('boot');  
console.log(game);   // works
console.log(game.canvas);    // works
game.canvas.toDataURL();    //undefined

I am making a game using Phaser Framework. I try to use todateurl but it isn't defined, what am I doing wrong?

var game = new Phaser.Game(1000, 700, Phaser.CANVAS, 'game');
game.state.add('boot', boots);
game.state.add('load', loads);  
game.state.start('boot');  
console.log(game);   // works
console.log(game.canvas);    // works
game.canvas.toDataURL();    //undefined

原文:https://stackoverflow.com/questions/27869544
更新时间:2023-03-10 17:03

最满意答案

像这样添加你的专栏: -

tempFoodItems.Columns.Add("IncludeInFoodBag",typeof(bool));

您需要在将数据类型添加到DataTable时添加列的数据类型。


Add your column like this:-

tempFoodItems.Columns.Add("IncludeInFoodBag",typeof(bool));

You need add the datatype of column while adding it to DataTable.

相关问答

更多
  • 使用Convert.ToDouble(value)而不是(double)value 。 它需要一个object并且支持你要求的所有类型! :) 另外,你的方法总是在上面的代码中返回一个string ; 我建议让方法指出,并给它一个更明显的名称( public string FormatLargeNumber(object value) ) Use Convert.ToDouble(value) rather than (double)value. It takes an object and support ...
  • 它可能不是最好的解决方案,但我改变了我的存储过程来计算: @SessionID INT SELECT ID, COUNT(Member) AS Count FROM Table WHERE SessionID = @SessionID GROUP BY ID 返回一个包含ID的表和每个ID的成员总数 因此,我不是在foreach循环中获取每个ID的计数值,而是在进入foreach循环之前检索ID和Count列表,这样可行。 我仍然不明白为什么我得到了投射错误,所以如果有人能解释我错过的东西,我会把 ...
  • 像这样添加你的专栏: - tempFoodItems.Columns.Add("IncludeInFoodBag",typeof(bool)); 您需要在将数据类型添加到DataTable时添加列的数据类型。 Add your column like this:- tempFoodItems.Columns.Add("IncludeInFoodBag",typeof(bool)); You need add the datatype of column while adding it to DataTa ...
  • BigInt需要被映射为long ,这是C#中等效的64位整数值。 此外,你应该改变你的代码是这样的: int slnoCol = reader.GetOrdinal("Slno"); int rlnoCol = reader.GetOrdinal("Rlno"); obj.Total1 = !reader.IsDBNull(slnoCol) ? reader.GetInt64(slnoCol) : (long)0; obj.Total2 = !reader.IsDBNull(rlnoCol) ? rea ...
  • WebBrowser是一个COM组件。 一个公寓通过一个公寓,COM负责以线程安全的方式调用它的方法。 你的Navigate()调用就是出于这个原因,它实际上是在UI线程上执行的。 不起作用的是DocumentText属性,它是在.NET包装器中实现的,它们有些让人失望。 当CLR中的COM互操作支持发现MTA中的线程试图访问驻留在STA上的组件的属性时,它会发生爆炸。 您对SetApartmentState()的调用不正确。 它是在错误的线程上创建的,UI线程已经是STA。 此外,它不会炸弹的原因,你不能 ...
  • 这通常是由数据类型不匹配引起的,例如,如果存储过程返回一个int并将其映射到一个字符串,或者存储的proc返回一个varchar(1)并映射到System.Char。 That is usually caused by a data type mismatch, e.g. if the stored procedure returns a int and that is mapped to a string, or if the stored proc return a varchar(1) and tha ...
  • 问题:嘿,您需要记住使用以下语句执行隐式转换: int result = (int) cmd.ExecuteScalar(); 隐式转换仅在值为有效整数时有效。如果它包含类似10.0的值或某些空格则不起作用。 解决方案:如果要获取所有caes中的值,则需要使用Convert.ToInt32()方法使用显式转换。 尝试这个: int result = Convert.ToInt32(cmd.ExecuteScalar()); Problem : hee you need to remember th ...
  • 你不能在这里使用取消装箱: return ((int)(result.ReturnValue)); 请参阅http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx 灵魂是 return ((Int32.Parse(result.ReturnValue)); 但是如果result.ReturnValue为null,它也会抛出异常。 更安全 int a=0; Int32.TryParse(result.ReturnValue, out a); return ...
  • 你应该使用: var Date = Convert.ToDateTime(n3["YOUR_DATE_COLUMN"]); You should use: var Date = Convert.ToDateTime(n3["YOUR_DATE_COLUMN"]);
  • 如果user_id在数据库中是int类型,则它与32位整数匹配。 改为使用GetInt32() : _userId = _fieldReader.GetInt32(0); If user_id is int type in your database it match with a 32bits integer. Use GetInt32() instead : _userId = _fieldReader.GetInt32(0);

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。