public override void Update(GameTime gameTime, InputManager inputMan, WorldManager worldMan) { //title.pos.Y = 0.4f + ((float)Math.Sin(gameTime.TotalGameTime.TotalMilliseconds / 300.0) * 0.01f); if (inputMan.StartPressed()) exitmenu = true; if (inputMan.DownPressed()) cursorpos += 1; if (inputMan.UpPressed()) cursorpos -= 1; if (cursorpos > 3) cursorpos = 0; if (cursorpos < 0) cursorpos = 3; cursor.pos.Y = 0.50f + ((float)cursorpos) * 0.05f; cursor.pos.X = 0.35f + ((float)Math.Sin(gameTime.TotalGameTime.TotalMilliseconds / 100.0) * 0.005f); el_newgame.scale = 0.5f; el_options.scale = 0.5f; el_endgame.scale = 0.5f; el_quit.scale = 0.5f; if (cursorpos == 0) { el_newgame.scale = 0.6f; if (inputMan.EnterPressed()) { switching = true; nextPage = startGamePage; } } else if (cursorpos == 1) { el_options.scale = 0.6f; if (inputMan.EnterPressed()) { //switching = true; } } else if (cursorpos == 2) { el_endgame.scale = 0.6f; if (inputMan.EnterPressed()) { worldMan.LoadLevel("title"); nextPage = titleMenu; switching = true; } } else if (cursorpos == 3) { el_quit.scale = 0.6f; if (inputMan.EnterPressed()) { exit = true; } } }
public static void RunEditor(InputManager input) { //Debug.WriteLine("RunEditor running: " + editor_pose_loaded + " " + editor_part_selected + " " + editor_option_selected); if (!editor_active) return; //if a pose is selected, arrow key means change current selected part if (editor_pose_loaded && !editor_part_selected) { if (input.DownPressed()) { ++editor_current_part_index; if (editor_current_part_index > selectedPose.sprites.Count - 1) { editor_current_part_index = 0; } } if (input.UpPressed()) { --editor_current_part_index; if (editor_current_part_index < 0) { editor_current_part_index = selectedPose.sprites.Count - 1; } } selectedPart = selectedPose.sprites[editor_current_part_index]; if (input.EnterPressed()) { editor_part_selected = true; } //if (input.BackspacePressed()) editor_pose_loaded = false; } else if (editor_pose_loaded && editor_part_selected && !editor_option_selected) { if (input.DownPressed()) { ++selectedOption; if (selectedOption > num_part_options) { selectedOption = 0; } } if (input.UpPressed()) { --selectedOption; if (selectedOption < 0) { selectedOption = num_part_options; } } if (input.EnterPressed()) { editor_option_selected = true; } if (input.BackspacePressed()) editor_part_selected = false; } else if (editor_pose_loaded && editor_part_selected && editor_option_selected) { if ((!input.IsUpPressed()) && (!input.IsDownPressed()) && (!input.IsLeftPressed()) && (!input.IsRightPressed())) editor_option_adjust_speed = 0.0f; else switch (selectedOption) { default: case 0: if (input.IsLeftPressed()) { selectedPart.x -= editor_option_adjust_speed; editor_option_adjust_speed += 0.1f; } if (input.IsRightPressed()) { selectedPart.x += editor_option_adjust_speed; editor_option_adjust_speed += 0.1f; } if (input.IsDownPressed()) { selectedPart.y += editor_option_adjust_speed; editor_option_adjust_speed += 0.1f; } if (input.IsUpPressed()) { selectedPart.y -= editor_option_adjust_speed; editor_option_adjust_speed += 0.1f; } break; case 1: if (input.IsDownPressed() || input.IsRightPressed()) { selectedPart.rot += editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } if (input.IsUpPressed() || input.IsLeftPressed()) { selectedPart.rot -= editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } break; case 2: if (input.IsDownPressed() || input.IsRightPressed()) { selectedPart.scale += editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } if (input.IsUpPressed() || input.IsLeftPressed()) { selectedPart.scale -= editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } break; case 3: if (input.IsDownPressed() || input.IsRightPressed()) { selectedPart.r += editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } if (input.IsUpPressed() || input.IsLeftPressed()) { selectedPart.r -= editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } break; case 4: if (input.IsDownPressed() || input.IsRightPressed()) { selectedPart.g += editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } if (input.IsUpPressed() || input.IsLeftPressed()) { selectedPart.g -= editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } break; case 5: if (input.IsDownPressed() || input.IsRightPressed()) { selectedPart.b += editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } if (input.IsUpPressed() || input.IsLeftPressed()) { selectedPart.b -= editor_option_adjust_speed; editor_option_adjust_speed += 0.01f; } break; } selectedPose.sprites[editor_current_part_index] = selectedPart; if (input.BackspacePressed()) editor_option_selected = false; if (input.EnterPressed()) { for (int i = 0; i < selectedPose.sprites.Count; ++i) { Debug.WriteLine("anim.AddSpriteInfo(" + selectedPose.sprites[i].x + "f," + selectedPose.sprites[i].y + "f," + selectedPose.sprites[i].scale + "f," + selectedPose.sprites[i].rot + "f," + selectedPose.sprites[i].r + "f," + selectedPose.sprites[i].g + "f," + selectedPose.sprites[i].b + "f);"); } //anim.AddSpriteInfo(-2f, -15f, 0.5f, 0, 0, 1f, 1f);//head } } }