Search Results

Search found 2417 results on 97 pages for 'states'.

Page 11/97 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Saving an interface instance into a Bundle

    - by user22241
    All I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle. When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'. How would I go about saving my 'Scene' (into a Bundle)? Code import android.view.MotionEvent; public interface Scene{ void render(); void updateLogic(); boolean onTouchEvent(MotionEvent event); } I assume the interface is the relevant piece of code which is why I've posted that snippet. I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene') SceneManager.getInstance().setCurrentScene(options); //Current scene is optionscreen

    Read the article

  • A sample Memento pattern: Is it correct?

    - by TheSilverBullet
    Following this query on memento pattern, I have tried to put my understanding to test. Memento pattern stands for three things: Saving state of the "memento" object for its successful retrieval Saving carefully each valid "state" of the memento Encapsulating the saved states from the change inducer so that each state remains unaltered Have I achieved these three with my design? Problem This is a zero player game where the program is initialized with a particular set up of chess pawns - the knight and queen. Then program then needs to keep adding set of pawns or knights and queens so that each pawn is "safe" for the next one move of every other pawn. The condition is that either both pawns should be placed, or none of them should be placed. The chessboard with the most number of non conflicting knights and queens should be returned. Implementation I have 4 classes for this: protected ChessBoard (the Memento) private int [][] ChessBoard; public void ChessBoard(); protected void SetChessBoard(); protected void GetChessBoard(int); public Pawn This is not related to memento. It holds info about the pawns public enum PawnType: int { Empty = 0, Queen = 1, Knight = 2, } //This returns a value that shown if the pawn can be placed safely public bool IsSafeToAddPawn(PawnType); public CareTaker This corresponds to caretaker of memento This is a double dimentional integer array that keeps a track of all states. The reason for having 2D array is to keep track of how many states are stored and which state is currently active. An example: 0 -2 1 -1 2 0 - This is current state. With second index 0/ 3 1 - This state has been saved, but has been undone private int [][]State; private ChessBoard [] MChessBoard; //This gets the chessboard at the position requested and assigns it to originator public ChessBoard GetChessBoard(int); //This overwrites the chessboard at given position public void SetChessBoard(ChessBoard, int); private int [][]State; public PlayGame (This is the originator) private bool status; private ChessBoard oChessBoard; //This sets the state of chessboard at position specified public SetChessBoard(ChessBoard, int); //This gets the state of chessboard at position specified public ChessBoard GetChessBoard(int); //This function tries to place both the pawns and returns the status of this attempt public bool PlacePawns(Pawn);

    Read the article

  • OpenGL behaviour depending on the graphics card?

    - by Dan
    This is something that never happened to me before. I have an OpenGL code that uses GLSL shaders to texture a 3D model. The code involves a lot of GPU texture processing, blending, etc... I wanted to check how the performance of my code improves using a faster graphics card (both new and old are NVIDIA, using always the NVIDIA development drivers). But now I have found that once I run the code using the new graphics card, it behaves completely different (the final render looks wrong), probably because some blending effect is not performed correctly. I haven't really look into what has changed, but I am guessing that some OpenGL states are, by default, set different. Is this possible? Have you ever found different OpenGL/GLSL behaviour using different graphics cards? Any "fast" solution? (So far I've thought of plugging back the old one, push all OpenGL default states, and compare with the ones I initially get using the new card..)

    Read the article

  • How are components properly instantiated and used in XNA 4.0?

    - by Christopher Horenstein
    I am creating a simple input component to hold on to actions and key states, and a short history of the last ten or so states. The idea is that everything that is interested in input will ask this component for the latest input, and I am wondering where I should create it. I am also wondering how I should create components that are specific to my game objects - I envision them as variables, but then how do their Update/Draw methods get called? What I'm trying to ask is, what are the best practices for adding components to the proper collections? Right now I've added my input component in the main Game class that XNA creates when everything is first initialized, saying something along the lines of this.Components.Add(new InputComponent(this)), which looks a little odd to me, and I'd still want to hang onto that reference so I can ask it things. An answer to my input component's dilemma is great, but also I'm guessing there is a right way to do this in general in XNA.

    Read the article

  • Join Companies in Web and Telecoms by Adopting MySQL Cluster

    - by Antoinette O'Sullivan
    Join Web and Telecom companies who have adopted MySQL Cluster to facilitate application in the following areas: Web: High volume OLTP eCommerce User profile management Session management and caching Content management On-line gaming Telecoms: Subscriber databases (HLR/HSS) Service deliver platforms VAS: VoIP, IPTV and VoD Mobile content delivery Mobile payments LTE access To come up to speed on MySQL Cluster, take the 3-day MySQL Cluster training course. Events already on the schedule include:  Location  Date  Delivery Language  Berlin, Germany  16 December 2013  German  Munich, Germany  2 December 2013  German  Budapest, Hungary  4 December 2013  Hungarian  Madrid, Spain  9 December 2013  Spanish  Jakarta Barat, Indonesia  27 January 2014  English  Singapore  20 December 2013  English  Bangkok, Thailand  28 January 2014  English  San Francisco, CA, United States  28 May 2014  English  New York, NY, United States  17 December 2013  English For more information about this course or to request an additional event, go to the MySQL Curriculum Page (http://education.oracle.com/mysql).

    Read the article

  • Is a finite state machine an appropriate solution for this situation?

    - by user1936
    I was writing some test code as an example where I had a washing machine class. It has a door state that should be open or closed, and also a running state, either on or off. I want to prevent the running state from changing from 'off' to 'on' when the door is 'open', and also prevent the door from being set to 'open' while the machine is 'on'. I have this functionality rigged up with a bunch of if statements. It feels inelegant and it could quickly turn into spaghetti code if I want to add another state that puts additional conditions on the changes of other states. I wonder, is a finite state machine a solution for this situation? Would it simplify adding states and defining valid transitions?

    Read the article

  • EBS 11.5.10 Support Exception / 12.1 Extends to Dec 2018

    - by cwarticki
    E-Business Suite 11.5.10 Sustaining Support Exception & 12.1 Extended Support Now to Dec. 2018 [ID 1495337.1] As part of Oracle’s continued commitment to our customers, we will be providing an exception for the first 13 months of Sustaining Support on Oracle E-Business Suite Release 11.5.10 (11i10), valid from December 1, 2013 – December 31, 2014. This exception support will be comprised of three components: (1) new fixes for Severity 1 production issues, (2) United States Form 1099 2013 year-end updates, and (3) payroll regulatory updates for the United States, Canada, United Kingdom, and Australia for fiscal years ending in 2014.  In addition, the Extended Support period for E-Business Suite Release 12.1 has been extended through December, 2018. Customers with an active Oracle Premier Support for Software contract will automatically be entitled to Extended Support deliverables for E-Business Suite 12.1. Please refer to the Lifetime Support section of oracle.com for further information regarding Oracle's Lifetime Support Policy for Applications. This change will be reflected in the October update to the Software Technical Support Policies.

    Read the article

  • Modeling player mechanics with a finite state machine

    - by K..
    I have three states standing walking jumping When I press D standing transitions to walking. The velocity will be set to a defined value and the player moves. When I release D walking transitions back to standing, which sets the velocity back to 0. When I press W and the state is walking it transitions to jumping, but when the player hits the ground, it goes back to standing. jumping has a transition land that always leads to standing because a state doesn't know about its previous states. Since standing sets a velocity of 0 the player stops walking, when he hits the ground. How do I prevent this?

    Read the article

  • How should I structure my turn based engine to allow flexibility for players/AI and observation?

    - by Reefpirate
    I've just started making a Turn Based Strategy engine in GameMaker's GML language... And I was cruising along nicely until it came time to handle the turn cycle, and determining who is controlling what player, and also how to handle the camera and what is displayed on screen. Here's an outline of the main switch happening in my main game loop at the moment: switch (GameState) { case BEGIN_TURN: // Start of turn operations/routines break; case MID_TURN: switch (PControlledBy[Turn]) { case HUMAN: switch (MidTurnState) { case MT_SELECT: // No units selected, 'idle' UI state break; case MT_MOVE: // Unit selected and attempting to move break; case MT_ATTACK: break; } break; case COMPUTER: // AI ROUTINES GO HERE break; case OBSERVER: // OBSERVER ROUTINES GO HERE break; } break; case END_TURN: // End of turn routines/operations, and move Turn to next player break; } Now, I can see a couple of problems with this set-up already... But I don't have any idea how to go about making it 'right'. Turn is a global variable that stores which player's turn it is, and the BEGIN_TURN and END_TURN states make perfect sense to me... But the MID_TURN state is baffling me because of the things I want to happen here: If there are players controlled by humans, I want the AI to do it's thing on its turn here, but I want to be able to have the camera follow the AI as it makes moves in the human player's vision. If there are no human controlled player's, I'd like to be able to watch two or more AI's battle it out on the map with god-like 'observer' vision. So basically I'm wondering if there are any resources for how to structure a Turn Based Strategy engine? I've found lots of writing about pathfinding and AI, and those are all great... But when it comes to handling the turn structure and the game states I am having trouble finding any resources at all. How should the states be divided to allow flexibility between the players and the controllers (HUMAN, COMPUTER, OBSERVER)? Also, maybe if I'm on the right track I just need some reassurance before I lay down another few hundred lines of code...

    Read the article

  • Dealing with multiple animation state in one sprite sheet image using html5 canvas

    - by Sora
    I am recently creating a Game using html5 canvas .The player have multiple state it can walk jump kick and push and multiple other states my question is simple but after some deep research i couldn't find the best way to deal with those multiple states this is my jsfiddle : http://jsfiddle.net/Z7a5h/5/ i managed to do one animation but i started my code in a messy way ,can anyone show me a way to deal with multiple state animation for one sprite image or just give a useful link to follow and understand the concept of it please .I appreciate your help if (!this.IsWaiting) { this.IsWaiting = true; this.lastRenderTime = now; this.Pos = 1 + (this.Pos + 1) % 3; } else { if (now - this.lastRenderTime >= this.RenderRate) this.IsWaiting = false; }

    Read the article

  • IndexOutOfRangeException on World.Step after enabling/disabling a Farseer physics body?

    - by WilHall
    Earlier, I posted a question asking how to swap fixtures on the fly in a 2D side-scroller using Farseer Physics Engine. The ultimate goal being that the player's physical body changes when the player is in different states (I.e. standing, walking, jumping, etc). After reading this answer, I changed my approach to the following: Create a physical body for each state when the player is loaded Save those bodies and their corresponding states in parallel lists Swap those physical bodies out when the player state changes (which causes an exception, see below) The following is my function to change states and swap physical bodies: new protected void SetState(object nState) { //If mBody == null, the player is being loaded for the first time if (mBody == null) { mBody = mBodies[mStates.IndexOf(nState)]; mBody.Enabled = true; } else { //Get the body for the given state Body nBody = mBodies[mStates.IndexOf(nState)]; //Enable the new body nBody.Enabled = true; //Disable the current body mBody.Enabled = false; //Copy the current body's attributes to the new one nBody.SetTransform(mBody.Position, mBody.Rotation); nBody.LinearVelocity = mBody.LinearVelocity; nBody.AngularVelocity = mBody.AngularVelocity; mBody = nBody; } base.SetState(nState); } Using the above method causes an IndexOutOfRangeException when calling World.Step: mWorld.Step(Math.Min((float)nGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f))); I found that the problem is related to changing the .Enabled setting on a body. I tried the above function without setting .Enabled, and there was no error thrown. Turning on the debug views, I saw that the bodies were updating positions/rotations/etc properly when the state was changes, but since they were all enabled, they were just colliding wildly with each other. Does Enabling/Disabling a body remove it from the world's body list, which then causes the error because the list is shorter than expected? Update: For such a straightforward issue, I feel this question has not received enough attention. Has anyone else experienced this? Would anyone try a quick test case? I know this issue can be sidestepped - I.e. by not disabling a body during the simulation - but it seems strange that this issue would exist in the first place, especially when I see no mention of it in the documentation for farseer or box2d. I can't find any cases of the issue online where things are more or less kosher, like in my case. Any leads on this would be helpful.

    Read the article

  • N-tier Repository POCOs - Aggregates?

    - by Sam
    Assume the following simple POCOs, Country and State: public partial class Country { public Country() { States = new List<State>(); } public virtual int CountryId { get; set; } public virtual string Name { get; set; } public virtual string CountryCode { get; set; } public virtual ICollection<State> States { get; set; } } public partial class State { public virtual int StateId { get; set; } public virtual int CountryId { get; set; } public virtual Country Country { get; set; } public virtual string Name { get; set; } public virtual string Abbreviation { get; set; } } Now assume I have a simple respository that looks something like this: public partial class CountryRepository : IDisposable { protected internal IDatabase _db; public CountryRepository() { _db = new Database(System.Configuration.ConfigurationManager.AppSettings["DbConnName"]); } public IEnumerable<Country> GetAll() { return _db.Query<Country>("SELECT * FROM Countries ORDER BY Name", null); } public Country Get(object id) { return _db.SingleById(id); } public void Add(Country c) { _db.Insert(c); } /* ...And So On... */ } Typically in my UI I do not display all of the children (states), but I do display an aggregate count. So my country list view model might look like this: public partial class CountryListVM { [Key] public int CountryId { get; set; } public string Name { get; set; } public string CountryCode { get; set; } public int StateCount { get; set; } } When I'm using the underlying data provider (Entity Framework, NHibernate, PetaPoco, etc) directly in my UI layer, I can easily do something like this: IList<CountryListVM> list = db.Countries .OrderBy(c => c.Name) .Select(c => new CountryListVM() { CountryId = c.CountryId, Name = c.Name, CountryCode = c.CountryCode, StateCount = c.States.Count }) .ToList(); But when I'm using a repository or service pattern, I abstract away direct access to the data layer. It seems as though my options are to: Return the Country with a populated States collection, then map over in the UI layer. The downside to this approach is that I'm returning a lot more data than is actually needed. -or- Put all my view models into my Common dll library (as opposed to having them in the Models directory in my MVC app) and expand my repository to return specific view models instead of just the domain pocos. The downside to this approach is that I'm leaking UI specific stuff (MVC data validation annotations) into my previously clean POCOs. -or- Are there other options? How are you handling these types of things?

    Read the article

  • Drupal 7 Forms API Conditional Logic not working in IE

    - by Francis Yaconiello
    I have a drupal 7 form with a bunch of fields: $form['account_type'] = array( '#title' => t('Utility Account Type'), '#type' => 'select', '#options' => necp_enrollment_administration_portal_account_type_options(), '#required' => TRUE, '#default_value' => isset($form_state['values']['account_type']) ? $form_state['values']['account_type'] : '', ); // Should show if account_type = 1 $form['home_wrapper'] = array( '#type' => 'fieldset', '#states' => array( 'visible' => array( ':input[name="account_type"]' => array('value' => 1), ), ), ); $form['home_wrapper']['first_name_1'] = array( '#title' => t('Primary Account First Name'), '#type' => 'textfield', '#default_value' => isset($form_state['values']['first_name_1']) ? $form_state['values']['first_name_1'] : '', '#states' => array( 'required' => array( ':input[name="account_type"]' => array('value' => 1), ), ), ); $form['home_wrapper']['last_name_1'] = array( '#title' => t('Primary Account Last Name'), '#type' => 'textfield', '#default_value' => isset($form_state['values']['last_name_1']) ? $form_state['values']['last_name_1'] : '', '#states' => array( 'required' => array( ':input[name="account_type"]' => array('value' => 1), ), ), ); // Should show if account_type = 2 $form['business_wrapper'] = array( '#type' => 'fieldset', '#states' => array( 'visible' => array( ':input[name="account_type"]' => array('value' => 2), ), ), ); $form['business_wrapper']['company_name'] = array( '#title' => t('Company/Organization'), '#type' => 'textfield', '#default_value' => isset($form_state['values']['company_name']) ? $form_state['values']['company_name'] : '', '#states' => array( 'required' => array( ':input[name="account_type"]' => array('value' => 2), ), ), ); In Firefox/Chrome/Opera all versions this form behaves as it should. However in all versions of IE the form initializes with display:none; style on all of the conditional fields regardless of what the value in account_type is. Changing the selected option of account_type does not effect the hidden status. Any tips on debugging this form would be awesome. Notes: I am not much of a Drupal developer, I inherited this site. Just trying to iron out the last couple bugs so we can go live there are more fields than are listed above, I just gave you some of the applicable ones so that you could get the gist of how my forms were setup current url for the form in development: https://northeastcleanpower.com/enroll_new I'm using http://www.browserstack.com/ to debug IE 7 - 10pp4 (I think we only have to support 8 and up though) I've also tried: ':select[name="account_type"]' => array('value' => 1), '#edit-account-type' => array('value' => 1),

    Read the article

  • How to use XSLT to tag specific nodes with unique, sequential, increasing integer ids?

    - by ~otakuj462
    Hi, I'm trying to use XSLT to transform a document by tagging a group of XML nodes with integer ids, starting at 0, and increasing by one for each node in the group. The XML passed into the stylesheet should be echoed out, but augmented to include this extra information. Just to be clear about what I am talking about, here is how this transformation would be expressed using DOM: states = document.getElementsByTagName("state"); for( i = 0; i < states.length; i++){ states.stateNum = i; } This is very simple with DOM, but I'm having much more trouble doing this with XSLT. The current strategy I've devised has been to start with the identity transformation, then create a global variable which selects and stores all of the nodes that I wish to number. I then create a template that matches that kind of node. The idea, then, is that in the template, I would look up the matched node's position in the global variable nodelist, which would give me a unique number that I could then set as an attribute. The problem with this approach is that the position function can only be used with the context node, so something like the following is illegal: <template match="state"> <variable name="stateId" select="@id"/> <variable name="uniqueStateNum" select="$globalVariable[@id = $stateId]/position()"/> </template> The same is true for the following: <template match="state"> <variable name="stateId" select="@id" <variable name="stateNum" select="position($globalVariable[@id = $stateId])/"/> </template> In order to use position() to look up the position of an element in $globalVariable, the context node must be changed. I have found a solution, but it is highly suboptimal. Basically, in the template, I use for-each to iterate through the global variable. For-each changes the context node, so this allows me to use position() in the way I described. The problem is that this turns what would normally be an O(n) operation into an O(n^2) operation, where n is the length of the nodelist, as this require iterating through the whole list whenever the template is matched. I think that there must be a more elegant solution. Altogether, here is my current (slightly simplified) xslt stylesheet: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.w3.org/2005/07/scxml" xmlns="http://www.w3.org/2005/07/scxml" xmlns:c="http://msdl.cs.mcgill.ca/" version="1.0"> <xsl:output method="xml"/> <!-- we copy them, so that we can use their positions as identifiers --> <xsl:variable name="states" select="//s:state" /> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="s:state"> <xsl:variable name="stateId"> <xsl:value-of select="@id"/> </xsl:variable> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:for-each select="$states"> <xsl:if test="@id = $stateId"> <xsl:attribute name="stateNum" namespace="http://msdl.cs.mcgill.ca/"> <xsl:value-of select="position()"/> </xsl:attribute> </xsl:if> </xsl:for-each> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> I'd appreciate any advice anyone can offer. Thanks.

    Read the article

  • Best Practise/Subjective: Implement a finite state automaton in OOP

    - by poeschlorn
    Hi guys, I am thinking about implementing a programm with finite state automaton in an OOP language like Java or C++. What would you think is the best way to implement this with a manageable amount of available states, regarding to good software design? Is it good to implement for each state an own class? If yes, how to do the bridge between two states? Thanks for any comment!

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >