Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
Im working on a program. But instead of using tons of background workers and threads to update the UI, could I use XNA instead? It's an application, so it will not be deployed to te XBox.
I understand the limitation of not using WinForms and WPF controls, but that won't be a problem as I can quickly write the only control I need, a slider.
Your question was a little unclear, but hopefully this can answer it:
Yes, you can definitely use XNA. It's a bit annoying to do it without a Game class because loading in graphical assets using XNA's Content system requires knowing about the Graphics device (this is all hidden under the implementation of Game). Basically you have to implement your own IServiceProvider (pretty much just a dictionary of Types to Objects) which XNA's content system will use to get the IGraphicsDeviceService, which you also have to implement on whatever object manages your graphics (lets call it GrahpicsManager, real original :P). On the GraphicsManager, you simply create a PresentationParameters object, fill in all the parameters you want to set (including your window or control handle and size), and then use it to create a GraphicsDevice. Note that the IGraphicsDeviceService interface requires you to invoke a few events (such as when you finish creating the graphics device, or when the device is lost, etc).
Here's my own implementation of IServiceProvider (you basically just instantiate a single one of those and share it everywhere):
http://pastebin.com/1gX7v5b4
Make sure to add your IGraphicsDeviceService to that service provider once you create it. I also whittled down my implementation of the graphics service so that you could check it out. Note that you would need to add your own Draw method that actually uses the GraphicsDevice, and calls GraphicsDevice.Present at the end.
http://pastebin.com/wBvDiWBu
See line 36 for where I add myself to the service container, and line 73 for where I setup the graphics device (note that the setup takes an IntPtr for the window handle that it will draw to).
You could also actually make the app using the Game, but its pretty annoying because Game takes over your main loop (generally that means you have to be responsible for pushing the windows message pump yourself inside of Update, I've tried it, it sucks).
Anyways, hope that answers your question!
While Xna if primaraly used for gaming, I belive you could use it for an application, If you really want lots of graphics and other stuff you would find in a game. I havent tried out too much with audio,but I belive there are some ways to "mix" it for your dj app. Experiment around with it and see if its up to your expectations. You can also use Neoforce Controls (http://neoforce.codeplex.com/) to create other controls easily if you ever need anything more than a slider.
For a DJ application I wouldn't recommend using XNA. It's audio support is pretty limited and it presents problems when trying to play tracks backward and such. Also, loading assets (audio files) can take some time if not properly preloaded, which I figure would be complex for a decent DJ library.
You'd probably have to use a background library for the audio management and playing, but I'm not sure how easy that would be. I also think that loading and playing external audio files could be a challenge, given the limitations XNA imposes when accessing the audio subsystems.
Related
For games like DOTA 2 which can be run with different graphics API's such as DX9, DX11, Vulkan, I have not been able to come up with a viable solution to checking which of the API's its currently using. I want to do this to correctly inject a dll in order to display images over the game.
I have looked into manually checking what dll's the games have loaded,
this tool for example: https://learn.microsoft.com/en-us/sysinternals/downloads/listdlls
however, in the case of DOTA, it loads in both d3d9.dll and d3d11.dll libraries if none is specified in launch options on steam. Anyone have any other ideas as to how to determine the correct graphics API used?
In Vulkan, a clean way would be to implement a Vulkan Layer doing the overlay. It is slightly cleaner than outright injecting dlls. And it could work on multiple platforms.
In DirectX, screencap software typically does this. Some software adds FPS counter and such overlays. There seems to be open source with similar goals e.g. here: https://github.com/GPUOpen-Tools/OCAT. I believe conventionally the method is to intercept (i.e. "hook" in win32 api terminology) all the appropriate API calls.
As for simple detection, if it calls D3D12CreateDevice then it likely is Direct3D 12. But then again the app could create devices for all the APIs too and proceed not to use them. But I think the API detection is not particularly important for you if you only want to make an overlay; as long as you just intercept all the present calls and draw your stuff on top of it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to create an interactive map in iOS.
I have to do a thing like Expo app.
An image or a map view in background and draw the way between 3-4 points.
I don't know if use Google Maps, Apple Maps, images or something else.
Developing a spatially aware application is no trivial matter on any platform. It will require careful planning and architecture design UP FRONT or you'll find yourself doing a lot of "extreme programming" (tons of refactoring). In order to develop a spatially aware application you will need several items:
A familiarity with a map API. Apple's MapKit API is fine, but there are others such as Mapbox which offer additional services such as
offline caching, custom basemaps, etc.
A custom basemap: The basemap you're seeing here is certainly a custom job and probably not open source, so you'll need to come up
with one of your own. Unfortunately, every map API has a different
approach to this so you'll need to do some research to determine the
right solution for your API.
Map features: You'll need to understand how to add features to your map. Some APIs call these Annotations, while others simply call
them Features (like ESRI). In either case, you will need to generate
your own feature geometry using the Core Location API and whatever components the map API utilizes. You will also need to create custom graphics for these annotations,
unless you can find something suitable in the public domain. If you
intend to add polylines (for directions) or polygons (to highlight an
area) you will also need to define your own custom symbology (line
color, width, fill colors, etc). Again, not every API uses the term
symbology to describe these details but hopefully you get the idea.
Data storage: You'll need to decide how you're going to store and retrieve data for the mapview. You can store everything online in a
custom web service. You could also use something like the Parse API
if you don't have the resources for your own web service.
Alternatively, you could store everything locally in a SQLite
database or using Core Data. In either case, you will need to have a
plan for querying the location data in an efficient manner. SQLite
supports R*Tree indices which are a good way to store a geometry's
bounding box (envelope) information, but you still need to roll your own INSERT and SELECT queries. Most likely you'll need to come up with some combination of the two.
Learn the language: Overall, you absolutely must learn the language of the map APIs. Its vital that you are familiar with the
language of spatially aware applications, including the fundamentals
of location technology, if you intend to be successful in this
project. I would suggest beginning to do some research into the iOS
MapKit API, and maybe an open source solution like Mapbox. Learning geoJSON isn't a bad idea even if you don't intend to use it in your app. It is very simple and could help you learn a lot about spatial technology very quickly.
As you can see, there's a LOT going on in a spatially aware application, and this list is just a starting point. I am not trying to dissuade you from your goal, but just be aware that this isn't a "drag and drop" sort of project.
I am beginner trying to learn C# and XNA. I am trying to get a deeper understanding of the XNA game loop.
Although there are plenty of articles explaining what the game loop is, I can't seem to find the actual loop implementation anywhere.
The closest I think I have gone to finding the loop is this member of the game class in the MSDN documentation:
public void Tick ()
If this is the correct one, where can I find the inner implementation of this method to see how it calls the Update and Draw methods, or is that not possible?
Monogame is an open source replica of XNA based on modern rendering pipelines, and SharpDX.Toolkit implements a very XNA-Like interface for DX11 (Monogame actually uses SharpDX under the hood for DirectX integration)... you can probably find the game loop in the source code from either of those projects and it will likely be be close to if not identical to what MS XNA actually uses.
That being said, the game loop actually doesn't do much for simple demo applications (they tend to pile up everything in a single method to update/render a simple scene), though in full games with component based scene graphs it can get a little complicated. For single threaded engines, the general idea is to:
1. update the state of any inputs,
2. process any physics simulation if needed,
3. call update on all the updatable objects in
your scene graph (the engine I'm working on
uses interfaces to avoid making wasteful calls
on empty stub methods),
4. clear the working viewport/depth buffers,
5. call render on each renderable object to actually
get the GPU drawing on the back buffer.
6. swap the render buffers putting everything just
drawn to the back buffer up on screen, and making
the old viewport buffer the new back buffer to be
cleared and drawn on the next rendering pass.
7. start over at step 1 :)
That pretty much covers the basics and should generally apply no matter what underlying API or engine you are working with.
Since XNA is closed-sourced, it is not possible to see the code for the game loop, as defined in the Game class. The Tick() you have referenced is not exposed nor referenced in any XNA documentation(Although, it may be used behind the scenes, I do not know).
As #Ascendion has pointed out, MonoGame has an equivalent class named Game see here. While, this may not reflect the XNA code exactly, it is the best compatible source (all tests performed between the two, they return the same values), that we the public, have available.
The main side effect to the MonoGame implementation is the platform independent code, which may be hard to comprehend, since some of the implementation code is located in additional files. It is not hard to trace the sources back to the expected platform source code.
This post is to serve as a clarification to all who may stumble upon this later.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
What are the HCI challenges of Web 2.0?
Here are a few more:
Clear privacy options
Facebook has repeatedly changed the way it deals with content ownership and privacy. (See here, here and here.) Aside from the obvious PR gaffes, this has also demonstrated the difficulty users have understanding privacy.
Geeks like us are familiar with ideas of inheritance and groups. Heck, many of us work explicitly with permission structures when dealing with files on *nix systems. To most users though, it's not clear who can see what or why.
Service Interoperability
On the desktop we're used to being able to chain together tools to get the outcome we want. A simple example would be dragging image thumbnails from a file explorer to an image editor. We'd expect that to work, but not on the web
The Flock browser goes some way to overcome this shortfall, as does the Google Docs web clipboard, but interaction between web services is still a long way off what we expect from the desktop.
Accessibility
Web 1.0 was primarily text based, so the main accessibility issues were easy to fix: stuff like text as images and tables for layout, which both affect screen-readers used by the blind.
As the content of the web gets richer (more images, video and audio), the chances get larger that someone will be excluded from it. Moreover, making video and audio accessible is much harder than making text or images accessible, so it's much less likely to be done.
Lastly, Web 2.0 introduced a whole new problem for accessibility: dynamic content. How should screen-readers (for example) deal with new content appearing on a page after an AJAX query? WAI-ARIA aims to address these issues, but they still require the web-designer to implement them.
Hope this was useful.
There are plenty as I see it,
Different screen resolutions.
Different hardware capabilities. (mobile; touch; desktop; laptop; soon orientation too.)
Localized content.
Location based.
With HTML5 upcoming, hardware acceleration; native api's; localstorage; offline.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
A coworker has been using a custom AVI to indicate progress during some longer operations for years. It's always worked fine.
Recently he decided to move from Delphi 7 to Delphi 2007, in part to get theme support for his applications. (We've finally got most people, but not all, running on XP.) The animation stopped working. Disabling themes makes it work again.
TAnimate is a wrapper around the Windows Animation Control, created using InitCommonControlsEx(ICC_ANIMATE_CLASS). The MSDN documentation says that "If you are using ComCtl32.dll version 6 the thread is not supported, therefore make sure that your application does not block the UI or the animation will not occur." Obviously, this is the intended behavior.
Does anyone have a suggestion for a workaround or alternative to this problem? The processing he's trying to show progress for doesn't lend itself well to spawning a separate thread, and for obvious reasons Application.ProcessMessages is not a good solution either.
EDIT: I'm awarding Rob Kennedy the correct answer to this question, because a) he provided the "missing link" (pun intended) to Raymond Chen's blog post on this topic, and b) because of course moving things to a separate thread was the proper answer.
The ironic thing here: The operation he was conducting that blocked the TAnimate was an indexing operation for a database engine we use (Advantage Database Server, or ADS). He didn't mention that when he came to me with the problem.
ADS supports a progress callback using the TAdsDataSet.AdsRegisterCallbackFunction and TAdsDataSet.AdsClearCallbackFunction methods. The callback function is provided both the progress (in percent) of the current operation and a way to cancel the operation by means of the function's return value. So the entire question turns out to be moot; the callback function can be used to update a progress bar, which indicates to the user that the app isn't hung.
Raymond Chen has written about this. He doesn't even touch on what I usually think of as the primary reason that a threaded control wouldn't work well, which is that a thread shouldn't draw on a window associated with a different thread.
I encourage your co-worker to revisit whatever it was that made him decide that he couldn't put the task into a separate thread. It's simply not a good idea to block the main UI thread, regardless of whether there's an animation control there to cover up the non-responsiveness.
As an alternative to TThreads, you can use AsyncCalls which provides an easier entry point into multi-threaded processing from a functional viewpoint. Still, the best way to handle this would be to perform the long process in the background to keep the application responsive.