libgdx视口适合不同的屏幕(libgdx viewport fit different screens)
我在不同屏幕上安装游戏时遇到问题。 我在舞台类中声明了视口宽度和高度。
public static final int VIEWPORT_WIDTH = 20; public static final int VIEWPORT_HEIGHT = 30;
我安装了相机
camera = new OrthographicCamera(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); camera.position.set(camera.viewportWidth/2, camera.viewportHeight/2, 0f);
我在桌面应用程序中将屏幕宽度和高度设置为此
public static final int APP_WIDTH = 800; public static final int APP_HEIGHT = 900;
在桌面上一切看起来很好,但在我的Android设备上,它看起来向上伸展。 我阅读了有关视口的文档但是如何使用这些变量在这里实现呢? 我知道有类似的问题,但我想知道可以使用这些特定变量来实现视口,这样我可能会更好地理解它。
I'm having a problem with fitting my game on different screens. I declared a viewport width and height in my stage class.
public static final int VIEWPORT_WIDTH = 20; public static final int VIEWPORT_HEIGHT = 30;
And i set up the camera
camera = new OrthographicCamera(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); camera.position.set(camera.viewportWidth/2, camera.viewportHeight/2, 0f);
And i set the screen width and height in desktop app to this
public static final int APP_WIDTH = 800; public static final int APP_HEIGHT = 900;
On desktop everything looks fine but on my android device it looks stretched upwards. I read the documentation about viewports but how can I implement it here using these variables? I know similar questions have been asked but I would like to know viewports can be implemented using these specific variables, that way I might understand it better.
原文:https://stackoverflow.com/questions/43388088
最满意答案
ASB是关于消息。 您使用消息传递来部分系统/服务之间的通信。 RESTful服务可以通过将请求转换为消息来执行某些工作来利用ASB。 强调将意图转化为信息,指导需要进行的工作,而不是执行工作本身。
ASB或ASQ是您的选择。 这是您需要在各自提供的功能和功能之间进行选择的位置。 这里有一个很好的MSFT 比较文档 。
队列与主题/订阅 - 如果您需要将消息发送到单个目标(命令),则队列更简单。 如果需要将消息广播到多个接收者(事件),则主题/订阅是您的朋友。
ASB is about messaging. You use messaging for communication between parts of your system/services. RESTful services can leverage ASB by translating a request into a message to perform some work. Emphasis on converting the intent into a message, to instruct about work that needs to take place, not execute the work itself.
ASB or ASQ is your choice. This is where you need to choose between the features and capabilities each provides. There's a good MSFT comparison documentation on it.
Queues vs Topics/Subscriptions - if you need to send a message to a single destination (a command) then queue is simpler. In case a message needs to be broadcasted to multiple receivers (events), topics/subscriptions are your friends.
相关问答
更多-
为了在运行时查找控制器类,可以像这样编写一个程序集解析器。 public class MyAssembliesResolver : DefaultAssembliesResolver { public override ICollection
GetAssemblies() { List assemblies = new List (base.GetAssemblies()); // Add all ... -
首先,我认为创建自己的认证机制绝不是一个好主意。 回答您当前的问题: 1通常说来,您总是希望使用身份验证来保护您的Api,因为它是您访问数据的地方。 你的客户端(MVC App / Smartphone)应该授权自己访问你的Api。 2&3因为您使用的是REST API,我建议让您的Api无状态,换句话说,不要保留任何会话信息。 只需在您的令牌中包含您需要的角色数据。 您可以使用例如JSON Web令牌 。 4我总是使用授权头来发送授权数据。 在您的DelegatingHandler中(请注意Message ...
-
我们过去做过的一件事是创建一个端点“ http://webapi.com/twitter/200/name ”,然后执行包含更新值的put。 它并不完美,但它完成了工作并且很容易实现。 Think I found a solution with Newtonsoft JsonConvert.PopulateObject Populate Object
-
在过去十年中,物理分层被认为是一件好事。 N级很好。 这里的要点是每一层都应该提供一个真正的价值 。 仅仅为了分层的层是不好的。 所以历史上我们在做: DB =>提供数据 中间层=>提供服务(应用于数据的业务逻辑) ASP.NET网站(表示层)=>提供渲染视图 现在,通过SPA和新的支持js的富客户端, 可以在客户端上呈现视图 。 因此,服务的表示层现在是冗余的(尽管低端客户端可能仍然需要)。 我对典型的非BigData场景的建议是2个物理层 : DB =>提供数据 服务层=>提供服务 在服务层,我们将有3 ...
-
绝对没有什么能阻止您使用ASP.NET Web API的服务总线。 我正在实现这个(web api)我正在实现的项目,用户注册,我需要发送激活电子邮件。 从服务总线端点处理电子邮件发送,以便从web api立即返回注册。 我还在生产系统中实现了我的服务总线,尽管它是MVC 3(4个Web服务器)。 虽然任何服务总线应该可以解决问题(NServiceBus,MassTransit等),但您可能需要查看我的FOSS Shuttle ESB项目: http ://shuttle.codeplex.com/ The ...
-
ASP.net web api(ASP.net web api)[2022-11-25]
Web API提供了对HTTP交互的所有方面的更多访问。 它是在HTTP规范的基础上设计的。 如果您只是使用HTTP来通过防火墙,WCF就可以了。 如果您真的想使用HTTP作为应用程序协议,您会发现Web API更容易。 Web API provides far more access to all aspects of the HTTP interaction. It was designed from the ground up around the HTTP spec. WCF is fine if ... -
我正在考虑如何将它用于非基于http的客户端 好吧,它不能。 Web API仅适用于HTTP协议。 如果您需要使用其他传输协议(如UDP),则可以考虑使用WCF。 我们如何提供有关API的代理信息 RESTful服务没有代理信息的概念。 对于非.NET客户端,应该很好地记录它们。 对于.NET客户端,您可以在服务器和客户端应用程序之间共享合同(请求/响应Dto)。 然后,客户端应用程序可以重用那些可能充当您所谓的代理的 Dtos,这些内容存在于SOAP世界中但不存在于REST世界中。 Straight aw ...
-
将Azure Mobile Service与ASP.NET Web API连接(Connect Azure Mobile Service with ASP.NET Web API)[2022-08-09]
这绝对是可能的。 您可以使用Azure App Service Mobile Apps服务来运行您的服务。 这提供了与Azure移动服务相同的功能,但完全包含在ASP.NET Web App(或Node.js Web应用程序)中。 它只是ASP.NET应用程序之上的SDK。 有关此内容的更多信息,请参阅文档 。 This is definitely possible. You can use the Azure App Service Mobile Apps service to run your serv ... -
ASB是关于消息。 您使用消息传递来部分系统/服务之间的通信。 RESTful服务可以通过将请求转换为消息来执行某些工作来利用ASB。 强调将意图转化为信息,指导需要进行的工作,而不是执行工作本身。 ASB或ASQ是您的选择。 这是您需要在各自提供的功能和功能之间进行选择的位置。 这里有一个很好的MSFT 比较文档 。 队列与主题/订阅 - 如果您需要将消息发送到单个目标(命令),则队列更简单。 如果需要将消息广播到多个接收者(事件),则主题/订阅是您的朋友。 ASB is about messaging. ...
-
使用Ninject在ASP.NET网站上使用Rhino Service Bus(Use Rhino Service Bus on ASP.NET website with Ninject)[2021-12-27]
基本上,您必须首先将RhinoServiceBusFacility / AbstractRhinoServiceBusFacility重写为Ninject模块。 然后在其他文件中也有Castle引用,例如DefaultServiceBus引用了IKernel,应该更改为使用Ninject的内核。 Basically, you'd have to start by rewriting RhinoServiceBusFacility / AbstractRhinoServiceBusFacility as a ...