Your cmake file should be like this:
cmake_minimum_required(VERSION 3.25)
project(MyGame)
set(CMAKE_CXX_STANDARD 17)
set(TILENGINE_PATH "tilengine")
include_directories(${TILENGINE_PATH}/include)
link_directories(${TILENGINE_PATH}/lib/x64)
add_executable(MyGame main.cpp)
target_link_libraries(MyGame Tilengine)
Ensure that you've the following paths:
Yes, you need ALL these DLLs, if you don't, your program will not run. (links provided here https://github.com/megamarc/Tilengine/tree/master#windows )
Also, you can find the files "smw_sprite.png" and "smw_sprite.txt" in the github repository.
You can test with this source:
#include <iostream>
#include "Tilengine.h"
int main() {
std::cout << "Hello, World!" << std::endl;
TLN_Spriteset character;
TLN_Init (400,240,4,64,3);
TLN_CreateWindow (NULL, 0);
TLN_SetLoadPath(".");
character = TLN_LoadSpriteset("smw_sprite");
TLN_SetSpriteSet(0, character);
TLN_SetSpritePosition(0, 200, 120);
int x=200;
int y=120;
while (TLN_ProcessWindow()) {
if(TLN_GetInput(INPUT_RIGHT)){
x=x+1;
TLN_SetSpritePosition(0, x, y);
}
TLN_DrawFrame(0);
}
TLN_DeleteSpriteset(character);
TLN_Deinit ();
return 0;
}
When running, you will see a black screen. That's a bug. Press alt + enter to go full screen, then the sprite will appear. Once you see the sprite, you can move it right by pressing the right key. (Certainly a bug)
The "smw_sprite.txt" file contains lines in this format:
sprite name
,horizontal offset
,vertical offset
,width
,height
So:
flower,2,3,4,5
Translates into:
flower sprite starts at offset 2 (horizontal), 3 (vertical) and span 4 pixels horizontally and 5 pixels vertically.
I didn't found that format in texture packer. So, here is the export template:
{% for sprite in allSprites %}{{ sprite.trimmedName }},{{ sprite.frameRect.x }},{{ sprite.frameRect.y }},{{ sprite.frameRect.width }},{{ sprite.frameRect.height }}
{% endfor %}
Refer to TexturePacker documentation for installation.