如何在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 ...
-
指定演员表无效#2(Specified cast is not valid #2)[2022-01-02]
它可能不是最好的解决方案,但我改变了我的存储过程来计算: @SessionID INT SELECT ID, COUNT(Member) AS Count FROM Table WHERE SessionID = @SessionID GROUP BY ID 返回一个包含ID的表和每个ID的成员总数 因此,我不是在foreach循环中获取每个ID的计数值,而是在进入foreach循环之前检索ID和Count列表,这样可行。 我仍然不明白为什么我得到了投射错误,所以如果有人能解释我错过的东西,我会把 ... -
复选框指定的转换无效(Checkbox Specified Cast is not Valid)[2023-01-11]
像这样添加你的专栏: - 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 ... -
指定的转换在C#中无效(Specified cast is not valid in C#)[2022-05-05]
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 ...
-
指定的演员表无效(Specified cast not valid)[2023-01-04]
问题:嘿,您需要记住使用以下语句执行隐式转换: int result = (int) cmd.ExecuteScalar(); 隐式转换仅在值为有效整数时有效。如果它包含类似10.0的值或某些空格则不起作用。 解决方案:如果要获取所有caes中的值,则需要使用Convert.ToInt32()方法使用显式转换。 尝试这个: int result = Convert.ToInt32(cmd.ExecuteScalar()); Problem : hee you need to remember th ... -
指定的Cast无效(The specified Cast is not a valid)[2022-04-02]
你不能在这里使用取消装箱: 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 ... -
指定演员表无效(Specified cast is not valid)[2022-11-25]
你应该使用: 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);