首页 \ 问答 \ Love2d光标位置(Love2d cursor positions)

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
更新时间:2023-05-19 10:05

最满意答案

我会说这取决于你的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 ...
  • 1.)有没有办法阻止Linq-to-SQL在使用DataReader的过程中完成一个非常大的查询的执行? 不完全的。 最终执行查询后,基础SQL语句将返回匹配记录的结果集。 查询将推迟到该点,但不会在遍历期间推迟。 对于您的示例,您可以简单地使用records.Take(3)但我知道您停止进程的实际逻辑可能是SQL的外部或不容易翻译。 您可以通过构建强类型LINQ查询然后使用旧式ADO.NET执行它来使用组合方法。 缺点是你失去了到类的映射,并且必须手动处理SqlDataReader结果。 这方面的一个例子 ...
  • 您可以尝试将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) ...
  • 前几天我回答了类似的问题。 这些是他们如何使其在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 ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。