Love2d光标位置(Love2d cursor positions)
我有一个关于love2d(lua脚本)游标函数的问题。 我不想让一个区域点击以使行动发生。
我开始在x和y参数中跟踪for循环。 唯一的另一个问题是,如果它会经过数字/坐标的循环,并完成love.mouse.get()将结束的1个数字并允许光标最终被点击最后一个坐标(一个像素)。
for r = 660, 770 do --the x coordinates mx = love.mouse.getX(r) end for f = 99.33, 169.66 do --the y coordinates my = love.mouse.getY(f) end
我将如何结合两个循环变量(r和f)。
总结一切,我希望能够点击一个区域,并采取行动。 我知道没有love.load,love.update和love.draw函数,因为这只是一个测试文件,以了解所有这些工作。
谢谢 :)
I have a question about the love2d(lua script) cursor functions. I wan't to make an area to click to make an action happen.
I started on a track of for loops in the x and y parameters. The only other problem ive thought of is if it will go through a for loop of number/coordinates and finish on 1 number which the love.mouse.get() will end up on and allow for the cursor to end up being clicked on that last coordinate(one pixel).
for r = 660, 770 do --the x coordinates mx = love.mouse.getX(r) end for f = 99.33, 169.66 do --the y coordinates my = love.mouse.getY(f) end
And how would I combine the two for loop variables(r and f).
To sum everything up I want to be able to click on an area and do an action. I know there are no love.load, love.update, and love.draw functions because this is just a test file to learn how all this works.
Thank you :)
原文:https://stackoverflow.com/questions/40356519
最满意答案
我会说这取决于你的SQL Server索引哪个更快。 例如,如果SQL Server被索引以便它可以快速进行排序(或者数据非常小),那么数据表就可以了。
我通常希望SQL服务器在这方面比.NET代码更高效。
但是在一般的建筑笔记上。 如果排序是一个UI问题(从你的问题不清楚它是否是),那么订购客户端更有意义,特别是如果你将在其他地方使用数据表(可能以不同的顺序)。
I would say it depends on the indexing at your SQL Server as to which is faster. For instance if the SQL Server is indexed such that it can do the ordering quickly (or the data is very small) then the data table is fine.
I would generally expect the SQL server to be more efficient at this than the .NET code.
On a general architectual note though. If the ordering is a UI concern (it's not clear from your question if it is) then the ordering client-side makes more sense, especially if you'll use the datatable elsewhere (potentially in a different order).
相关问答
更多-
你有什么是正确的。 这将在集合中提供的值中被转换为SQL中的IN子句。 在不相关的说明中,您应该尝试按日期降序排序查询并使用FirstOrDefault() 。 就像现在一样,你要带回整个结果集并丢弃每一行,而不是一行。 What you have is correct. This will be translated into an IN clause in SQL with the values supplied in the collection. On an unrelated note, you ...
-
我同意Anand,你需要一个linq查询: var filterUserRecord = from u in MyDC.UserRecords where u.UserID == TheUserID select u; var q1 = from r in MyDC.RecordsTable where r.RecordID = TheRecordID where fil ...
-
你能使用Linq-to-SQL获得类似DataReader的流媒体吗?(Can you get DataReader-like streaming using Linq-to-SQL?)[2023-10-12]
1.)有没有办法阻止Linq-to-SQL在使用DataReader的过程中完成一个非常大的查询的执行? 不完全的。 最终执行查询后,基础SQL语句将返回匹配记录的结果集。 查询将推迟到该点,但不会在遍历期间推迟。 对于您的示例,您可以简单地使用records.Take(3)但我知道您停止进程的实际逻辑可能是SQL的外部或不容易翻译。 您可以通过构建强类型LINQ查询然后使用旧式ADO.NET执行它来使用组合方法。 缺点是你失去了到类的映射,并且必须手动处理SqlDataReader结果。 这方面的一个例子 ... -
提高LINQ查询性能(Improve LINQ query performance?)[2023-09-26]
您可以尝试将Where和OrderBy子句移动到视图本身,如有必要,可以使用存储过程/用户定义的函数传入参数。 您还可以将Glimpse添加到您的项目中。 在许多其他事情中,您可以检查SQL调用以查看是否有任何不必要或耗时的数据库命中。 You could try moving the Where and OrderBy clauses into the view itself, passing in parameters by using a stored procedure/ user defined ... -
这解决了。 感谢'CodeNotFound'获得此答案https://stackoverflow.com/a/43850748/1655774 db.Customer.Where(p => p.customer_active == true).Select(p => new CustomerViewModel { Customer_id= p.customer_id, Customer_name = p.customer_name, Produc ...
-
我会说这取决于你的SQL Server索引哪个更快。 例如,如果SQL Server被索引以便它可以快速进行排序(或者数据非常小),那么数据表就可以了。 我通常希望SQL服务器在这方面比.NET代码更高效。 但是在一般的建筑笔记上。 如果排序是一个UI问题(从你的问题不清楚它是否是),那么订购客户端更有意义,特别是如果你将在其他地方使用数据表(可能以不同的顺序)。 I would say it depends on the indexing at your SQL Server as to which is ...
-
如果您事先知道相关结构(表格和字段值),则可以基于该数据提供自定义映射源,而无需事先获得该对象。 对我来说,由于不同的原因,我最终使用了XmlMappingSource对象,因为它有一个.FromXml()方法,可以用来提供任意的Xml。 如果您查看sqlmetal生成的映射文件,您可以了解所需的Xml结构: 打开VS命令提示符(它位于开始菜单中的Visual Studio Tools文件夹中)。 将目录更改为项目。 输入命令“sqlmetal /map:whatever.map / code yourli ...
-
staticboy, 使用Linq to SQL和Linq to XML结合使用。 首先从数据上下文获取XML列。 假设您已为LINQ to XML添加了.dbml文件。 //Lets say you have database called TestDB which has your ContentHistory table TestDBContext db = new TestDBContext(); //This will return as IQueryable. var result = d ...
-
我做了一些试验和错误,并将Linq-To-Sql代码更改为: from t in types let docs = context.documents.Where(d => (d.RKey == t.Id.ToString() && d.RType == (int)RType.Type && d.AType == (int)AType.Doc) ...
-
Linq-to-SQL和性能(Linq-to-SQL and Performance)[2023-06-05]
前几天我回答了类似的问题。 这些是他们如何使其在Stack Overflow上运行良好的示例: http://www.codinghorror.com/blog/2009/06/all-abstractions-are-failed-abstractions.html 和 http://www.codinghorror.com/blog/2010/03/compiled-or-bust.html I replied to a similar question about this the other day ...