Finished draft of Region-Pager-Base.md
+1
-1
@@ -14,7 +14,7 @@ This is a breakdown of each class, it's methods and it's APIs, for quick lookup.
|
||||
|
||||
* [Region](Region)
|
||||
* [Region API](Region-API)
|
||||
* Region Pager Base
|
||||
* [Region Pager Base](Region-Pager-Base)
|
||||
* Region Pager Lua
|
||||
* Region Pager API
|
||||
* Tile Sheet
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
# Methods
|
||||
|
||||
```C++
|
||||
Region::type_t SetTile(int x, int y, int z, Region::type_t v);
|
||||
```
|
||||
|
||||
This takes an `x`, `y`, and `z` zero indexed parameter, indicating a tile in the map, and a layer. `v` is the new value for that tile. This function retreives a region with `GetRegion`, then it calls that region's `SetTile`.
|
||||
|
||||
```C++
|
||||
Region::type_t GetTile(int x, int y, int z);
|
||||
```
|
||||
|
||||
This takes an `x`, `y`, and `z` zero indexed parameter, indicating a tile in the map, and a layer. It will return that Region::tile_t. This function retreives a region with `GetRegion`, then it calls that region's `GetTile`.
|
||||
|
||||
```C++
|
||||
bool SetSolid(int x, int y, int b);
|
||||
```
|
||||
|
||||
This takes an `x` and `y` zero indexed parameter, indicating a tile in the map. `b` indicates whether it should be solid (true) or not (false). This function retreives a region with `GetRegion`, then it calls that region's `SetSolid`.
|
||||
|
||||
```C++
|
||||
bool GetSolid(int x, int y);
|
||||
```
|
||||
|
||||
This takes an `x` and `y` zero indexed parameter, indicating a tile in the map. It returns whether it's solid (true) or not (false). This function retreives a region with `GetRegion`, then it calls that region's `GetSolid`.
|
||||
|
||||
```C++
|
||||
Region* GetRegion(int x, int y);
|
||||
```
|
||||
|
||||
This is the universal function for accessing a region object. You can pass any integer value as `x` and `y`, and the correct region will be retrieved. First, it calls `FindRegion`. If that fails, it calls `LoadRegion`. Finally, if that fails, it calls `CreateRegion` as a last resort. Therefore, this will always return a `Region` object.
|
||||
|
||||
```C++
|
||||
Region* FindRegion(int x, int y);
|
||||
```
|
||||
|
||||
`x` and `y` must be multiples of `REGION_WIDTH` and `REGION_HEIGHT` respectfully. It will retrieve any existing region with the coordiantes `x` and `y`, or it will return `nullptr`.
|
||||
|
||||
```C++
|
||||
Region* PushRegion(Region* const);
|
||||
```
|
||||
|
||||
This will push any `Region` object into the RegionPagerBase.
|
||||
|
||||
```C++
|
||||
Region* LoadRegion(int x, int y);
|
||||
```
|
||||
|
||||
This will fail, and return nullptr. It's intended for overwriting by RegionPagerLua.
|
||||
|
||||
```C++
|
||||
Region* SaveRegion(int x, int y);
|
||||
```
|
||||
|
||||
This will fail, and return nullptr. It's intended for overwriting by RegionPagerLua.
|
||||
|
||||
```C++
|
||||
Region* CreateRegion(int x, int y);
|
||||
```
|
||||
|
||||
This will create a `Region` object with the coordinates `x` and `y`, add it to the RegionPagerBase, and return it. If an object with those coordinates already exist, it will throw an exception.
|
||||
|
||||
```C++
|
||||
void UnloadIf(std::function<bool(Region const&)> fn);
|
||||
```
|
||||
|
||||
This takes a function with the prototype `bool f(Region const&)` as a parameter. Each `Region` object that causes that function to return true will be destroyed and removed from the RegionPagerBase.
|
||||
|
||||
```C++
|
||||
void UnloadAll();
|
||||
```
|
||||
|
||||
This will destroy and unload all `Region` objects.
|
||||
|
||||
```C++
|
||||
void ForEach(std::function<void(Region&)> fn);
|
||||
```
|
||||
|
||||
This takes a function with the prototype `void f(Region&)` as a parameter, and passes each `Region` object to it. This is used for applying a certain function to each object inside RegionPagerLua.
|
||||
|
||||
```C++
|
||||
std::list<Region>* GetContainer();
|
||||
```
|
||||
|
||||
This is an OO-breaking utility function, allowing access to the internal container which holds the Region objects.
|
||||
|
||||
This method is not officially supported.
|
||||
Reference in New Issue
Block a user