|
Regex is your friend.
/ravi
|
|
|
|
|
Substring, Regex, IndexOf.
|
|
|
|
|
I want a really nice simple way to grab textures from folders so that I don't have to read there data in all the time in XNA.
The idea will be to load all the textures in my content folder and its sub folders (such as Content\Sprites) so that at run time I could use something such as :
mytexture = Texture.GetTexture("Sprites","myspritefile");
The problem is that I am not sure if this "global" method of grabbing files is recommended?
|
|
|
|
|
|
Thanks 
|
|
|
|
|
Good question. I am currently working on a graphics engine under XNA and also would prefer to load graphics resources from folders. Otherwise the graphics resources will fill a very fat library.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
.. O.k., So there are a couple of potential issues here...
First remember your memory limitations, so sure you can do it as long as your supported hardware can accommodate it. but there is really no good reason to waste all that memory...
You may want to look into sprite maps...
There really isn't a need to run mytexture = Texture.GetTexture("Sprites","myspritefile"); to load ALL content.. remember that it is compiled in the content pipeline, and put into hard disk location (by basically a reference value).. so at any time during Update , you use:mytexture = Texture.GetTexture( "Sprites", "myspritefile"); anyways. the "preferred" method would be to load on a separate thread.
Alternatively, (try an in game load, you probably don't even need a separate thread to do this....) Unless your loading A LOT of LARGE content at once and you need it to be snappy, in which case load all the content for that "cycle" of the game... I.e: Loading screen, main menu, pause menu, game tiles/sprites, Death Screen, Victory screen,... such that when you complete a level, or one unit of game play, you may hit a loading screen(underlined) or animation etc... that displays in the approximate amount of time it takes to swap out the particular level game tiles/sprites... you can even load the victory and death scenes while the game is in 'play' mode to save the user the headache of waiting for *all* the images to be loaded...
I would say experiment with loading content at different times until you get a combination of Content loading locations in your code, which will allow the UI to be responsive and minimize load times... remember that when you want to sell it you will be "graded" on how responsive the UI is and how long it takes to load (the trial level/scenario)... So if your game is mature enough I would optimize to trial mode, and then tweak to normal mode (if need be)..
I'd blame it on the Brain farts.. But let's be honest, it really is more like a Methane factory between my ears some days then it is anything else...
|
|
|
|
|
guys i need to create a small application for turning on my computer at a given time.
lets say now it is 8.00Pm and i need to turn on my computer when the system time is equal to 10.00 Pm ..
so can any body help me to develop this program!
|
|
|
|
|
If there's no power, then you can only switch it on if you write a program to control a robot hand to switch it on.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
...and hope the robot hand has power available to it too. 
|
|
|
|
|
Only a few little problems here.
1) When the power is off, the processor is not running. This means that your program is not running either.
2) See 1.
You will need external hardware - wake on LAN, external mains on switch, or similar. You can't do it with software, sorry.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
If your computer isn't running, you can't run a program on it.
You can put it to sleep and have a windows service running that will wake it up at a certain time, but that's the best you can do.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Is your computer on the network? Does your motherboard support Wake-On-LAN? if so, you can send magic packet to wake your computer up. Once it is up, it is not hard to shut-it down. see here[^]
|
|
|
|
|
Virtually all PCs today in their BIOS should have an option, typically in the power management settings, for setting a "Power On Alarm", or something of that sort. If there is a way to set this programmatically within an application, I don't know of it.
|
|
|
|
|
As Kenneth stated, if you get into your system BIOS at bootup, normally by pressing or holding down a function key during POST, you should find Power Management or Auto Power On settings.
Once enabled, you should also be able to select a time for everyday, or weekdays only.
Obviously, these features depend on your BIOS version.
This works on my Dell Optiplex 960 as well as my optiplex GX270 (2003 model).
|
|
|
|
|
..or a relay, a free rs232-port on a spare computer (the observer), some solder and some patience
I are Troll
|
|
|
|
|
You win. It is past 10 o'clock and nobody offered a real solution.
|
|
|
|
|
Buy a mechanical timer and set the BIOS to start up the computer after a power outage. The timer turns on the power to the computer and the BIOS causes it to boot up.
|
|
|
|
|
Enable Wake-On-LAN in your system's hardware config - then do this[^].
/ravi
|
|
|
|
|
Hi,
If you are happy to leave the computer in standby mode then a WaitableTimer can be used to wake it up. There's some example code here on CP A WaitableTimer wrapper class[^].
The simplest way to wake up a sleeping computer, without any programming, is to set a scheduled task with the option "Wake the computer to run this task".
Alan.
|
|
|
|
|
Check your machine's BIOS settings for a timed automatic power on option.
|
|
|
|
|
My Vista laptop surprised me by turning itself on at various "exact" times, until I figured out what was happening. If you go into 'Scheduled Tasks', you can set up a task with various options about power state and action. I've got no idea how to do this programmatically, but you could configure a scheduled task to run your job. The reason I mention Vista is that I don't remember being able to do this in XP. But I might be completely wrong...
[edit]somehow missed Alan N's post before writing this. What he said...[/edit]
Software rusts. Simon Stephenson, ca 1994.
modified on Monday, August 23, 2010 8:02 PM
|
|
|
|
|
Something like this[^]?
Again, look at the BIOS setting of the computer to be sure it will boot when power is detected.
|
|
|
|
|
Do you have another networked computer (anywhere) that can run the application? If so, run the wake-up application on the other computer and then buy an APC remote power switch with Internet connectivity. We use one on our server at a server farm so we can turn it on, turn it off or reboot it remotely if it hangs.
Dave
|
|
|
|
|
There must be some kind of either windows or BIOS API to control power on/off, at least for ATX motherboard based machines - here is a product that uses it (and I have a AV program that will wake the machine up if it happens to be off when it want's to update - nasty if it's a laptop in it's case though!)
http://www.lifsoft.com/[^]
Mike
|
|
|
|