public Resource.Resource Load(string name, Resource.ResourceManager content) { try { if (name.IndexOf('.') < 0) { name += ".BMP"; } System.IO.Stream stream = FileSystem.Open(name); BitmapSurface surface = new BitmapSurface(stream, BitmapSurface.SourceType.Unknown, true); Resource.Resource resource = RendererManager.CurrentRenderer.CreateTexture(name, surface, true, true); stream.Close(); return(resource); } catch (System.IO.FileNotFoundException) { Logger.WriteError("Unable to find texture: {0}", name); return(RendererManager.CurrentRenderer.ErrorTexture); } }
public OptionsMenu(Resource.ResourceManager globalContent) { _upperButtons = new Button[7]; _optionsButtons = new Button[4]; _content = globalContent; // we need to load all the positioning data and whatnot from a file... Resource.TextResource layout = new Gk3Main.Resource.TextResource("RC_LAYOUT.TXT", FileSystem.Open("RC_LAYOUT.TXT")); string[] lines = layout.Text.Split('\n'); Dictionary <string, string> layoutInfo = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); foreach (string line in lines) { if (line.StartsWith(";") == false) { int equal = line.IndexOf('='); if (equal > 0) { layoutInfo.Add(line.Substring(0, equal).Trim(), line.Substring(equal + 1).Trim()); } } } _upperBackground = globalContent.Load <Graphics.TextureResource>(layoutInfo["backSprite"]); _optionsBackground = globalContent.Load <Graphics.TextureResource>(layoutInfo["optBackSprite"]); _advancedBackground = globalContent.Load <Graphics.TextureResource>(layoutInfo["advOptBackSprite"]); _graphicsBackground = globalContent.Load <Graphics.TextureResource>(layoutInfo["graphicsOptBackSprite"]); setupUpperButtons(globalContent, layoutInfo); setupOptionsButtons(globalContent, layoutInfo); setupAdvancedOptionsButtons(globalContent, layoutInfo); setupGraphicsOptionsButtons(globalContent, layoutInfo); }
private void setupUpperButtons(Resource.ResourceManager globalContent, Dictionary <string, string> layoutInfo) { // load all the buttons _upperButtons[0] = new Button(this, globalContent, layoutInfo["closedSpriteDown"], layoutInfo["closedSpriteHov"], layoutInfo["closedSpriteUp"], layoutInfo["closedSpriteDis"], null); _upperButtons[1] = new Button(this, globalContent, "RC_HINTS_DWN", "RC_HINTS_HOV", "RC_HINTS_STD", "RC_HINTS_DIS", null); _upperButtons[2] = new Button(this, globalContent, "RC_CAMERAS_DWN", "RC_CAMERAS_HOV", "RC_CAMERAS_STD", "RC_CAMERAS_DIS", null); _upperButtons[3] = new Button(this, globalContent, "RC_CINEMATIC_DWN", "RC_CINEMATIC_HOV", "RC_CINEMATIC_STD", "RC_CINEMATIC_DIS", null); _upperButtons[4] = new Button(this, globalContent, "RC_HELP_DWN", "RC_HELP_HOV", "RC_HELP_STD", "RC_HELP_DIS", null); _upperButtons[5] = new Button(this, globalContent, "RC_OPTIONS_DWN", "RC_OPTIONS_HOV", "RC_OPTIONS_STD", "RC_OPTIONS_DIS", null); _upperButtons[6] = new Button(this, globalContent, "RC_EXIT_DWN", "RC_EXIT_HOV", "RC_EXIT_STD", "RC_EXIT_DIS", null); // position the buttons positionButton(_upperButtons[0], layoutInfo, "closedPos"); positionButton(_upperButtons[1], layoutInfo, "hintPos"); positionButton(_upperButtons[2], layoutInfo, "cameraPos"); positionButton(_upperButtons[3], layoutInfo, "cinePos"); positionButton(_upperButtons[4], layoutInfo, "helpPos"); positionButton(_upperButtons[5], layoutInfo, "optionsPos"); positionButton(_upperButtons[6], layoutInfo, "exitPos"); // TODO: implement each of these buttons _upperButtons[0].Enabled = false; _upperButtons[1].Enabled = false; _upperButtons[2].Enabled = false; _upperButtons[3].Enabled = false; _upperButtons[4].Enabled = false; _upperButtons[5].OnClick += new EventHandler(onOptionsClicked); _upperButtons[6].OnClick += new EventHandler(onCancelClicked); }
private void loadTextures(Resource.ResourceManager content) { foreach (BspSurface surface in _surfaces) { surface.textureResource = content.Load <TextureResource>(surface.texture); } }
public SpriteFrame(Resource.ResourceManager ResourceManager) { resourceManager = ResourceManager; texture = null; size = new Vector2(1, 1); loaded = false; }
public TimeBlockSplash(Resource.ResourceManager globalContent, Gk3Main.Game.Timeblock timeblock, int currentTickCount) { _isActive = true; _timeAtStart = currentTickCount; string timeblockName = Gk3Main.Game.GameManager.GetTimeBlockString(timeblock); _background = globalContent.Load <Gk3Main.Graphics.TextureResource>("TBT" + timeblockName); _title = new List <Gk3Main.Graphics.TextureResource>(); int counter = 0; while (true) { Gk3Main.Graphics.TextureResource title = globalContent.Load <Gk3Main.Graphics.TextureResource>("D" + timeblockName + "_" + (counter + 1).ToString("00")); if (title == null || title.Loaded == false) { break; } _title.Add(title); counter++; } _ticktock = globalContent.Load <Gk3Main.Sound.AudioEngine.SoundEffect>("CLOCKTIMEBLOCK"); Sound.SoundManager.PlaySound2DToChannel(_ticktock, Gk3Main.Sound.SoundTrackChannel.UI); }
public Button(IButtonContainer container, Resource.ResourceManager content, string downImage, string hoverImage, string upImage, string disabledImage, string clickedSound, string tooltip) { _downImage = content.Load <Graphics.TextureResource>(downImage); _hoverImage = content.Load <Graphics.TextureResource>(hoverImage); _upImage = content.Load <Graphics.TextureResource>(upImage); if (string.IsNullOrEmpty(disabledImage) == false) { _disabledImage = content.Load <Graphics.TextureResource>(disabledImage); } if (string.IsNullOrEmpty(clickedSound) == false) { _clickedSound = content.Load <Sound.AudioEngine.SoundEffect>(clickedSound); } _tooltip = tooltip; if (tooltip != null) { _tooltipFont = Gui.Font.Load(content.Load <Gui.FontSpec>("F_TOOLTIP.FON")); } _container = container; _enabled = true; }
public void LoadClothing(Resource.ResourceManager content) { // apparently when an actor is loaded we need to look // for the most recent [Actor]CLOTHES[Timeblock].ANM file. // So start at the current timeblock and work backwards. Game.Timeblock now = Game.GameManager.CurrentTime; MomResource clothesAnm = null; for (int timeblock = (int)now; timeblock >= 0; timeblock--) { try { string file = _code + "CLOTHES" + Game.GameManager.GetTimeBlockString((Timeblock)timeblock); clothesAnm = content.Load <MomResource>(file); // guess we found it break; } catch (System.IO.FileNotFoundException) { // didn't find it, so keep looking } } if (clothesAnm != null) { clothesAnm.Play(); } }
public Actor(Resource.ResourceManager content, string modelName, string noun, bool isEgo) { _code = GetActorCodeFromNoun(noun); _noun = noun; _modelName = modelName; _isEgo = isEgo; _model = content.Load <Graphics.ModelResource>(modelName); _face = new ActorFace(content, _code); if (_model.Meshes != null) { // find the face section for (int i = 0; i < _model.Meshes.Length; i++) { for (int j = 0; j < _model.Meshes[i].sections.Length; j++) { if (_model.Meshes[i].sections[j].texture.IndexOf("_FACE", StringComparison.OrdinalIgnoreCase) != -1) { _model.Meshes[i].sections[j].textureResource = _face.Texture; } } } } }
public SpriteFrame(Resource.ResourceManager ResourceManager, Texture Texture, Vector2 Size, byte[] systemCopy) { resourceManager = ResourceManager; texture = Texture; size = Size; loaded = Texture != null; this.systemCopy = systemCopy; }
public static MsgBox ShowMessageBox(Resource.ResourceManager globalContent, string text, MsgBoxType type) { MsgBox box = new MsgBox(globalContent, text, type); _layers.Add(box); return(box); }
public VerbButtonSet(Resource.ResourceManager content, int screenX, int screenY, List <Game.NounVerbCase> nvcs, bool cancel) { _screenX = screenX; _screenY = screenY; int buttonOffsetX = 0; foreach (Game.NounVerbCase nvc in nvcs) { // TODO: apparently the inventory verb is a special case. // for now just ignore it. if (nvc.Verb == Game.Verbs.V_ANY_INV_ITEM) { continue; } Game.VerbInfo info = Game.GameManager.Verbs[nvc.Verb]; VerbButton b = new VerbButton(this, content, nvc.Noun, nvc.Verb, nvc.Script, nvc.Approach, nvc.Target, string.Format("{0}.BMP", info.DownButton), string.Format("{0}.BMP", info.HoverButton), string.Format("{0}.BMP", info.UpButton), info.DisableButton != null ? string.Format("{0}.BMP", info.DisableButton) : null, null, info.Verb != Game.Verbs.V_NONE ? Game.GameManager.Strings.GetVerbTooltip(info.Verb) : null); b.X = new Unit(0, buttonOffsetX); b.OnClick += new EventHandler(buttonClicked); _buttons.Add(b); buttonOffsetX += ButtonWidth; } if (cancel) { Game.VerbInfo info = Game.GameManager.Verbs["t_cancel"]; Button b = new Button(this, content, string.Format("{0}.BMP", info.DownButton), string.Format("{0}.BMP", info.HoverButton), string.Format("{0}.BMP", info.UpButton), info.DisableButton != null ? string.Format("{0}.BMP", info.DisableButton) : null, null, Game.GameManager.Strings.GetVerbTooltip(info.Verb)); b.X = new Unit(0, buttonOffsetX); b.OnClick += delegate { cancelClicked(); }; _buttons.Add(b); buttonOffsetX += ButtonWidth; } // now that we've got all the buttons go back and center them around the cursor _screenX -= (_buttons.Count * ButtonWidth) / 2; _screenY -= ButtonWidth / 2; // assume the buttons are square }
public Resource.Resource Load(string name, Resource.ResourceManager content) { System.IO.Stream stream = FileSystem.Open(name); ActResource resource = new ActResource(name, stream); stream.Close(); return(resource); }
public MsgBox(Resource.ResourceManager globalContent, string text, MsgBoxType type) { _type = type; _isActive = true; // we need to load all the positioning data and whatnot from a file... Resource.TextResource layout = new Gk3Main.Resource.TextResource("MSGBOX.TXT", FileSystem.Open("MSGBOX.TXT")); string[] lines = layout.Text.Split('\n'); Dictionary <string, string> layoutInfo = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); foreach (string line in lines) { if (line.StartsWith(";") == false) { int equal = line.IndexOf('='); if (equal > 0) { layoutInfo.Add(line.Substring(0, equal).Trim(), line.Substring(equal + 1).Trim()); } } } _font = Font.Load(globalContent.Load <FontSpec>(layoutInfo["Font"])); _yes = new Button(this, globalContent, layoutInfo["yesSpriteDown"], layoutInfo["yesSpriteHov"], layoutInfo["yesSpriteUp"], null, null); _no = new Button(this, globalContent, layoutInfo["noSpriteDown"], layoutInfo["noSpriteHov"], layoutInfo["noSpriteUp"], null, null); _ok = new Button(this, globalContent, layoutInfo["okSpriteDown"], layoutInfo["okSpriteHov"], layoutInfo["okSpriteUp"], null, null); _yes.OnClick += new EventHandler(onButtonClicked); _no.OnClick += new EventHandler(onButtonClicked); _ok.OnClick += new EventHandler(onButtonClicked); _bg = globalContent.Load <Graphics.TextureResource>("black"); _vert = globalContent.Load <Graphics.TextureResource>(layoutInfo["vertSprite"]); _horiz = globalContent.Load <Graphics.TextureResource>(layoutInfo["horizSprite"]); _ur = globalContent.Load <Graphics.TextureResource>(layoutInfo["urCornerSprite"]); _ul = globalContent.Load <Graphics.TextureResource>(layoutInfo["ulCornerSprite"]); _lr = globalContent.Load <Graphics.TextureResource>(layoutInfo["lrCornerSprite"]); _ll = globalContent.Load <Graphics.TextureResource>(layoutInfo["llCornerSprite"]); tryParse2f(layoutInfo["minSize"], out _rect.Width, out _rect.Height); tryParse2f(layoutInfo["textOffset"], out _textOffsetX, out _textOffsetY); _rect = centerBox(Graphics.RendererManager.CurrentRenderer.Viewport, calculateBoxSize(text, _rect)); if (_type == MsgBoxType.YesNo) { positionButtons(true, true, false); } else { positionButtons(false, false, true); } }
public GasResource(string name, System.IO.Stream stream, Resource.ResourceManager content) : base(name, stream) { if (content == null) { throw new ArgumentNullException("content"); } _content = content; parse(Text); }
public Gk3Main.Resource.Resource Load(string filename, Resource.ResourceManager content) { IRenderer renderer = RendererManager.CurrentRenderer; System.IO.Stream stream = FileSystem.Open(filename + renderer.ShaderFilenameSuffix); Effect resource = renderer.CreateEffect(filename, stream); stream.Close(); return(resource); }
public Resource.Resource Load(string name, Resource.ResourceManager content) { if (name.IndexOf('.') < 0) { name = name + ".SIF"; } System.IO.Stream stream = FileSystem.Open(name); return(new SifResource(name, stream)); }
public Resource.Resource Load(string name, Resource.ResourceManager content) { if (name.IndexOf('.') < 0) { name = name + ".FON"; } System.IO.Stream stream = FileSystem.Open(name); return(new FontSpec(name, stream, content)); }
public VerbButton(VerbButtonSet vbs, Resource.ResourceManager content, Game.Nouns noun, Game.Verbs verb, string script, Game.NvcApproachType approach, string approachTarget, string downImage, string hoverImage, string upImage, string disabledImage, string clickedSound, string tooltip) : base(vbs, content, downImage, hoverImage, upImage, disabledImage, clickedSound) { _noun = noun; _verb = verb; _script = script; _approach = approach; _approachTarget = approachTarget; }
public Scene() { background = Colors.Black; local_transform = Matrix.Identity; renderables = new LinkedList <IRenderable>(); physics = new LinkedList <Physics.IPhysicsObject>(); res = new Glorg2.Resource.ResourceManager(); items = new List <Node>(); camera = new NodeReference <Camera>(); children = new WorldSpawn(); children.owner = this; children.Name = "__WorldSpawn"; }
public static TimeBlockSplash ShowTimeBlockSplash(Resource.ResourceManager globalContent, Game.Timeblock timeblock) { if (_mainMenu != null) { _mainMenu.Dismiss(); _layers.Remove(_mainMenu); } TimeBlockSplash splash = new TimeBlockSplash(globalContent, timeblock, Game.GameManager.TickCount); _layers.Add(splash); return(splash); }
private void setupAdvancedOptionsButtons(Resource.ResourceManager globalContent, Dictionary <string, string> layoutInfo) { _advancedOptionsButtons = new Button[3]; _advancedOptionsButtons[0] = new Button(this, globalContent, layoutInfo["advOptSoundSpriteDown"], layoutInfo["advOptSoundSpriteHov"], layoutInfo["advOptSoundSpriteUp"], null, null); _advancedOptionsButtons[1] = new Button(this, globalContent, layoutInfo["advOptGraphicsSpriteDown"], layoutInfo["advOptGraphicsSpriteHov"], layoutInfo["advOptGraphicsSpriteUp"], null, null); _advancedOptionsButtons[2] = new Button(this, globalContent, layoutInfo["advOptGameSpriteDown"], layoutInfo["advOptGameSpriteHov"], layoutInfo["advOptGameSpriteUp"], null, null); positionButton(_advancedOptionsButtons[0], layoutInfo, "advOptSoundPos", 0, _upperBackground.Height + _optionsBackground.Height); positionButton(_advancedOptionsButtons[1], layoutInfo, "advOptGraphicsPos", 0, _upperBackground.Height + _optionsBackground.Height); positionButton(_advancedOptionsButtons[2], layoutInfo, "advOptGamePos", 0, _upperBackground.Height + _optionsBackground.Height); _advancedOptionsButtons[1].OnClick += new EventHandler(onGraphicsOptionsClicked); }
public Resource.Resource Load(string filename, Resource.ResourceManager content) { if (filename.IndexOf('.') < 0) { filename += ".WAV"; } System.IO.Stream stream = FileSystem.Open(filename); AudioEngine.SoundEffect sound = new AudioEngine.SoundEffect(filename, stream); stream.Close(); return(sound); }
public Resource.Resource Load(string name, Resource.ResourceManager content) { if (name.IndexOf('.') < 0) { name += ".BSP"; } System.IO.Stream stream = FileSystem.Open(name); BspResource resource = new BspResource(name, stream, content); stream.Close(); return(resource); }
private void setupOptionsButtons(Resource.ResourceManager globalContent, Dictionary <string, string> layoutInfo) { _optionsButtons[0] = new Button(this, globalContent, "RC_SO_SAVE_DWN", "RC_SO_SAVE_HOV", "RC_SO_SAVE_STD", "RC_SO_SAVE_DIS", null); _optionsButtons[1] = new Button(this, globalContent, "RC_SO_RESTORE_DWN", "RC_SO_RESTORE_HOV", "RC_SO_RESTORE_STD", "RC_SO_RESTORE_DIS", null); _optionsButtons[2] = new Button(this, globalContent, "RC_SO_ADVANCED_DWN", "RC_SO_ADVANCED_HOV", "RC_SO_ADVANCED_STD", "RC_SO_ADVANCED_DIS", null); _optionsButtons[3] = new Button(this, globalContent, layoutInfo["optQuitSpriteDown"], layoutInfo["optQuitSpriteHov"], layoutInfo["optQuitSpriteUp"], null, null); positionButton(_optionsButtons[0], layoutInfo, "optSavePos", 0, _upperBackground.Height); positionButton(_optionsButtons[1], layoutInfo, "optRestorePos", 0, _upperBackground.Height); positionButton(_optionsButtons[2], layoutInfo, "optAdvancedPos", 0, _upperBackground.Height); positionButton(_optionsButtons[3], layoutInfo, "optQuitPos", 0, _upperBackground.Height); _optionsButtons[0].Enabled = false; _optionsButtons[1].Enabled = false; _optionsButtons[2].OnClick += new EventHandler(onAdvancedOptionsClicked); }
public SoundTrackResource(string name, System.IO.Stream stream, Resource.ResourceManager content) : base(name, stream) { foreach (Resource.InfoSection section in Sections) { if (section.Name.Equals("SoundTrack", StringComparison.OrdinalIgnoreCase)) { foreach (Resource.InfoLine line in section.Lines) { string soundType; if (line.TryGetAttribute("SoundType", out soundType)) { if (soundType.Equals("SFX", StringComparison.OrdinalIgnoreCase)) { _channel = SoundTrackChannel.SFX; } else if (soundType.Equals("Ambient", StringComparison.OrdinalIgnoreCase)) { _channel = SoundTrackChannel.Ambient; } else if (soundType.Equals("Music", StringComparison.OrdinalIgnoreCase)) { _channel = SoundTrackChannel.Music; } else if (soundType.Equals("Dialogue", StringComparison.OrdinalIgnoreCase)) { _channel = SoundTrackChannel.Dialog; } } } } else if (section.Name.Equals("Wait", StringComparison.OrdinalIgnoreCase)) { _nodes.Add(new SoundTrackWaitNode(section)); } else if (section.Name.Equals("Sound", StringComparison.OrdinalIgnoreCase)) { _nodes.Add(new SoundTrackSoundNode(section, content)); } else if (section.Name.Equals("PRS", StringComparison.OrdinalIgnoreCase)) { _nodes.Add(new SoundTrackPrsNode(section, content)); } } }
public Dropdown(IButtonContainer container, Resource.ResourceManager globalContent, int width, string arrowDownSprite, string arrowHoverSprite, string arrowUpSprite) { _container = container; _downArrow = new Button(this, globalContent, arrowDownSprite, arrowHoverSprite, arrowUpSprite, null, null); _font = Gk3Main.Gui.Font.Load(globalContent.Load <FontSpec>("F_ARIAL_T8")); _top = globalContent.Load <Graphics.TextureResource>("RC_BOX_TOP"); _side = globalContent.Load <Graphics.TextureResource>("RC_BOX_SIDE"); _blCorner = globalContent.Load <Graphics.TextureResource>("RC_BOX_CORNER_BL"); _brCorner = globalContent.Load <Graphics.TextureResource>("RC_BOX_CORNER_BR"); _tlCorner = globalContent.Load <Graphics.TextureResource>("RC_BOX_CORNER_TL"); _trCorner = globalContent.Load <Graphics.TextureResource>("RC_BOX_CORNER_TR"); _dropdownBackground = globalContent.Load <Graphics.TextureResource>("OPTSC"); _downArrow.OnClick += new EventHandler(_downArrow_OnClick); _width = width; }
public static void ToggleOptionsMenu(Resource.ResourceManager globalContent, int x, int y) { if (_optionsMenu == null) { _optionsMenu = new OptionsMenu(globalContent); } if (_optionsMenu.IsActive) { _optionsMenu.Dismiss(); _layers.Remove(_optionsMenu); } else { _optionsMenu.Show(x, y, Gk3Main.Graphics.RendererManager.CurrentRenderer.Viewport); _layers.Add(_optionsMenu); } }
public static void Init(Resource.ResourceManager globalContent) { _vertices = new float[(_resolution + 1) * 3 * 3]; float step = Math.Constants.TwoPi / _resolution; int index = 0; // XY plane for (float i = 0; i < Math.Constants.TwoPi; i += step) { _vertices[index * 3 + 0] = (float)System.Math.Cos(i); _vertices[index * 3 + 1] = (float)System.Math.Sin(i); _vertices[index * 3 + 2] = 0; index++; } // XZ plane for (float i = 0; i < Math.Constants.TwoPi; i += step) { _vertices[index * 3 + 0] = (float)System.Math.Cos(i); _vertices[index * 3 + 1] = 0; _vertices[index * 3 + 2] = (float)System.Math.Sin(i); index++; } // YZ plane for (float i = 0; i < Math.Constants.TwoPi; i += step) { _vertices[index * 3 + 0] = 0; _vertices[index * 3 + 1] = (float)System.Math.Cos(i); _vertices[index * 3 + 2] = (float)System.Math.Sin(i); index++; } _effect = globalContent.Load <Effect>("wireframe.fx"); _declaration = new VertexElementSet(new VertexElement[] { new VertexElement(0, VertexElementFormat.Float3, VertexElementUsage.Position, 0) }); }
public Button(IButtonContainer container, Resource.ResourceManager content, string downImage, string hoverImage, string upImage, string disabledImage, string clickedSound) { _downImage = content.Load <Graphics.TextureResource>(downImage); _hoverImage = content.Load <Graphics.TextureResource>(hoverImage); _upImage = content.Load <Graphics.TextureResource>(upImage); if (string.IsNullOrEmpty(disabledImage) == false) { _disabledImage = content.Load <Graphics.TextureResource>(disabledImage); } if (string.IsNullOrEmpty(clickedSound) == false) { _clickedSound = content.Load <Sound.AudioEngine.SoundEffect>(clickedSound); } _container = container; _enabled = true; }