Search Results

Search found 12934 results on 518 pages for 'magic methods'.

Page 139/518 | < Previous Page | 135 136 137 138 139 140 141 142 143 144 145 146  | Next Page >

  • Questions about game states

    - by MrPlow
    I'm trying to make a framework for a game I've wanted to do for quite a while. The first thing that I decided to implement was a state system for game states. When my "original" idea of having a doubly linked list of game states failed I found This blog and liked the idea of a stack based game state manager. However there were a few things I found weird: Instead of RAII two class methods are used to initialize and destroy the state Every game state class is a singleton(and singletons are bad aren't they?) Every GameState object is static So I took the idea and altered a few things and got this: GameState.h class GameState { private: bool m_paused; protected: StateManager& m_manager; public: GameState(StateManager& manager) : m_manager(manager), m_paused(false){} virtual ~GameState() {} virtual void update() = 0; virtual void draw() = 0; virtual void handleEvents() = 0; void pause() { m_paused = true; } void resume() { m_paused = false; } void changeState(std::unique_ptr<GameState> state) { m_manager.changeState(std::move(state)); } }; StateManager.h class GameState; class StateManager { private: std::vector< std::unique_ptr<GameState> > m_gameStates; public: StateManager(); void changeState(std::unique_ptr<GameState> state); void StateManager::pushState(std::unique_ptr<GameState> state); void popState(); void update(); void draw(); void handleEvents(); }; StateManager.cpp StateManager::StateManager() {} void StateManager::changeState( std::unique_ptr<GameState> state ) { if(!m_gameStates.empty()) { m_gameStates.pop_back(); } m_gameStates.push_back( std::move(state) ); } void StateManager::pushState(std::unique_ptr<GameState> state) { if(!m_gameStates.empty()) { m_gameStates.back()->pause(); } m_gameStates.push_back( std::move(state) ); } void StateManager::popState() { if(!m_gameStates.empty()) m_gameStates.pop_back(); } void StateManager::update() { if(!m_gameStates.empty()) m_gameStates.back()->update(); } void StateManager::draw() { if(!m_gameStates.empty()) m_gameStates.back()->draw(); } void StateManager::handleEvents() { if(!m_gameStates.empty()) m_gameStates.back()->handleEvents(); } And it's used like this: main.cpp StateManager states; states.changeState( std::unique_ptr<GameState>(new GameStateIntro(states)) ); while(gamewindow::gameWindow.isOpen()) { states.handleEvents(); states.update(); states.draw(); } Constructors/Destructors are used to create/destroy states instead of specialized class methods, state objects are no longer static but

    Read the article

  • Installing old Loki games on 12.04 64-bit results in no audio

    - by FlabbergastedPickle
    All, Here's an interesting problem. I followed instructions provided online for installing Loki Games' Heroes of Might and Magic 3 (see http://www.swanson.ukfsn.org/loki/ and http://wtanaka.com/node/7641) and got it installed and patched to the latest version. However, every time I start it regardless whether the pulseaudio is running, I get the following error: LD_LIBRARY_PATH=/usr/local/lib/Loki_Compat/ /usr/local/lib/Loki_Compat/ld-linux.so.2 /usr/local/games/Heroes3/heroes3.dynamic ALSA lib conf.c:3314:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default Couldn't open audio: My first soundcard is HDMI output and my second one is the actual soundcard (HP DM1 running 12.04 64-bit with latest updates). I did set up /etc/asound.conf as follows: asound.conf pcm.!default { type hw card 1 } ctl.!default { type hw card 1 } So, the default soundcard should work ok. Between Shadowgrounds that also stopped working and this it appears a there may be some unfinished business/regressions in 32-bit support on 64-bit systems in 12.04. Any thoughts?

    Read the article

  • what's the point of method overloading?

    - by David
    I am following a textbook in which I have just come across method overloading. It briefly described method overloading as: when the same method name is used with different parameters its called method overloading. From what I've learned so far in OOP is that if I want different behaviors from an object via methods, I should use different method names that best indicate the behavior, so why should I bother with method overloading in the first place?

    Read the article

  • Recent uploaded slides for the Upgrade Talks last week

    - by Mike Dietrich
    Welcome 2011 :-) And here you'll find the newest talks Carol, Roy and Brian delivered last week in several cities (please find the also in the DOWNLOAD SLIDES section on the right side of this blog): Upgrade Methods and Upgrade Planning: Click here to Download and use the keyword: roy2011 +500 Slides Upgrade Workshop Presentation: Click here to Download and use the keyword (Schlüsselwort): upgrade112 Hope you had a nice weekend and wonderful weather, too, as we had yesterday south of Munich. Click pic for a higher resolution: Starnberg Lake - View towards the Alps

    Read the article

  • [Silverlight] How to choose the webcam resolution

    - by Benjamin Roux
    Hello, Today I’m gonna show you how to choose the webcam resolution when using Silverlight. By default most of them are in 640x480 which can be sometimes insufficient. VideoCaptureDevice source = devices.SelectedItem as VideoCaptureDevice; source.DesiredFormat = new VideoFormat(PixelFormatType.Unknown, 4096, 4096, 30); The magic thing with this line, is that the camera will choose the best resolution available (and not absolutely 4096x4096). You can also get all the supported formats using the SupportedFormats property. Hope this help.

    Read the article

  • Why do I get a "the location is not a folder" error when trying to open files using Dash or Synapse?

    - by Christian Howd
    Within the last few days, I've encountered errors when trying to open files using Unity Dash, Synapse, or even the Gnome Search Tool. These methods will let me launch applications and folders, but not files of any time, including mp3, doc, odt, and txt. With any method, the same error dialogue results: "the location is not a folder". Is there something I can do on my end to correct this, or is this a bug in Natty that is still being corrected?

    Read the article

  • Is it possible to calculate or mathematically prove if a game is balanced / fair?

    - by Lurca
    This question is not focussed on video games but games in general. I went to a boardgame trade fair yesterday and asked myself if there is a way to calculate the fairness of a game. Sure, some of them require a good portion of luck, but it might be possible to calculate if some character is overpowered. Especially in role-playing games and trading card games. How, for example, can the creators of "Magic: The Gathering" make sure that there isn't the "one card that beats them all", given the impressive number of available cards?

    Read the article

  • New White Paper about Upgrade to Oracle Database 12c

    - by Mike Dietrich
    With the release of Oracle Database 12c many new collateral will be available right now including our new White Paper: White Paper:Upgrading to Oracle Database 12c This white paper outlines the methods available for you to upgrade and migrate your database to Oracle Database 12c.  Learn about different use cases and key factors to consider when choosing the method that best fits your requirements. And if you'd like to have a look into the new Oracle 12c documentation please find it here: Oracle Database 12c Documentation -Mike

    Read the article

  • API Design Techniques

    - by Dehumanizer
    Is it right or more beautiful to name the functions with an prefix, like in Qt? Or using "many" namespaces, but 'normal' names for functions? For example, slOpenFile(); //"sl" means "some lib" vs some_lib::file_functions::openFile(); UPD: I've read somewhere that the first variant(using some prefix) is better, because the API users can perform 'fast' search among the documentation and in the Internet. E.g. by typing the magic prefix search engine starts to advice the exact functions. Is it enough to use the first variant?

    Read the article

  • Ever wonder why Earth spins?

    - by Gopinath
    Have you ever wonder why Earth spins on its axis and completes a revolution every day? Is there any force that keeps Earth spinning? Is that because of  Gravity or any Magnetic force? Check out this video to learn why Earth spins and the basics of physics behind the magic If you find that above video is in simple English and it’s not convincing physicist inside you, lets hear from a NASA scientist in the embedded video. A NASA scientist explains how Earth rotation has started, how fast it was billions of years ago and what caused it to slow down to 24 hours to complete a revolution   Thanks @pinaldev

    Read the article

  • SEO And Its Techniques

    There are many methods used in Internet marketing it today';s current trends and one of those is SEO or search engine optimization. According to many experts, SEO has become a very popular and in-dema... [Author: Margarette Mcbride - Web Design and Development - June 10, 2010]

    Read the article

  • How to draw texture to screen in Unity?

    - by user1306322
    I'm looking for a way to draw textures to screen in Unity in a similar fashion to XNA's SpriteBatch.Draw method. Ideally, I'd like to write a few helper methods to make all my XNA code work in Unity. This is the first issue I've faced on this seemingly long journey. I guess I could just use quads, but I'm not so sure it's the least expensive way performance-wise. I could do that stuff in XNA anyway, but they made SpriteBatch not without a reason, I believe.

    Read the article

  • How do I grok NHibernate's QueryOver API?

    - by Brant Bobby
    I've run into the limits of what NHibernate 3.0's LINQ provider is capable of and decided it's time to learn about one of the more powerful (or at least feature-complete) options: the QueryOver API. The problem is, I have zero experience with ICriteria, and all of the tutorials I've been able to find online either: Assume I'm an ICriteria expert and simply show me how to convert ICriteria code to the new fluent interface, or Are trivial "here's how you do an inner join" examples that don't really help me understand more complex concepts like projections, subqueries, requirements, or whatever other magic the API is capable of. What should I read to really learn about QueryOver, and how to make full use of it?

    Read the article

  • Enchanted Swing in the Forest Wallpaper

    - by Asian Angel
    Magic [DesktopNexus] Latest Features How-To Geek ETC How To Make Hundreds of Complex Photo Edits in Seconds With Photoshop Actions How to Enable User-Specific Wireless Networks in Windows 7 How to Use Google Chrome as Your Default PDF Reader (the Easy Way) How To Remove People and Objects From Photographs In Photoshop Ask How-To Geek: How Can I Monitor My Bandwidth Usage? Internet Explorer 9 RC Now Available: Here’s the Most Interesting New Stuff Never Call Me at Work [Humorous Star Wars Video] Add an Image Properties Listing to the Context Menu in Chrome and Iron Add an Easy to View Notification Badge to Tabs in Firefox SpellBook Parks Bookmarklets in Chrome’s Context Menu Drag2Up Brings Multi-Source Drag and Drop Uploading to Firefox Enchanted Swing in the Forest Wallpaper

    Read the article

  • .NET Reflector

    - by kaleidoscope
    Explore and analyze compiled .NET assemblies, viewing them in C#, Visual Basic, and IL. Feature list Full support for .NET 1.0, 1.1, 2.0, 3.0, 3.5, and 4.0 Decompiles any .NET assembly to C#, VB.NET, and IL Find usages of classes and methods, including virtual method overrides Technorati Tags: Ram .Net Reflector

    Read the article

  • Easiest turn-base games you can think of?

    - by Edgar Miranda
    I'm planning to get into the process of programming multiplayer turn-base games. I would like to start off by making some of the simplest (yet fun) multiplayer turn-base games out there. What are some that you can provide? For example... Tic-Tac-Toe Rock-Paper-Scissors Checkers Some not so easy games... 4 in a row chess poker In terms of "ease" of implementation I'm mainly looking at logic. For example, Rock-Paper-Scissors has very simple logic, while chess has logic that is more complicated. So far I have the following: Hexagon Heroes of Might and Magic Nine Men's Morris Connect 4 21 (card game) Pen the Pig (The Dot game) Memory Match

    Read the article

  • Windows XP self-installing virus [closed]

    - by Oliver
    Do you remember. Some years ago, there was a huge virus attacking Windows XP in its first version. Once you had installed Windows XP, and on your first internet access, the virus installed itself on your computer, closing your internet connection and making the computer reboot after some seconds. I wonder... How can a virus install itslef this way from nowhere ? Without any user action. You install Windows XP... the computer just connects itself to the internet (assuming Microsoft don't connect to bad sites on its first connection)... and you have a virus. There is something magic I don't understand here. Can someone explain me how that virus could attack Windows that way, without any user action on a fresh installed system...

    Read the article

  • I'd like to switch from 32-bit to 64-bit within same version

    - by Marty Fried
    I have a 32-bit installation of 11.10 on my 64-bit (4 GB) home AMD system. I have recently read up a bit on 64-bit version, and it seems that it would be a marginally better choice now for me. I have read about several methods to help reinstall all the various apps, using either dpkg's get-selections/set-selections and dselect in various ways, or using synaptic's save/get markings. The problem here is that I've read several variations, and I'm not sure which is best. I have enough disk space to do this with a brand new partition, so I'm not too worried about destroying anything, but I don't really want to make it my life's work, hence my appeal for expert tips. Since it's the same version, would it be safe to copy configuration files from the 32-bit system? I'd guess my home directory and /etc might be enough, and would save at least most of the time to reconfigure. But are there difference in configuration files in either of these directories for 32 vs 64 bits that might cause problems? After reinstalling to 64-bit, I can then continue along the 64 bit path for upgrades, but I thought it would be easier to switch the same version, than to try to reinstall apps and upgrade at the same time. Some methods I've seen suggested, among others: A. From Ubuntu forums On your old system (assuming it is still working), start up Synaptic and go: File->Save Markings and choose a file name along with a location (like a USB drive) that you can use when you have installed your new system). You need to check on the bottom: "Save full state, not only changes" This file contains a list of all your currently installed packages, and when you have installed and booted up your new system (and configured your repositories to the best for your location - as we all do, don't we?) then start up Synaptic and go: File-Read Markings and point it at your saved file, and after that has completed then select Apply to kick off the download & installation of all of those packages you had installed previously! B. From the same discussion: According to section 6.4.9 of the Debian Reference Manual, the following will save both the list of packages installed and their debconf configuration: # dpkg --get-selections "*" >myselections # or use \* # debconf-get-selections > debconfsel.txt and the following will reinstall and reconfigure them: # dselect update # debconf-set-selections < debconfsel.txt # dpkg --set-selections <myselections # apt-get -u dselect-upgrade # or dselect install C. A variation on the above I've seen a lot, this from stackoverflow: dpkg --get-selections > package_list then on the new install: cat package_list | sudo dpkg --set-selections && sudo apt-get dselect-upgrade I don't really understand B, or why it's slightly different than many others.

    Read the article

  • Recommended Patches For R12.1.3 Procurement Contracts, Contract Terms Library or Repository Contracts

    - by Oracle_EBS
    If you are implementing or upgrading to R12.1.3 Procurement Contracts, Contract Terms Library or Repository Contracts, then please review the following note for a list of recommended patches to apply on top of 12.1.3: 1349213.1: Recommended Patches For R12.1.3 Procurement Contracts and Contracts Core. Note that currently the methods given in Note 1400757.1: How to Find E-Business Suite Recommended Patches may not give the same patch listing given in Note 1349213.1.

    Read the article

  • Xml Literals

    XML Literals allow you to use XML syntax in your code. Its easy to work with XML files this way, since you have that Tags in the code, but its also quicker to access information rather then the traditional methods....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Xml Literals

    XML Literals allow you to use XML syntax in your code. It’s easy to work with XML files this way, since you have that Tags in the code, but it’s also quicker to access information rather then the traditional methods.

    Read the article

  • Xubuntu 14.04 will not boot after preseed installation

    - by Christian
    I recently set up Xubuntu 14.04 installation using preseed, and ran into a couple of problems during boot time. At first, right after the installation completed during first boot the system complained about /tmp not being mounted and did not proceed any further. I was able to fix that problem by making an entry for /tmp in /etc/fstab like so: tmpfs /tmp tmpfs optional,nodev,nosuid 0 0 This worked for a while (and still does for workstations that are already running), but newly installed machines are broken. They do not complain like before, but take forever to boot (2h) and it seems the root partition is mounted read only and you cannot do anything useful with the system. Any ideas on what to do? You can find the presseed file here Thanks in advance Update: If I get it to boot once via some magic in rescue mode (like simply mounting the root partition read-write, then resume boot) it will work forever. While this is a workaround, it is no option to do this for every installation.

    Read the article

  • How to composite videos and make animations in Ubuntu?

    - by Naveen
    Well, I'm not talking about programs like NukeX, Cinelerra, Jahshaka because they aren't either free or feature rich. I have seen couple of cool videos done on Linux platform, most likely to be Ubuntu. How Linux is Built - Linux Foundation Ubuntu 12.10 Beta Overview - OMG! Ubuntu What is the magic application they are using to composit those videos..? Can upcoming LightWorks workout these effects...? Is there any Linux native OpenGL based application to deal with particles, just like Particle Illusion for Windows? Thanks!

    Read the article

  • Obtaining positional information in the IEnumerable Select extension method

    - by Kyle Burns
    This blog entry is intended to provide a narrow and brief look into a way to use the Select extension method that I had until recently overlooked. Every developer who is using IEnumerable extension methods to work with data has been exposed to the Select extension method, because it is a pretty critical piece of almost every query over a collection of objects.  The method is defined on type IEnumerable and takes as its argument a function that accepts an item from the collection and returns an object which will be an item within the returned collection.  This allows you to perform transformations on the source collection.  A somewhat contrived example would be the following code that transforms a collection of strings into a collection of anonymous objects: 1: var media = new[] {"book", "cd", "tape"}; 2: var transformed = media.Select( item => 3: { 4: Media = item 5: } ); This code transforms the array of strings into a collection of objects which each have a string property called Media. If every developer using the LINQ extension methods already knows this, why am I blogging about it?  I’m blogging about it because the method has another overload that I hadn’t seen before I needed it a few weeks back and I thought I would share a little about it with whoever happens upon my blog.  In the other overload, the function defined in the first overload as: 1: Func<TSource, TResult> is instead defined as: 1: Func<TSource, int, TResult>   The additional parameter is an integer representing the current element’s position in the enumerable sequence.  I used this information in what I thought was a pretty cool way to compare collections and I’ll probably blog about that sometime in the near future, but for now we’ll continue with the contrived example I’ve already started to keep things simple and show how this works.  The following code sample shows how the positional information could be used in an alternating color scenario.  I’m using a foreach loop because IEnumerable doesn’t have a ForEach extension, but many libraries do add the ForEach extension to IEnumerable so you can update the code if you’re using one of these libraries or have created your own. 1: var media = new[] {"book", "cd", "tape"}; 2: foreach (var result in media.Select( 3: (item, index) => 4: new { Item = item, Index = index })) 5: { 6: Console.ForegroundColor = result.Index % 2 == 0 7: ? ConsoleColor.Blue : ConsoleColor.Yellow; 8: Console.WriteLine(result.Item); 9: }

    Read the article

< Previous Page | 135 136 137 138 139 140 141 142 143 144 145 146  | Next Page >