mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-29 13:03:43 +01:00
Very first commit to prepare the template of the project - Tileset Ok + Importation Map + Basic Rendering of map in grayscale
This commit is contained in:
commit
5d868c6089
15 changed files with 366 additions and 0 deletions
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Build files
|
||||||
|
/build-fx
|
||||||
|
/build-cg
|
||||||
|
/build-cg-push
|
||||||
|
/*.g1a
|
||||||
|
/*.g3a
|
||||||
|
|
||||||
|
# Python bytecode
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
|
# Common IDE files
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
.vscode
|
55
CMakeLists.txt
Normal file
55
CMakeLists.txt
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the
|
||||||
|
# toolchain file and module path of the fxSDK
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
project(MyAddin)
|
||||||
|
|
||||||
|
include(GenerateG1A)
|
||||||
|
include(Fxconv)
|
||||||
|
find_package(Gint 2.9 REQUIRED)
|
||||||
|
find_package(LibProf 2.4 REQUIRED)
|
||||||
|
|
||||||
|
fxconv_declare_converters(assets-fx/converters.py)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
COMMENT "Convert Tiled TMX map to usable JSON file"
|
||||||
|
COMMAND tiled --export-tileset json tilesetnpp.tsx tilesetnpp.json
|
||||||
|
COMMAND find | grep .*.tmx | sed 's/.tmx//g' | xargs -l bash -c 'tiled --export-map json $$0.tmx $$0.json'
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets-fx/levels/
|
||||||
|
|
||||||
|
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-fx/levels/level0.json"
|
||||||
|
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
|
||||||
|
DEPENDS assets-fx/converters.py
|
||||||
|
assets-fx/levels/tileset.png
|
||||||
|
assets-fx/levels/tilesetnpp.tsx
|
||||||
|
assets-fx/levels/level0.tmx
|
||||||
|
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
src/main.c
|
||||||
|
src/map.c
|
||||||
|
# ...
|
||||||
|
)
|
||||||
|
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
||||||
|
set(ASSETS
|
||||||
|
# ...
|
||||||
|
)
|
||||||
|
set(ASSETS_fx
|
||||||
|
assets-fx/levels/tileset.png
|
||||||
|
assets-fx/levels/level0.json
|
||||||
|
# ...
|
||||||
|
)
|
||||||
|
|
||||||
|
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||||
|
|
||||||
|
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||||
|
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os)
|
||||||
|
target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage)
|
||||||
|
target_link_libraries(myaddin LibProf::LibProf Gint::Gint)
|
||||||
|
|
||||||
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||||
|
generate_g1a(TARGET myaddin OUTPUT "Prj_PC.g1a"
|
||||||
|
NAME "Collab RPG" ICON assets-fx/icon.png)
|
||||||
|
endif()
|
32
README.md
Normal file
32
README.md
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# Projet Collaboratif Planete Casio
|
||||||
|
|
||||||
|
## Template
|
||||||
|
|
||||||
|
Voici un premier jet de template pour le projet collaboratif de Planete Casio.
|
||||||
|
|
||||||
|
PLus d'infos sur ce projet ici : [Le projet Collaboratif de PC](https://www.planet-casio.com/Fr/forums/topic17343-last-projet-collaboratif-avec-toute-la-commu.html)
|
||||||
|
|
||||||
|
## Dispo / Pas Dispo
|
||||||
|
|
||||||
|
Le template initialise un projet avec moteur de gris pour les calculatrices fx9860G toute version.
|
||||||
|
|
||||||
|
Importation d'un tileset via un convertisseur tiled/fxconv
|
||||||
|
Importation d'une carte de tiles (map) via un convertisseur
|
||||||
|
Dessin de la Map en niveau de gris
|
||||||
|
|
||||||
|
|
||||||
|
A ce stade, rien de plus :
|
||||||
|
|
||||||
|
Pas de gestion des touches
|
||||||
|
Pas de personnage
|
||||||
|
Pas d'interraction
|
||||||
|
|
||||||
|
Bref, c'est juste le minimum pour offrir qq fonctions de base et ne pas partir de zéro.
|
||||||
|
|
||||||
|
## Crédits
|
||||||
|
|
||||||
|
Les tiles sont issues de Game Boy Top-down RPG Fantasy Tileset (FREE)
|
||||||
|
"Background Assets by Gumpy Function (gumpyfunction.itch.io)"
|
||||||
|
[Tiles Background Assets by Gumpy Function](https://gumpyfunction.itch.io/game-boy-rpg-fantasy-tileset-free)
|
||||||
|
|
||||||
|
Converties en niveau de gris avec Gimp
|
56
assets-fx/converters.py
Normal file
56
assets-fx/converters.py
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
from random import randint
|
||||||
|
import fxconv
|
||||||
|
import json
|
||||||
|
import pathlib
|
||||||
|
import csv
|
||||||
|
|
||||||
|
def convert(input, output, params, target):
|
||||||
|
if params["custom-type"] == "map":
|
||||||
|
convert_map(input, output, params, target)
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def convert_map(input, output, params, target):
|
||||||
|
data = json.load(open(input, "r"))
|
||||||
|
|
||||||
|
#find the tileset in use. it's a relative path (like ../tileset.tsx)
|
||||||
|
nameTileset = data["tilesets"][0]["source"].replace(".tsx","")
|
||||||
|
print(nameTileset)
|
||||||
|
#the name of the tileset without the .something
|
||||||
|
nameTilesetFree = nameTileset.split("/")[-1]
|
||||||
|
#count the number of "back" (cd ..) to locate the tileset on the computer
|
||||||
|
nbRetour = nameTileset.count("..")+1
|
||||||
|
#create the tileset absolute path
|
||||||
|
tilesetPath = "/".join(input.split("/")[:-nbRetour]) + "/" + nameTileset + ".json"
|
||||||
|
|
||||||
|
tileset = open(tilesetPath, "r")
|
||||||
|
data_tileset = json.load(tileset)
|
||||||
|
tileset_size = data_tileset.get("columns")
|
||||||
|
tileset.close()
|
||||||
|
|
||||||
|
|
||||||
|
#Extract from the json the width, height
|
||||||
|
w, h = data["width"], data["height"]
|
||||||
|
|
||||||
|
#nbTileLayer is the number of "true" layers (without ObjectsLayer)
|
||||||
|
nbTilelayer = ["data" in i for i in data["layers"]].count(True)
|
||||||
|
|
||||||
|
structMap = fxconv.Structure()
|
||||||
|
|
||||||
|
structMap += fxconv.u32(w) + fxconv.u32(h) + fxconv.u32(nbTilelayer)
|
||||||
|
structMap += fxconv.ref(f"img_{nameTilesetFree}")
|
||||||
|
structMap += fxconv.u32(tileset_size)
|
||||||
|
|
||||||
|
#generate the array of tiles from the layer
|
||||||
|
for i in range(nbTilelayer):
|
||||||
|
layer_data = bytes()
|
||||||
|
layer = data["layers"][i]
|
||||||
|
for tile in layer["data"]:
|
||||||
|
layer_data += fxconv.u16(tile-1)
|
||||||
|
|
||||||
|
structMap += fxconv.ptr(layer_data)
|
||||||
|
|
||||||
|
#generate !
|
||||||
|
fxconv.elf(structMap, output, "_" + params["name"], **target)
|
||||||
|
|
3
assets-fx/fxconv-metadata.txt
Normal file
3
assets-fx/fxconv-metadata.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
example.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: img_example
|
BIN
assets-fx/icon.png
Normal file
BIN
assets-fx/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
7
assets-fx/levels/fxconv-metadata.txt
Normal file
7
assets-fx/levels/fxconv-metadata.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
*.json:
|
||||||
|
custom-type: map
|
||||||
|
name_regex: (.*)\.json map_\1
|
||||||
|
|
||||||
|
tileset.png:
|
||||||
|
type: bopti-image
|
||||||
|
name: img_tilesetnpp
|
44
assets-fx/levels/level0.json
Normal file
44
assets-fx/levels/level0.json
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{ "compressionlevel":-1,
|
||||||
|
"height":24,
|
||||||
|
"infinite":false,
|
||||||
|
"layers":[
|
||||||
|
{
|
||||||
|
"data":[257, 297, 298, 299, 300, 257, 386, 297, 298, 299, 300, 0, 0, 0, 0, 0, 257, 0, 0, 225, 226, 227, 228, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 205, 229, 205, 229, 280, 179, 180, 179, 156, 156, 156, 158, 157, 179, 180, 253, 0, 0, 249, 250, 251, 252, 225, 226, 227, 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 301, 125, 126, 127, 128, 0, 385, 303, 350, 351, 303, 0, 0, 0, 350, 351, 301, 0, 0, 273, 274, 275, 276, 249, 250, 251, 252, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 325, 149, 150, 151, 152, 0, 0, 327, 374, 375, 327, 0, 184, 185, 374, 375, 325, 0, 279, 297, 298, 299, 300, 273, 274, 275, 276, 225, 226, 227, 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 257, 0, 0, 385, 0, 0, 385, 0, 265, 266, 0, 0, 208, 209, 352, 353, 257, 0, 302, 0, 130, 129, 166, 297, 298, 299, 300, 249, 250, 251, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 281, 176, 0, 0, 278, 0, 0, 385, 289, 290, 0, 0, 232, 233, 376, 377, 281, 0, 326, 0, 154, 153, 190, 201, 202, 203, 204, 273, 274, 275, 276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 202, 203, 204, 302, 385, 0, 0, 265, 266, 0, 385, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 225, 226, 227, 228, 297, 298, 299, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225, 226, 227, 228, 326, 0, 385, 0, 265, 266, 0, 0, 0, 0, 214, 215, 0, 0, 0, 0, 0, 0, 190, 249, 250, 251, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 249, 250, 251, 252, 201, 202, 203, 204, 289, 290, 0, 258, 259, 260, 238, 239, 260, 260, 261, 262, 262, 263, 264, 273, 274, 275, 276, 0, 93, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 273, 274, 275, 276, 225, 226, 227, 228, 265, 266, 0, 282, 283, 284, 285, 285, 285, 285, 285, 285, 286, 287, 288, 297, 298, 299, 300, 0, 117, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, 298, 299, 300, 249, 250, 251, 252, 290, 0, 0, 306, 307, 308, 309, 308, 309, 308, 309, 310, 310, 311, 312, 131, 0, 339, 340, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 203, 204, 386, 273, 274, 275, 276, 0, 0, 0, 330, 331, 332, 333, 332, 333, 332, 333, 334, 334, 335, 336, 132, 0, 363, 364, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 227, 228, 386, 297, 298, 299, 300, 0, 290, 0, 162, 163, 164, 165, 162, 163, 164, 165, 162, 163, 164, 165, 132, 0, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 251, 252, 0, 0, 0, 0, 0, 0, 0, 0, 86, 87, 88, 89, 186, 187, 188, 189, 86, 87, 88, 89, 132, 0, 225, 226, 227, 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 274, 275, 276, 0, 270, 271, 271, 271, 272, 0, 0, 110, 111, 112, 113, 210, 211, 212, 213, 110, 111, 112, 113, 133, 0, 249, 250, 251, 252, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 298, 299, 300, 0, 294, 1, 1, 1, 296, 0, 0, 136, 137, 0, 0, 234, 290, 265, 237, 0, 0, 339, 340, 0, 0, 273, 274, 275, 276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 203, 204, 0, 294, 1, 1, 1, 296, 0, 0, 160, 161, 265, 266, 266, 265, 266, 0, 0, 0, 363, 364, 0, 0, 297, 298, 299, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 227, 228, 0, 318, 319, 319, 319, 320, 0, 0, 0, 0, 289, 290, 265, 266, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 251, 252, 0, 0, 0, 0, 0, 0, 385, 386, 0, 0, 265, 265, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 274, 275, 276, 201, 202, 203, 204, 257, 0, 0, 0, 257, 0, 265, 265, 0, 257, 0, 0, 0, 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 298, 299, 300, 225, 226, 227, 228, 253, 205, 229, 205, 253, 0, 290, 265, 0, 253, 205, 229, 205, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 386, 249, 250, 251, 252, 345, 346, 347, 348, 277, 0, 265, 266, 0, 301, 386, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 203, 204, 273, 274, 275, 276, 369, 370, 371, 372, 301, 0, 289, 290, 0, 325, 387, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 227, 228, 297, 298, 299, 300, 393, 394, 395, 396, 325, 0, 265, 266, 0, 301, 386, 0, 0, 0, 0, 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
"height":24,
|
||||||
|
"id":1,
|
||||||
|
"name":"Background",
|
||||||
|
"opacity":1,
|
||||||
|
"type":"tilelayer",
|
||||||
|
"visible":true,
|
||||||
|
"width":48,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
"height":24,
|
||||||
|
"id":2,
|
||||||
|
"name":"Foreground",
|
||||||
|
"opacity":1,
|
||||||
|
"type":"tilelayer",
|
||||||
|
"visible":true,
|
||||||
|
"width":48,
|
||||||
|
"x":0,
|
||||||
|
"y":0
|
||||||
|
}],
|
||||||
|
"nextlayerid":3,
|
||||||
|
"nextobjectid":1,
|
||||||
|
"orientation":"orthogonal",
|
||||||
|
"renderorder":"right-down",
|
||||||
|
"tiledversion":"1.8.0",
|
||||||
|
"tileheight":8,
|
||||||
|
"tilesets":[
|
||||||
|
{
|
||||||
|
"firstgid":1,
|
||||||
|
"source":"tilesetnpp.tsx"
|
||||||
|
}],
|
||||||
|
"tilewidth":8,
|
||||||
|
"type":"map",
|
||||||
|
"version":"1.8",
|
||||||
|
"width":48
|
||||||
|
}
|
60
assets-fx/levels/level0.tmx
Normal file
60
assets-fx/levels/level0.tmx
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.8" tiledversion="1.8.0" orientation="orthogonal" renderorder="right-down" width="48" height="24" tilewidth="8" tileheight="8" infinite="0" nextlayerid="3" nextobjectid="1">
|
||||||
|
<tileset firstgid="1" source="tilesetnpp.tsx"/>
|
||||||
|
<layer id="1" name="Background" width="48" height="24">
|
||||||
|
<data encoding="csv">
|
||||||
|
257,297,298,299,300,257,386,297,298,299,300,0,0,0,0,0,257,0,0,225,226,227,228,201,202,203,204,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
253,205,229,205,229,280,179,180,179,156,156,156,158,157,179,180,253,0,0,249,250,251,252,225,226,227,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
301,125,126,127,128,0,385,303,350,351,303,0,0,0,350,351,301,0,0,273,274,275,276,249,250,251,252,201,202,203,204,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
325,149,150,151,152,0,0,327,374,375,327,0,184,185,374,375,325,0,279,297,298,299,300,273,274,275,276,225,226,227,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
257,0,0,385,0,0,385,0,265,266,0,0,208,209,352,353,257,0,302,0,130,129,166,297,298,299,300,249,250,251,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
281,176,0,0,278,0,0,385,289,290,0,0,232,233,376,377,281,0,326,0,154,153,190,201,202,203,204,273,274,275,276,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
201,202,203,204,302,385,0,0,265,266,0,385,0,0,0,0,0,0,0,0,0,0,166,225,226,227,228,297,298,299,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
225,226,227,228,326,0,385,0,265,266,0,0,0,0,214,215,0,0,0,0,0,0,190,249,250,251,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
249,250,251,252,201,202,203,204,289,290,0,258,259,260,238,239,260,260,261,262,262,263,264,273,274,275,276,0,93,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
273,274,275,276,225,226,227,228,265,266,0,282,283,284,285,285,285,285,285,285,286,287,288,297,298,299,300,0,117,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
297,298,299,300,249,250,251,252,290,0,0,306,307,308,309,308,309,308,309,310,310,311,312,131,0,339,340,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
202,203,204,386,273,274,275,276,0,0,0,330,331,332,333,332,333,332,333,334,334,335,336,132,0,363,364,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
226,227,228,386,297,298,299,300,0,290,0,162,163,164,165,162,163,164,165,162,163,164,165,132,0,201,202,203,204,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
250,251,252,0,0,0,0,0,0,0,0,86,87,88,89,186,187,188,189,86,87,88,89,132,0,225,226,227,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
274,275,276,0,270,271,271,271,272,0,0,110,111,112,113,210,211,212,213,110,111,112,113,133,0,249,250,251,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
298,299,300,0,294,1,1,1,296,0,0,136,137,0,0,234,290,265,237,0,0,339,340,0,0,273,274,275,276,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
202,203,204,0,294,1,1,1,296,0,0,160,161,265,266,266,265,266,0,0,0,363,364,0,0,297,298,299,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
226,227,228,0,318,319,319,319,320,0,0,0,0,289,290,265,266,290,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
250,251,252,0,0,0,0,0,0,385,386,0,0,265,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
274,275,276,201,202,203,204,257,0,0,0,257,0,265,265,0,257,0,0,0,257,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
298,299,300,225,226,227,228,253,205,229,205,253,0,290,265,0,253,205,229,205,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,386,249,250,251,252,345,346,347,348,277,0,265,266,0,301,386,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
202,203,204,273,274,275,276,369,370,371,372,301,0,289,290,0,325,387,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
226,227,228,297,298,299,300,393,394,395,396,325,0,265,266,0,301,386,0,0,0,0,257,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<layer id="2" name="Foreground" width="48" height="24">
|
||||||
|
<data encoding="csv">
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
BIN
assets-fx/levels/tileset.png
Normal file
BIN
assets-fx/levels/tileset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
14
assets-fx/levels/tilesetnpp.json
Normal file
14
assets-fx/levels/tilesetnpp.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ "columns":24,
|
||||||
|
"image":"tileset.png",
|
||||||
|
"imageheight":136,
|
||||||
|
"imagewidth":192,
|
||||||
|
"margin":0,
|
||||||
|
"name":"tileset",
|
||||||
|
"spacing":0,
|
||||||
|
"tilecount":408,
|
||||||
|
"tiledversion":"1.8.0",
|
||||||
|
"tileheight":8,
|
||||||
|
"tilewidth":8,
|
||||||
|
"type":"tileset",
|
||||||
|
"version":"1.8"
|
||||||
|
}
|
4
assets-fx/levels/tilesetnpp.tsx
Normal file
4
assets-fx/levels/tilesetnpp.tsx
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<tileset version="1.10" tiledversion="1.10.1" name="tileset" tilewidth="8" tileheight="8" tilecount="408" columns="24">
|
||||||
|
<image source="tileset.png" width="192" height="136"/>
|
||||||
|
</tileset>
|
25
src/main.c
Normal file
25
src/main.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include <gint/display.h>
|
||||||
|
#include <gint/keyboard.h>
|
||||||
|
#include <gint/gray.h>
|
||||||
|
#include "map.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
dclear(C_WHITE);
|
||||||
|
|
||||||
|
dgray( DGRAY_ON );
|
||||||
|
|
||||||
|
RenderMap();
|
||||||
|
|
||||||
|
dupdate();
|
||||||
|
|
||||||
|
getkey();
|
||||||
|
return 1;
|
||||||
|
}
|
27
src/map.c
Normal file
27
src/map.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include "map.h"
|
||||||
|
#include <gint/display.h>
|
||||||
|
|
||||||
|
extern struct Map map_level0;
|
||||||
|
|
||||||
|
struct Map *map_level = &map_level0;
|
||||||
|
|
||||||
|
void RenderMap(void)
|
||||||
|
{
|
||||||
|
for (int u = 0; u < map_level->nblayers; u++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < map_level->w; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < map_level->h; j++)
|
||||||
|
{
|
||||||
|
uint16_t index = j * map_level->w + i;
|
||||||
|
int16_t currentTile = map_level->layers[u][index];
|
||||||
|
if (currentTile != -1)
|
||||||
|
{
|
||||||
|
uint16_t xtile = (currentTile % map_level->tileset_size) * 8;
|
||||||
|
uint16_t ytile = (currentTile / map_level->tileset_size) * 8;
|
||||||
|
dsubimage(i * 8, j * 8, map_level->tileset, xtile, ytile, 8, 8, DIMAGE_NONE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
src/map.h
Normal file
25
src/map.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef MAP_H
|
||||||
|
#define MAP_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <gint/display.h>
|
||||||
|
|
||||||
|
|
||||||
|
void RenderMap(void);
|
||||||
|
|
||||||
|
|
||||||
|
struct Map {
|
||||||
|
/*width, height and the number of layer of the map*/
|
||||||
|
int w, h, nblayers;
|
||||||
|
|
||||||
|
/*the tileset to use*/
|
||||||
|
bopti_image_t *tileset;
|
||||||
|
int tileset_size;
|
||||||
|
|
||||||
|
/*list of all the tiles*/
|
||||||
|
short *layers[];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue