~sladen/openbve/openbve2

« back to all changes in this revision

Viewing changes to Texture.BmpGifExigJpgPngTiff/Interfaces.cs

  • Committer: Paul Sladen
  • Author(s): Michelle Boucquemont
  • Date: 2010-03-17 04:04:44 UTC
  • Revision ID: git-v1:c9050dde4c55fe2b9c257080653cee1a07c91303
import openbve2.zip (2010-03-14)

You will find a settings.cfg file where you can configure a series of
options and also which route or object to load. The options are
explained briefly via the comments in the settings.cfg file itself.
Select any route or object you want, but mind the following limitations:

* Background images and fog are not yet supported. Only a background
  color will be shown.
* Animated objects are not yet supported. This includes signals. These
  objects are not shown at all.
* Glow is not yet supported. All objects using glow will always show at
  full intensity instead of fading in.
* The legacy visibility system (where objects are disposed of as soon as
  the CSV/RW block the object was placed in has been passed by the camera)
  is not yet supported, only the new 2D grid is.

In-game, you can use the arrow, the WASD and the PageUp and PageDown keys to move and rotate around. Hold down the shift, control or alt key for faster movement. There is no way for you to jump to specific "track positions" as the new program does not have something like them internally. Also, you cannot jump to stations in any way at the moment. The initial position of the camera is the first stop point, though.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Text;
 
3
using OpenBveApi;
 
4
 
 
5
namespace Plugin {
 
6
 
 
7
        // host interface
 
8
        internal static class Interfaces {
 
9
                internal static IHost10 Host = null;
 
10
        }
 
11
        
 
12
        // plugin interface
 
13
        /// <summary>Exposes version 1.0 of the interface to be implemented by a plugin.</summary>
 
14
        public class Plugin : IPlugin10 {
 
15
 
 
16
                // --- general ---
 
17
                
 
18
                /// <summary>Is called when the plugin is loaded.</summary>
 
19
                /// <param name="hosts">A list of versions of the host interface as used for callbacks.</param>
 
20
                /// <returns>A boolean indicating whether the plugin was successfully loaded.</returns>
 
21
                /// <remarks>A plugin should make use of the smallest version the host interface provides as possible. If the plugin expects a certain version that is not supplied by the host application, this operation should return as unsuccessful.</remarks>
 
22
                public bool Load(IHost[] hosts) {
 
23
                        foreach (IHost host in hosts) {
 
24
                                if (host is IHost10) {
 
25
                                        Interfaces.Host = (IHost10)host;
 
26
                                        return true;
 
27
                                }
 
28
                        }
 
29
                        return false;
 
30
                }
 
31
                
 
32
                /// <summary>Is called when the plugin is unloaded.</summary>
 
33
                public void Unload() { }
 
34
                
 
35
                
 
36
                // --- textures (loading) ---
 
37
                
 
38
                /// <summary>Returns whether the plugin is capable of loading textures.</summary>
 
39
                /// <returns>A boolean indicating whether the plugin is capable of loading textures.</returns>
 
40
                public bool CanLoadTextures() {
 
41
                        return true;
 
42
                }
 
43
                
 
44
                /// <summary>Returns whether the plugin is capable of loading the specified texture.</summary>
 
45
                /// <param name="path">The file or folder where the texture is stored.</param>
 
46
                /// <param name="encoding">The suggested encoding in case the texture format does not mandate a specific encoding.</param>
 
47
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
48
                /// <returns>The priority at which the plugin supports loading the specified texture.</returns>
 
49
                public General.Priority CanLoadTexture(Path.PathReference path, Encoding encoding, object data) {
 
50
                        if (path is Path.FileReference) {
 
51
                                string fileName = ((Path.FileReference)path).Path;
 
52
                                if (
 
53
                                        fileName.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) ||
 
54
                                        fileName.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) ||
 
55
                                        fileName.EndsWith(".exig", StringComparison.OrdinalIgnoreCase) ||
 
56
                                        fileName.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) ||
 
57
                                        fileName.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) ||
 
58
                                        fileName.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
 
59
                                        fileName.EndsWith(".tif", StringComparison.OrdinalIgnoreCase) ||
 
60
                                        fileName.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase)
 
61
                                ) {
 
62
                                        return General.Priority.Normal;
 
63
                                } else {
 
64
                                        return General.Priority.NotCapable;
 
65
                                }
 
66
                        } else {
 
67
                                return General.Priority.NotCapable;
 
68
                        }
 
69
                }
 
70
                
 
71
                /// <summary>Loads a texture into an output parameter and returns the success of the operation.</summary>
 
72
                /// <param name="path">The file or folder where the texture is stored.</param>
 
73
                /// <param name="encoding">The suggested encoding in case the texture format does not mandate a specific encoding.</param>
 
74
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
75
                /// <param name="texture">Receives the texture.</param>
 
76
                /// <returns>The success of the operation.</returns>
 
77
                public General.Result LoadTexture(Path.PathReference path, Encoding encoding, object data, out Texture.TextureData texture) {
 
78
                        #if !DEBUG
 
79
                        try {
 
80
                                #endif
 
81
                                string fileName = ((Path.FileReference)path).Path;
 
82
                                if (System.IO.File.Exists(fileName)) {
 
83
                                        return Loader.LoadTexture(fileName, out texture);
 
84
                                } else {
 
85
                                        texture = null;
 
86
                                        return OpenBveApi.General.Result.FileNotFound;
 
87
                                }
 
88
                                #if !DEBUG
 
89
                        } catch {
 
90
                                texture = null;
 
91
                                return OpenBveApi.General.Result.InternalError;
 
92
                        }
 
93
                        #endif
 
94
                }
 
95
                
 
96
                
 
97
                // --- objects (loading) ---
 
98
                
 
99
                /// <summary>Returns whether the plugin is capable of loading objects.</summary>
 
100
                /// <returns>A boolean indicating whether the plugin is capable of loading objects.</returns>
 
101
                public bool CanLoadObjects() {
 
102
                        return false;
 
103
                }
 
104
                
 
105
                /// <summary>Returns whether the plugin is capable of loading the specified object.</summary>
 
106
                /// <param name="path">The file or folder where the object is stored.</param>
 
107
                /// <param name="encoding">The suggested encoding in case the object format does not mandate a specific encoding.</param>
 
108
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
109
                /// <returns>The priority at which the plugin supports loading the specified object.</returns>
 
110
                public General.Priority CanLoadObject(Path.PathReference path, Encoding encoding, object data) {
 
111
                        return General.Priority.NotCapable;
 
112
                }
 
113
                
 
114
                /// <summary>Loads an object into an output parameter and returns the success of the operation.</summary>
 
115
                /// <param name="path">The file or folder where the object is stored.</param>
 
116
                /// <param name="encoding">The suggested encoding in case the object format does not mandate a specific encoding.</param>
 
117
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
118
                /// <param name="obj">Receives the object.</param>
 
119
                /// <returns>The success of the operation.</returns>
 
120
                public General.Result LoadObject(Path.PathReference path, Encoding encoding, object data, out Geometry.GenericObject obj) {
 
121
                        obj = null;
 
122
                        return General.Result.NotSupported;
 
123
                }
 
124
                
 
125
                
 
126
                // --- sounds (loading) ---
 
127
                
 
128
                /// <summary>Returns whether the plugin is capable of loading sounds.</summary>
 
129
                /// <returns>A boolean indicating whether the plugin is capable of loading sounds.</returns>
 
130
                public bool CanLoadSounds() {
 
131
                        return false;
 
132
                }
 
133
                
 
134
                /// <summary>Returns whether the plugin is capable of loading the specified sound.</summary>
 
135
                /// <param name="path">The file or folder where the sound is stored.</param>
 
136
                /// <param name="encoding">The suggested encoding in case the sound format does not mandate a specific encoding.</param>
 
137
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
138
                /// <returns>The priority at which the plugin supports loading the specified sound.</returns>
 
139
                public General.Priority CanLoadSound(Path.PathReference path, Encoding encoding, object data) {
 
140
                        return General.Priority.NotCapable;
 
141
                }
 
142
                
 
143
                /// <summary>Loads a sound into an output parameter and returns the success of the operation.</summary>
 
144
                /// <param name="path">The file or folder where the sound is stored.</param>
 
145
                /// <param name="encoding">The suggested encoding in case the sound format does not mandate a specific encoding.</param>
 
146
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
147
                /// <param name="sound">Receives the sound.</param>
 
148
                /// <returns>The success of the operation.</returns>
 
149
                public General.Result LoadSound(Path.PathReference path, Encoding encoding, object data, out Sound.SoundData sound) {
 
150
                        sound = null;
 
151
                        return General.Result.NotSupported;
 
152
                }
 
153
                
 
154
                
 
155
                // --- routes (loading) ---
 
156
                
 
157
                /// <summary>Returns whether the plugin is capable of loading routes.</summary>
 
158
                /// <returns>A boolean indicating whether the plugin is capable of loading routes.</returns>
 
159
                public bool CanLoadRoutes() {
 
160
                        return false;
 
161
                }
 
162
                
 
163
                /// <summary>Returns whether the plugin is capable of loading the specified route.</summary>
 
164
                /// <param name="path">The file or folder where the route is stored.</param>
 
165
                /// <param name="encoding">The suggested encoding in case the route format does not mandate a specific encoding.</param>
 
166
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
167
                /// <returns>The priority at which the plugin supports loading the specified route.</returns>
 
168
                public General.Priority CanLoadRoute(Path.PathReference path, Encoding encoding, object data) {
 
169
                        return General.Priority.NotCapable;
 
170
                }
 
171
                
 
172
                /// <summary>Loads a route into an output parameter and returns the success of the operation.</summary>
 
173
                /// <param name="path">The file or folder where the route is stored.</param>
 
174
                /// <param name="encoding">The suggested encoding in case the route format does not mandate a specific encoding.</param>
 
175
                /// <param name="data">Optional data passed from another plugin. If you access this field, you must check the type before casting to that type.</param>
 
176
                /// <param name="route">Receives the route.</param>
 
177
                /// <returns>The success of the operation.</returns>
 
178
                public General.Result LoadRoute(Path.PathReference path, Encoding encoding, object data, out Route.RouteData route) {
 
179
                        route = null;
 
180
                        return General.Result.NotSupported;
 
181
                }
 
182
                
 
183
                
 
184
                // --- runtime ---
 
185
 
 
186
                /// <summary>Queries data from this runtime plugin.</summary>
 
187
                /// <param name="contentType">The type of content to query.</param>
 
188
                /// <param name="contentData">Receives the queried content.</param>
 
189
                /// <returns>The success of the operation.</returns>
 
190
                public General.Result QueryPluginData(int contentType, out object contentData) {
 
191
                        contentData = null;
 
192
                        return General.Result.NotSupported;
 
193
                }
 
194
                
 
195
                /// <summary>Submits data to this runtime plugin.</summary>
 
196
                /// <param name="contentType">The type of content to submit.</param>
 
197
                /// <param name="contentData">The data to submit.</param>
 
198
                /// <returns>The success of the operation.</returns>
 
199
                public General.Result SubmitPluginData(int contentType, object contentData) {
 
200
                        return General.Result.NotSupported;
 
201
                }
 
202
                
 
203
        }
 
204
}
 
 
b'\\ No newline at end of file'