initial commit
358
Animal.cpp
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <SDL3/SDL_audio.h>
|
||||||
|
|
||||||
|
#include "Animal.h"
|
||||||
|
|
||||||
|
#include "embed.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
SkinsEmbed skins_embed;
|
||||||
|
|
||||||
|
Animal::Animal(string skin) {
|
||||||
|
move_time = 0;
|
||||||
|
animate_time = 0;
|
||||||
|
random_time = 0;
|
||||||
|
cur = 0;
|
||||||
|
viime_event = 0;
|
||||||
|
state_changed = false;
|
||||||
|
|
||||||
|
// set rand seed
|
||||||
|
SDL_srand(0);
|
||||||
|
|
||||||
|
readSkin(skin);
|
||||||
|
setSpecialState(drop);
|
||||||
|
}
|
||||||
|
|
||||||
|
Animal::~Animal() {
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface *Animal::readImg(string skin, string state_name, int num) {
|
||||||
|
SDL_Surface *pet;
|
||||||
|
embed_data *img_buf = skins_embed.getSkin(skin, state_name);
|
||||||
|
if (img_buf) { // load from embedded if exists
|
||||||
|
SDL_IOStream *io = SDL_IOFromConstMem(img_buf[num].data, img_buf[num].len);
|
||||||
|
if (io == NULL) {
|
||||||
|
SDL_Log("could not open io for pet: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
pet = IMG_Load_IO(io, true);
|
||||||
|
if (pet == NULL) {
|
||||||
|
SDL_Log("could not create pet surface: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stringstream file_name;
|
||||||
|
file_name << "skin/" << skin << "/" << state_name << "/" << (num + 1) << ".png";
|
||||||
|
pet = IMG_Load(file_name.str().c_str());
|
||||||
|
if (pet == NULL) {
|
||||||
|
SDL_Log("could not create pet surface: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SDL_CreateTexture can't handle palette formats, so check if needs converting
|
||||||
|
if (pet && pet->format <= SDL_PIXELFORMAT_INDEX8) {
|
||||||
|
SDL_Surface *tmp = pet;
|
||||||
|
pet = SDL_ConvertSurface(pet, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
SDL_DestroySurface(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pet && !SDL_ISPIXELFORMAT_ALPHA(pet->format)) {
|
||||||
|
/* Set the colorkey to the top-left pixel */
|
||||||
|
Uint8 r, g, b, a;
|
||||||
|
|
||||||
|
SDL_ReadSurfacePixel(pet, 0, 0, &r, &g, &b, &a);
|
||||||
|
SDL_SetSurfaceColorKey(pet, 1, SDL_MapSurfaceRGBA(pet, r, g, b, a));
|
||||||
|
}
|
||||||
|
|
||||||
|
return pet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::readSkin(string skin) {
|
||||||
|
|
||||||
|
string buf;
|
||||||
|
string key;
|
||||||
|
State feat;
|
||||||
|
char prev_chr;
|
||||||
|
|
||||||
|
states.clear();
|
||||||
|
special_states.clear();
|
||||||
|
random_states.clear();
|
||||||
|
|
||||||
|
special_states.resize(SPECIAL_STATE_LAST);
|
||||||
|
|
||||||
|
string params = skins_embed.getParams(skin);
|
||||||
|
if (params.length()) { // load from embedded if exists
|
||||||
|
for (string::iterator it = params.begin(); it != params.end(); ++it) {
|
||||||
|
readSkinStep(skin, *it, buf, key, feat, prev_chr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stringstream file_name;
|
||||||
|
file_name << "skin/" << skin << ".tsk";
|
||||||
|
FILE *tied = fopen(file_name.str().c_str(), "rb");
|
||||||
|
if (!tied) {
|
||||||
|
cout << "Skin file fail: " << file_name.str() << endl;
|
||||||
|
}
|
||||||
|
while(!feof(tied)) {
|
||||||
|
char chr = fgetc(tied);
|
||||||
|
readSkinStep(skin, chr, buf, key, feat, prev_chr);
|
||||||
|
}
|
||||||
|
fclose(tied);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!feat.name.empty()) {
|
||||||
|
readSkinFill(skin, feat);
|
||||||
|
|
||||||
|
feat.name.clear();
|
||||||
|
feat.sound.clear();
|
||||||
|
feat.sound_data.loop = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::readSkinStep(string skin, char chr, string &buf, string &key, State &feat, char &prev_chr) {
|
||||||
|
if (chr == '\n') {
|
||||||
|
if (prev_chr == '\n' && !feat.name.empty()) {
|
||||||
|
readSkinFill(skin, feat);
|
||||||
|
|
||||||
|
feat.name.clear();
|
||||||
|
feat.sound.clear();
|
||||||
|
feat.sound_data.loop = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == "name")
|
||||||
|
feat.name = buf;
|
||||||
|
if (key == "img_name")
|
||||||
|
feat.img_name = buf;
|
||||||
|
if (key == "count")
|
||||||
|
feat.count = atoi(buf.c_str());
|
||||||
|
if (key == "interval")
|
||||||
|
feat.interval = atoi(buf.c_str());
|
||||||
|
if (key == "x")
|
||||||
|
feat.x = atoi(buf.c_str());
|
||||||
|
if (key == "y")
|
||||||
|
feat.y = atoi(buf.c_str());
|
||||||
|
if (key == "sound")
|
||||||
|
feat.sound = buf.c_str();
|
||||||
|
if (key == "loop")
|
||||||
|
feat.sound_data.loop = atoi(buf.c_str());
|
||||||
|
buf.clear();
|
||||||
|
} else if (chr == '=') {
|
||||||
|
key = buf;
|
||||||
|
buf.clear();
|
||||||
|
} else {
|
||||||
|
buf.push_back(chr);
|
||||||
|
}
|
||||||
|
|
||||||
|
prev_chr = chr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::readSkinFill(string skin, State feat) {
|
||||||
|
states.push_back(feat);
|
||||||
|
|
||||||
|
// Load images to memory
|
||||||
|
cur_state = &states.back();
|
||||||
|
for (int x = 0; x < cur_state->count; x++) {
|
||||||
|
cur_state->imgs.push_back(NULL);
|
||||||
|
cur_state->imgs[x] = readImg(skin, cur_state->img_name, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (feat.sound.empty()) {
|
||||||
|
cur_state->sound_data.len = 0;
|
||||||
|
} else {
|
||||||
|
pair<unsigned char*, unsigned int> buf = skins_embed.getSound(skin, cur_state->img_name);
|
||||||
|
if (buf.first) { // load from embedded if exists
|
||||||
|
SDL_IOStream *io = SDL_IOFromConstMem(buf.first, buf.second);
|
||||||
|
if (io == NULL) {
|
||||||
|
SDL_Log("could not open io for sound: %s\n", SDL_GetError());
|
||||||
|
}
|
||||||
|
if (!SDL_LoadWAV_IO(io, true, &cur_state->sound_data.spec, &cur_state->sound_data.buf, &cur_state->sound_data.len)) {
|
||||||
|
SDL_Log("failed to load audio: %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stringstream file_name;
|
||||||
|
file_name << "skin/" << skin << "/" << cur_state->img_name << "/" << cur_state->sound;
|
||||||
|
if (!SDL_LoadWAV(file_name.str().c_str(), &cur_state->sound_data.spec, &cur_state->sound_data.buf, &cur_state->sound_data.len)) {
|
||||||
|
SDL_Log("failed to load audio %s: %s", file_name.str().c_str(), SDL_GetError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special state cases
|
||||||
|
cur_state->interruptable = true;
|
||||||
|
if (cur_state->name == "stay") {
|
||||||
|
cur_state->special = stay;
|
||||||
|
random_states.push_back(cur_state);
|
||||||
|
} else if (cur_state->name == "drop") {
|
||||||
|
cur_state->special = drop;
|
||||||
|
cur_state->interruptable = false;
|
||||||
|
} else if (cur_state->name == "jump") {
|
||||||
|
cur_state->special = jump;
|
||||||
|
random_states.push_back(cur_state);
|
||||||
|
cur_state->interruptable = false;
|
||||||
|
} else if (cur_state->name == "jump_end") {
|
||||||
|
cur_state->special = jump_end;
|
||||||
|
cur_state->interruptable = false;
|
||||||
|
} else if (cur_state->name == "flop") {
|
||||||
|
cur_state->special = flop;
|
||||||
|
} else if (cur_state->name == "hang") {
|
||||||
|
cur_state->special = hang;
|
||||||
|
cur_state->interruptable = false;
|
||||||
|
} else if (cur_state->name == "fast_right") {
|
||||||
|
cur_state->special = fast_right;
|
||||||
|
random_states.push_back(cur_state);
|
||||||
|
} else if (cur_state->name == "fast_left") {
|
||||||
|
cur_state->special = fast_left;
|
||||||
|
random_states.push_back(cur_state);
|
||||||
|
} else {
|
||||||
|
cur_state->special = NOTHING;
|
||||||
|
random_states.push_back(cur_state);
|
||||||
|
}
|
||||||
|
if (cur_state->special) {
|
||||||
|
special_states[cur_state->special] = cur_state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::move() {
|
||||||
|
disp_pos.x += cur_state->x;
|
||||||
|
disp_pos.y += cur_state->y;
|
||||||
|
|
||||||
|
// Don't go out of display on right side
|
||||||
|
if (disp_pos.x + getImage()->w > disp_pos.w) {
|
||||||
|
setSpecialState(stay);
|
||||||
|
if (disp_pos.y < getImage()->h - 150) {
|
||||||
|
setSpecialState(drop);
|
||||||
|
}
|
||||||
|
disp_pos.x = disp_pos.w - getImage()->w - 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Donät fo out of display on left side
|
||||||
|
if (disp_pos.x < 0) {
|
||||||
|
setSpecialState(stay);
|
||||||
|
if (disp_pos.y < disp_pos.h - 150) {
|
||||||
|
setSpecialState(drop);
|
||||||
|
}
|
||||||
|
disp_pos.x = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have jumped high enough
|
||||||
|
if (disp_pos.y < disp_pos.h - 300 && cur_state->name == "jump") {
|
||||||
|
setSpecialState(jump_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if if hit the ground
|
||||||
|
if (disp_pos.y >= disp_pos.h - 150) {
|
||||||
|
if (cur_state->name == "jump_end") {
|
||||||
|
setSpecialState(stay);
|
||||||
|
} else if (cur_state->name == "drop") {
|
||||||
|
setSpecialState(flop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::animate(bool reset){
|
||||||
|
if (reset) {
|
||||||
|
animation_i = 0;
|
||||||
|
} else if (animation_i >= cur_state->count - 1) {
|
||||||
|
animation_i = 0;
|
||||||
|
} else {
|
||||||
|
animation_i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::shuffle() {
|
||||||
|
// Check if we are in a cur_state where we can't do anything
|
||||||
|
if (cur_state->interruptable) {
|
||||||
|
int lot = SDL_rand(random_states.size());
|
||||||
|
setState(random_states[lot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::setState(State *s) {
|
||||||
|
cur_state = s;
|
||||||
|
cur_state->sound_data.is_played = false;
|
||||||
|
animate(true);
|
||||||
|
state_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::setSpecialState(SpecialState s) {
|
||||||
|
//SDL_Log("special_state %d", s);
|
||||||
|
cur_state = special_states[s];
|
||||||
|
//SDL_Log("cur_state %x", cur_state);
|
||||||
|
cur_state->sound_data.is_played = false;
|
||||||
|
animate(true);
|
||||||
|
state_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::resetTimes(Uint64 t) {
|
||||||
|
move_time = random_time = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint64 Animal::step(Uint64 cur, bool press) {
|
||||||
|
if (!press && cur >= move_time) {
|
||||||
|
move();
|
||||||
|
move_time += 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cur >= animate_time) {
|
||||||
|
animate(false);
|
||||||
|
animate_time += cur_state->interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!press && cur >= random_time) {
|
||||||
|
shuffle();
|
||||||
|
random_time += 1000 * 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint64 lowest_time = move_time;
|
||||||
|
if (lowest_time > animate_time) lowest_time = animate_time;
|
||||||
|
if (lowest_time > random_time) lowest_time = random_time;
|
||||||
|
|
||||||
|
if (lowest_time < cur) {
|
||||||
|
lowest_time = cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lowest_time - cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface *Animal::getImage() {
|
||||||
|
return cur_state->imgs[animation_i];
|
||||||
|
}
|
||||||
|
|
||||||
|
SoundData *Animal::getSound() {
|
||||||
|
return &cur_state->sound_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Animal::hasStateChanged() {
|
||||||
|
if (state_changed) {
|
||||||
|
state_changed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animal::shouldRunAway(char dir) {
|
||||||
|
// Check if we are in a cur_state where we can't do anything
|
||||||
|
if (cur_state->interruptable) {
|
||||||
|
if (dir == 1) {
|
||||||
|
if (cur_state->special != fast_right) {
|
||||||
|
setSpecialState(fast_right);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (cur_state->special != fast_left) {
|
||||||
|
setSpecialState(fast_left);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface *Animal::getPreviewSurface() {
|
||||||
|
if (special_states[stay]->imgs.size()) {
|
||||||
|
return special_states[stay]->imgs[0];
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
75
Animal.h
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#ifndef ANIMAL_H
|
||||||
|
#define ANIMAL_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_image/SDL_image.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "SoundData.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// These States have something special logic in code (other than just randomly picked)
|
||||||
|
enum SpecialState { NOTHING, stay, drop, jump, jump_end, flop, hang, fast_right, fast_left, SPECIAL_STATE_LAST };
|
||||||
|
|
||||||
|
|
||||||
|
class State {
|
||||||
|
public:
|
||||||
|
string name;
|
||||||
|
string img_name;
|
||||||
|
int count;
|
||||||
|
int interval;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
string sound;
|
||||||
|
SpecialState special;
|
||||||
|
bool interruptable;
|
||||||
|
|
||||||
|
vector<SDL_Surface *> imgs;
|
||||||
|
SoundData sound_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Animal {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Animal(string skin);
|
||||||
|
~Animal();
|
||||||
|
SDL_Surface *readImg(string skin, string state_name, int num);
|
||||||
|
void readSkin(string file);
|
||||||
|
void readSkinStep(string skin, char chr, string &buf, string &key, State &state, char &prev_chr);
|
||||||
|
void readSkinFill(string skin, State state);
|
||||||
|
void createShape(int num, int w, int h);
|
||||||
|
void move();
|
||||||
|
void animate(bool reset);
|
||||||
|
void shuffle();
|
||||||
|
void setState(State *s);
|
||||||
|
void setSpecialState(SpecialState s);
|
||||||
|
void resetTimes(Uint64 t);
|
||||||
|
Uint64 step(Uint64 cur, bool press);
|
||||||
|
SDL_Surface *getImage();
|
||||||
|
SoundData *getSound();
|
||||||
|
bool hasStateChanged();
|
||||||
|
void shouldRunAway(char dir);
|
||||||
|
SDL_Surface *getPreviewSurface();
|
||||||
|
|
||||||
|
SDL_Rect disp_pos; // has display width and height and window posiion on it
|
||||||
|
|
||||||
|
vector<State> states;
|
||||||
|
vector<State *> special_states;
|
||||||
|
State *cur_state;
|
||||||
|
vector<State *> random_states;
|
||||||
|
|
||||||
|
int animation_i;
|
||||||
|
|
||||||
|
Uint64 move_time;
|
||||||
|
Uint64 animate_time;
|
||||||
|
Uint64 random_time;
|
||||||
|
Uint64 cur;
|
||||||
|
bool viime_event;
|
||||||
|
bool state_changed;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
122
INSTALL.mingw32-linux
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
On Arch Linux:
|
||||||
|
|
||||||
|
yay -S mingw-w64-environment mingw-w64-pkg-config mingw-w64-make mingw-w64-cmake mingw-w64-sdl3
|
||||||
|
|
||||||
|
PKGBUILD like this for mingw-w64-sdl3_ttf-git:
|
||||||
|
------------------------------------
|
||||||
|
pkgname=mingw-w64-sdl3_ttf-git
|
||||||
|
pkgver=r1011.582c695
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Support for TrueType (.ttf) font files with Simple Directmedia Layer (Version 3)"
|
||||||
|
arch=('any')
|
||||||
|
url="https://github.com/libsdl-org/SDL_ttf.git"
|
||||||
|
license=('Zlib')
|
||||||
|
depends=('mingw-w64-crt')
|
||||||
|
makedepends=('mingw-w64-cmake' 'ninja')
|
||||||
|
source=("git+https://github.com/libsdl-org/SDL_ttf")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
provides=('mingw-w64-sdl3_ttf')
|
||||||
|
conflicts=('mingw-w64-sdl3_ttf')
|
||||||
|
options=('!debug' '!buildflags' '!strip' 'staticlibs')
|
||||||
|
|
||||||
|
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "${srcdir}/SDL_ttf"
|
||||||
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/SDL_ttf"
|
||||||
|
cd external
|
||||||
|
./download.sh
|
||||||
|
cd ..
|
||||||
|
#cmake -B build -D SDLTTF_SAMPLES=OFF -D CMAKE_INSTALL_PREFIX=/usr
|
||||||
|
#cmake --build build
|
||||||
|
for _arch in ${_architectures}; do
|
||||||
|
BUILD_OPTS=("-DCMAKE_INSTALL_PREFIX=/usr/${_arch}"
|
||||||
|
'-DSDLTTF_SAMPLES=OFF'
|
||||||
|
'-DSDLTTF_VENDORED=ON')
|
||||||
|
|
||||||
|
${_arch}-cmake -B build/${_arch}-static -G Ninja \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
${BUILD_OPTS[@]}
|
||||||
|
|
||||||
|
${_arch}-cmake -B build/${_arch} -G Ninja \
|
||||||
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
|
${BUILD_OPTS[@]}
|
||||||
|
|
||||||
|
cmake --build build/${_arch}-static
|
||||||
|
cmake --build build/${_arch}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/SDL_ttf"
|
||||||
|
#DESTDIR="${pkgdir}" cmake --install build
|
||||||
|
for _arch in ${_architectures}; do
|
||||||
|
DESTDIR="${pkgdir}" cmake --install build/${_arch}-static
|
||||||
|
DESTDIR="${pkgdir}" cmake --install build/${_arch}
|
||||||
|
${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
|
||||||
|
${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
|
||||||
|
done
|
||||||
|
}
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PKGBUILD like tihs for mingw-w64-sdl3_image-git:
|
||||||
|
------------------------------------
|
||||||
|
pkgname=mingw-w64-sdl3_image-git
|
||||||
|
pkgver=r1563.0d418a2
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Image decoding for many popular formats for Simple Directmedia Layer (Version 3)"
|
||||||
|
arch=('any')
|
||||||
|
url="https://github.com/libsdl-org/SDL_image.git"
|
||||||
|
license=('Zlib')
|
||||||
|
depends=('mingw-w64-cmake' 'ninja' )
|
||||||
|
source=("git+https://github.com/libsdl-org/SDL_image")
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
provides=('mingw-w64-sdl3_image')
|
||||||
|
conflicts=('mingw-w64-sdl3_image')
|
||||||
|
options=('!debug' '!buildflags' '!strip' 'staticlibs')
|
||||||
|
|
||||||
|
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "${srcdir}/SDL_image"
|
||||||
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/SDL_image"
|
||||||
|
#cmake -B build -D CMAKE_INSTALL_PREFIX=/usr
|
||||||
|
#cmake --build build
|
||||||
|
|
||||||
|
for _arch in ${_architectures}; do
|
||||||
|
BUILD_OPTS=("-DCMAKE_INSTALL_PREFIX=/usr/${_arch}")
|
||||||
|
|
||||||
|
${_arch}-cmake -B build/${_arch}-static -G Ninja \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
${BUILD_OPTS[@]}
|
||||||
|
|
||||||
|
${_arch}-cmake -B build/${_arch} -G Ninja \
|
||||||
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
|
${BUILD_OPTS[@]}
|
||||||
|
|
||||||
|
cmake --build build/${_arch}-static
|
||||||
|
cmake --build build/${_arch}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/SDL_image"
|
||||||
|
#DESTDIR="${pkgdir}" cmake --install build
|
||||||
|
for _arch in ${_architectures}; do
|
||||||
|
DESTDIR="${pkgdir}" cmake --install build/${_arch}-static
|
||||||
|
DESTDIR="${pkgdir}" cmake --install build/${_arch}
|
||||||
|
${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
|
||||||
|
${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
|
||||||
|
done
|
||||||
|
}
|
||||||
|
------------------------------------
|
||||||
25
Makefile
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
CXX=g++
|
||||||
|
|
||||||
|
# needs "override" because x86_64-w64-mingw32-make sets these as cmdline parameters
|
||||||
|
override CXXFLAGS += -c -Wall -g
|
||||||
|
override LDFLAGS += $(shell pkg-config --libs sdl3 sdl3-ttf sdl3-image)
|
||||||
|
|
||||||
|
NEW_DIALOG_OBJECTS = Dialog Item Button Checkbox DropDownList Scrollbar Listbox Frame DlgDropDownList DlgMainMenu
|
||||||
|
OBJECTS=main Animal Sound $(addprefix NewDialogs/,$(NEW_DIALOG_OBJECTS))
|
||||||
|
EXECUTABLE=Rousku
|
||||||
|
|
||||||
|
all: $(EXECUTABLE)
|
||||||
|
|
||||||
|
$(EXECUTABLE): $(OBJECTS:%=%.o)
|
||||||
|
$(CXX) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
# pull in dependency info for *existing* .o files
|
||||||
|
-include $(OBJECTS:%=%.d)
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
$(CXX) -MM $(CXXFLAGS) $*.cpp > $*.d
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm `find . -name "*.o"` `find . -name "*.d"` $(EXECUTABLE)
|
||||||
26
Makefile.mingw
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
CXX=g++
|
||||||
|
|
||||||
|
# needs "override" because x86_64-w64-mingw32-make sets these as cmdline parameters
|
||||||
|
override CXXFLAGS += -c -Wall -static
|
||||||
|
override LDFLAGS += $(shell pkg-config --libs sdl3 sdl3-ttf sdl3-image) -lwinmm -lwindowsapp -lsetupapi -limm32 -lversion -lole32 -lmincore -luuid -static
|
||||||
|
|
||||||
|
NEW_DIALOG_OBJECTS = Dialog Item Button Checkbox DropDownList Scrollbar Listbox Frame DlgDropDownList DlgMainMenu
|
||||||
|
OBJECTS=main Animal Sound $(addprefix NewDialogs/,$(NEW_DIALOG_OBJECTS))
|
||||||
|
EXECUTABLE=Rousku
|
||||||
|
|
||||||
|
all: $(EXECUTABLE)
|
||||||
|
|
||||||
|
$(EXECUTABLE): $(OBJECTS:%=%.o)
|
||||||
|
$(RC) icon.rc icon.o
|
||||||
|
$(CXX) $^ icon.o $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
# pull in dependency info for *existing* .o files
|
||||||
|
-include $(OBJECTS:%=%.d)
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
$(CXX) -MM $(CXXFLAGS) $*.cpp > $*.d
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm `find . -name "*.o"` `find . -name "*.d"` $(EXECUTABLE)
|
||||||
205
NewDialogs/Button.cpp
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "../SDLHelpers.h"
|
||||||
|
|
||||||
|
#include "Button.h"
|
||||||
|
|
||||||
|
Button::Button(string text, SDL_Color color, SDL_Rect pos) : Item(pos) {
|
||||||
|
this->color = color;
|
||||||
|
this->text = text;
|
||||||
|
pressed = false;
|
||||||
|
selected = false;
|
||||||
|
toggle_selected = false;
|
||||||
|
button_func = NULL;
|
||||||
|
button_press_func = NULL;
|
||||||
|
button_release_func = NULL;
|
||||||
|
drawButton();
|
||||||
|
selectSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
Button::~Button() {
|
||||||
|
SDL_DestroySurface(button_up);
|
||||||
|
SDL_DestroySurface(button_down);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void Button::init() {
|
||||||
|
buttonPressed = false;
|
||||||
|
drawButton();
|
||||||
|
setSurface(buttonUp);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*void Button::destroy() {
|
||||||
|
SDL_FreeSurface(buttonUp);
|
||||||
|
SDL_FreeSurface(buttonDown);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
void Button::drawButton() {
|
||||||
|
//Uint32 color = 0xFFE6DCDC;
|
||||||
|
//SDL_Color color = 0xFFB4C8B4;
|
||||||
|
//Uint32 color = 0xFFB4B4C8;
|
||||||
|
SDL_Color color_reflection = color;
|
||||||
|
SDL_Color color_shadow = color;
|
||||||
|
color_reflection.r = (int) color_reflection.r + 50 < 255 ? color_reflection.r + 50 : 255;
|
||||||
|
color_reflection.g = (int) color_reflection.g + 50 < 255 ? color_reflection.g + 50 : 255;
|
||||||
|
color_reflection.b = (int) color_reflection.b + 50 < 255 ? color_reflection.b + 50 : 255;
|
||||||
|
color_shadow.r = (int) color_shadow.r - 50 > 0 ? color_shadow.r - 50 : 0;
|
||||||
|
color_shadow.g = (int) color_shadow.g - 50 > 0 ? color_shadow.g - 50 : 0;
|
||||||
|
color_shadow.b = (int) color_shadow.b - 50 > 0 ? color_shadow.b - 50 : 0;
|
||||||
|
|
||||||
|
int w = getPos()->w;
|
||||||
|
int h = getPos()->h;
|
||||||
|
button_up = SDL_CreateSurface(w, h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
button_down = SDL_CreateSurface(w, h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
Uint32 *p_up = (Uint32 *) button_up->pixels;
|
||||||
|
Uint32 *p_down = (Uint32 *) button_down->pixels;
|
||||||
|
SDL_Color color_up;
|
||||||
|
SDL_Color color_down;
|
||||||
|
for (int y = 0; y < h; y++) {
|
||||||
|
for (int x = 0; x < w; x++) {
|
||||||
|
if (y == 0 || y == h-1 || x == 0 || x == w-1) {
|
||||||
|
color_up.r = 0;
|
||||||
|
color_up.g = 0;
|
||||||
|
color_up.b = 0;
|
||||||
|
color_down = color_up;
|
||||||
|
} else if (y == 1 || x == 1) {
|
||||||
|
color_up = color_reflection;
|
||||||
|
color_down = color_shadow;
|
||||||
|
} else if (y == h-2 || x == w-2) {
|
||||||
|
color_up = color_shadow;
|
||||||
|
color_down = color_reflection;
|
||||||
|
} else {
|
||||||
|
color_up = color;
|
||||||
|
if ((y + x) % 2 == 0) {
|
||||||
|
color_down = color;
|
||||||
|
} else {
|
||||||
|
color_down.r = 255;
|
||||||
|
color_down.g = 255;
|
||||||
|
color_down.b = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p_up = SDL_MapRGB(SDL_GetPixelFormatDetails(button_up->format), NULL, color_up.r, color_up.g, color_up.b);
|
||||||
|
*p_down = SDL_MapRGB(SDL_GetPixelFormatDetails(button_down->format), NULL, color_down.r, color_down.g, color_down.b);
|
||||||
|
p_up++;
|
||||||
|
p_down++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Color text_color = {0, 0, 0};
|
||||||
|
vector<string> fonts;
|
||||||
|
fonts.push_back("DejaVuSans.ttf");
|
||||||
|
fonts.push_back("ariblk.ttf");
|
||||||
|
fonts.push_back("FreeSans.ttf");
|
||||||
|
fonts.push_back("arial.ttf");
|
||||||
|
TTF_Font *font = openFont(fonts, 10);
|
||||||
|
SDL_Surface *text_surface;
|
||||||
|
if (!font)
|
||||||
|
cout << "TTF_OpenFont is broken!" << endl;
|
||||||
|
if(!(text_surface = TTF_RenderText_Blended(font, text.c_str(), text.length(), text_color)))
|
||||||
|
cout << SDL_GetError() << endl;
|
||||||
|
SDL_Rect pos;
|
||||||
|
pos.x = button_up->w / 2 - text_surface->w / 2;
|
||||||
|
pos.y = button_up->h / 2 - text_surface->h / 2;
|
||||||
|
SDL_BlitSurface(text_surface, NULL, button_up, &pos);
|
||||||
|
SDL_BlitSurface(text_surface, NULL, button_down, &pos);
|
||||||
|
SDL_DestroySurface(text_surface);
|
||||||
|
TTF_CloseFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Button::onMousePress(int x, int y) {
|
||||||
|
bool isInX = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
bool isInY = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
if (isInX && isInY) {
|
||||||
|
pressed = true;
|
||||||
|
if (button_press_func) {
|
||||||
|
(*button_press_func)(p, this);
|
||||||
|
}
|
||||||
|
selectSurface();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::onMouseRelease(int x, int y) {
|
||||||
|
if (pressed) {
|
||||||
|
bool is_in_x = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
bool is_in_y = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
if (is_in_x && is_in_y) {
|
||||||
|
if (toggle_selected) {
|
||||||
|
selected = !selected;
|
||||||
|
}
|
||||||
|
if (button_func) {
|
||||||
|
(*button_func)(p, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (button_release_func) {
|
||||||
|
(*button_release_func)(p, this);
|
||||||
|
}
|
||||||
|
pressed = false;
|
||||||
|
selectSurface();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::onFingerDown(int x, int y, int finger_id) {
|
||||||
|
if (onMousePress(x, y)) {
|
||||||
|
this->finger_id = finger_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::onFingerUp(int x, int y, int finger_id) {
|
||||||
|
if (pressed && this->finger_id == finger_id) {
|
||||||
|
onMouseRelease(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setButtonFunc(void (*button_func)(void *p, Item *b), void *p) {
|
||||||
|
this->button_func = button_func;
|
||||||
|
this->p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setButtonPressFunc(void (*button_press_func)(void *p, Item *b), void *p) {
|
||||||
|
this->button_press_func = button_press_func;
|
||||||
|
this->p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setButtonReleaseFunc(void (*button_release_func)(void *p, Item *b), void *p) {
|
||||||
|
this->button_release_func = button_release_func;
|
||||||
|
this->p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setText(string text) {
|
||||||
|
this->text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Button::getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setColor(SDL_Color color) {
|
||||||
|
this->color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setSelected(bool selected) {
|
||||||
|
this->selected = selected;
|
||||||
|
selectSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Button::isSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::selectSurface() {
|
||||||
|
if (pressed) {
|
||||||
|
setSurface(button_down);
|
||||||
|
} else {
|
||||||
|
if (selected) {
|
||||||
|
setSurface(button_down);
|
||||||
|
} else {
|
||||||
|
setSurface(button_up);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
44
NewDialogs/Button.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#ifndef BUTTON_H
|
||||||
|
#define BUTTON_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
class Button : public Item {
|
||||||
|
protected:
|
||||||
|
string text;
|
||||||
|
SDL_Color color;
|
||||||
|
SDL_Surface *button_up;
|
||||||
|
SDL_Surface *button_down;
|
||||||
|
bool toggle_selected;
|
||||||
|
private:
|
||||||
|
bool pressed;
|
||||||
|
bool selected;
|
||||||
|
int finger_id;
|
||||||
|
void (*button_func)(void *p, Item *b);
|
||||||
|
void (*button_press_func)(void *p, Item *b);
|
||||||
|
void (*button_release_func)(void *p, Item *b);
|
||||||
|
void *p;
|
||||||
|
public:
|
||||||
|
//void init();
|
||||||
|
//void destroy();
|
||||||
|
Button(string text, SDL_Color color, SDL_Rect pos);
|
||||||
|
virtual ~Button();
|
||||||
|
virtual void drawButton();
|
||||||
|
bool onMousePress(int x, int y);
|
||||||
|
void onMouseRelease(int x, int y);
|
||||||
|
void onFingerDown(int x, int y, int finger_id);
|
||||||
|
void onFingerUp(int x, int y, int finger_id);
|
||||||
|
void setButtonFunc(void (*button_func)(void *p, Item *b), void *p);
|
||||||
|
void setButtonPressFunc(void (*button_press_func)(void *p, Item *b), void *p);
|
||||||
|
void setButtonReleaseFunc(void (*button_release_func)(void *p, Item *b), void *p);
|
||||||
|
void setText(string text);
|
||||||
|
string getText();
|
||||||
|
void setColor(SDL_Color color);
|
||||||
|
void setSelected(bool selected);
|
||||||
|
bool isSelected();
|
||||||
|
void selectSurface();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
117
NewDialogs/Checkbox.cpp
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "../SDLHelpers.h"
|
||||||
|
|
||||||
|
#include "Checkbox.h"
|
||||||
|
|
||||||
|
bool isBetween(float a, float b, float c) {
|
||||||
|
return a >= b && a < c;
|
||||||
|
}
|
||||||
|
|
||||||
|
Checkbox::Checkbox(string text, SDL_Color color, SDL_Rect pos) : Button(text, color, pos) {
|
||||||
|
//SDL_Color color;
|
||||||
|
//Button::Button(text, color, pos);
|
||||||
|
toggle_selected = true;
|
||||||
|
// Parent Button doesn't seem to call this but it's own drawButton. So doing it again for here. FIXME how to fix?
|
||||||
|
SDL_DestroySurface(button_up);
|
||||||
|
SDL_DestroySurface(button_down);
|
||||||
|
drawButton();
|
||||||
|
selectSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
Checkbox::~Checkbox() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Checkbox::drawButton() {
|
||||||
|
SDL_Color color_reflection = color;
|
||||||
|
SDL_Color color_shadow = color;
|
||||||
|
color_reflection.r = (int) color_reflection.r + 50 < 255 ? color_reflection.r + 50 : 255;
|
||||||
|
color_reflection.g = (int) color_reflection.g + 50 < 255 ? color_reflection.g + 50 : 255;
|
||||||
|
color_reflection.b = (int) color_reflection.b + 50 < 255 ? color_reflection.b + 50 : 255;
|
||||||
|
color_shadow.r = (int) color_shadow.r - 50 > 0 ? color_shadow.r - 50 : 0;
|
||||||
|
color_shadow.g = (int) color_shadow.g - 50 > 0 ? color_shadow.g - 50 : 0;
|
||||||
|
color_shadow.b = (int) color_shadow.b - 50 > 0 ? color_shadow.b - 50 : 0;
|
||||||
|
|
||||||
|
int w = getPos()->w;
|
||||||
|
int h = getPos()->h;
|
||||||
|
button_up = SDL_CreateSurface(w, h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
button_down = SDL_CreateSurface(w, h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
Uint32 *p_up = (Uint32 *) button_up->pixels;
|
||||||
|
Uint32 *p_down = (Uint32 *) button_down->pixels;
|
||||||
|
SDL_Color color_up;
|
||||||
|
SDL_Color color_down;
|
||||||
|
for (int y = 0; y < h; y++) {
|
||||||
|
for (int x = 0; x < w; x++) { // checkbox needs to be square so using height
|
||||||
|
float u = h / 12.0; // one unit (was 1 pixel in example image)
|
||||||
|
color_up.a = 0xff;
|
||||||
|
color_down.a = 0xff;
|
||||||
|
if (x > h) {
|
||||||
|
color_up.a = 0;
|
||||||
|
color_down.a = 0;
|
||||||
|
} else if (isBetween(y, h - u, h) || isBetween(x, h - u, h)) { // reflection
|
||||||
|
color_up.r = 0xd4;
|
||||||
|
color_up.g = 0xd0;
|
||||||
|
color_up.b = 0xc8;
|
||||||
|
color_down = color_up;
|
||||||
|
} else if (isBetween(y, 0, u) || isBetween(x, 0, u)) { // lighter shadow
|
||||||
|
color_up.r = 0x80;
|
||||||
|
color_up.g = 0x80;
|
||||||
|
color_up.b = 0x80;
|
||||||
|
color_down = color_up;
|
||||||
|
} else if (isBetween(y, u, u * 2) || isBetween(x, u, u * 2)) { // darker shadow
|
||||||
|
color_up.r = 0x40;
|
||||||
|
color_up.g = 0x40;
|
||||||
|
color_up.b = 0x40;
|
||||||
|
color_down = color_up;
|
||||||
|
} else {
|
||||||
|
color_up.r = 255;
|
||||||
|
color_up.g = 255;
|
||||||
|
color_up.b = 255;
|
||||||
|
color_down = color_up;
|
||||||
|
bool x_cond = isBetween(x, u * 3, 10 * u);
|
||||||
|
bool y_cond = isBetween(y, x + u * 1.5, x + u * 4.5);
|
||||||
|
float x_change_limit = 5.5 * u;
|
||||||
|
if (x >= x_change_limit) {
|
||||||
|
unsigned remaining_x = (x - x_change_limit);
|
||||||
|
y_cond = isBetween(y, u * 7 - remaining_x, u * 10 - remaining_x);
|
||||||
|
}
|
||||||
|
if (x_cond && y_cond) {
|
||||||
|
color_down.r = 0;
|
||||||
|
color_down.g = 0;
|
||||||
|
color_down.b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p_up = SDL_MapRGBA(SDL_GetPixelFormatDetails(button_up->format), NULL, color_up.r, color_up.g, color_up.b, color_up.a);
|
||||||
|
*p_down = SDL_MapRGBA(SDL_GetPixelFormatDetails(button_down->format), NULL, color_down.r, color_down.g, color_down.b, color_down.a);
|
||||||
|
p_up++;
|
||||||
|
p_down++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Color text_color = {0, 0, 0};
|
||||||
|
vector<string> fonts;
|
||||||
|
fonts.push_back("DejaVuSans.ttf");
|
||||||
|
fonts.push_back("ariblk.ttf");
|
||||||
|
fonts.push_back("FreeSans.ttf");
|
||||||
|
fonts.push_back("arial.ttf");
|
||||||
|
TTF_Font *font = openFont(fonts, 10);
|
||||||
|
SDL_Surface *text_surface;
|
||||||
|
if (!font) {
|
||||||
|
SDL_Log("TTF_OpenFont is broken!");
|
||||||
|
}
|
||||||
|
if(!(text_surface = TTF_RenderText_Blended(font, text.c_str(), text.length(), text_color))) {
|
||||||
|
SDL_Log("RenderText failed %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
SDL_Rect pos;
|
||||||
|
pos.x = button_up->h + 8;
|
||||||
|
pos.y = button_up->h / 2 - text_surface->h / 2;
|
||||||
|
SDL_BlitSurface(text_surface, NULL, button_up, &pos);
|
||||||
|
SDL_BlitSurface(text_surface, NULL, button_down, &pos);
|
||||||
|
SDL_DestroySurface(text_surface);
|
||||||
|
TTF_CloseFont(font);
|
||||||
|
}
|
||||||
14
NewDialogs/Checkbox.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef CHECKBOX_H
|
||||||
|
#define CHECKBOX_H
|
||||||
|
|
||||||
|
#include "Button.h"
|
||||||
|
|
||||||
|
class Checkbox : public Button {
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
Checkbox(string text, SDL_Color color, SDL_Rect pos);
|
||||||
|
virtual ~Checkbox();
|
||||||
|
virtual void drawButton() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
128
NewDialogs/Dialog.cpp
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3_image/SDL_image.h>
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
#include "Dialog.h"
|
||||||
|
|
||||||
|
bool Dialog::loadBackground(string name) {
|
||||||
|
background = IMG_Load(name.c_str());
|
||||||
|
if (!background)
|
||||||
|
return false;
|
||||||
|
surface = SDL_CreateSurface(background->w, background->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
SDL_Rect d;
|
||||||
|
d.x = 0;
|
||||||
|
d.y = 0;
|
||||||
|
d.w = background->w;
|
||||||
|
d.h = background->h;
|
||||||
|
SDL_SetSurfaceClipRect(surface, &d);
|
||||||
|
pos.w = background->w;
|
||||||
|
pos.h = background->h;
|
||||||
|
default_pos = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::addItem(Item *item) {
|
||||||
|
items.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::deleteItems() {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
delete items[z];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::needsRedraw() {
|
||||||
|
return true; // always drawing, only performance optimizaion on some dialogs which override this method
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::draw() {
|
||||||
|
if (background) {
|
||||||
|
SDL_BlitSurface(background, NULL, surface, NULL);
|
||||||
|
}
|
||||||
|
for (unsigned int x = 0; x < items.size(); x++) {
|
||||||
|
SDL_BlitSurface(items[x]->getSurface(), NULL, surface, items[x]->getPos());
|
||||||
|
items[x]->drawDone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface *Dialog::getSurface() {
|
||||||
|
if (needsRedraw()) {
|
||||||
|
draw();
|
||||||
|
}
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::deleteSurfaceAndBackground() {
|
||||||
|
delete background;
|
||||||
|
delete surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::onMousePress(int x, int y) {
|
||||||
|
if (x < 0 || y < 0 || x > surface->w || y > surface->h) {
|
||||||
|
exit = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onMousePress(x, y);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::onMouseRelease(int x, int y) {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onMouseRelease(x, y);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::onMouseMove(int x, int y) {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onMouseMove(x, y);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::onFingerDown(int x, int y, int finger_id) {
|
||||||
|
if (x < 0 || y < 0 || x > surface->w || y > surface->h) {
|
||||||
|
exit = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onFingerDown(x, y, finger_id);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::onFingerUp(int x, int y, int finger_id) {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onFingerUp(x, y, finger_id);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::setPos(SDL_Rect pos) {
|
||||||
|
this->pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Rect *Dialog::getPos() {
|
||||||
|
return &pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::setExit(bool exit) {
|
||||||
|
this->exit = exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::isExit() {
|
||||||
|
return exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialog::isDefaultPos() {
|
||||||
|
return default_pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::setDefaultPos(bool default_pos) {
|
||||||
|
this->default_pos = default_pos;
|
||||||
|
}
|
||||||
42
NewDialogs/Dialog.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#ifndef DIALOG_H
|
||||||
|
#define DIALOG_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
class Dialog {
|
||||||
|
protected:
|
||||||
|
SDL_Surface *surface;
|
||||||
|
SDL_Surface *background;
|
||||||
|
SDL_Rect pos;
|
||||||
|
vector<Item *> items;
|
||||||
|
private:
|
||||||
|
bool default_pos;
|
||||||
|
bool exit;
|
||||||
|
public:
|
||||||
|
bool loadBackground(string name);
|
||||||
|
void addItem(Item *item);
|
||||||
|
void deleteItems();
|
||||||
|
virtual bool needsRedraw();
|
||||||
|
virtual void draw();
|
||||||
|
SDL_Surface *getSurface();
|
||||||
|
void deleteSurfaceAndBackground();
|
||||||
|
virtual bool onMousePress(int x, int y);
|
||||||
|
virtual bool onMouseRelease(int x, int y);
|
||||||
|
virtual bool onMouseMove(int x, int y);
|
||||||
|
virtual bool onFingerDown(int x, int y, int finger_id);
|
||||||
|
virtual bool onFingerUp(int x, int y, int finger_id);
|
||||||
|
void setPos(SDL_Rect pos);
|
||||||
|
SDL_Rect *getPos();
|
||||||
|
void setExit(bool exit);
|
||||||
|
bool isExit();
|
||||||
|
bool isDefaultPos();
|
||||||
|
void setDefaultPos(bool default_pos);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
69
NewDialogs/DlgDropDownList.cpp
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_image/SDL_image.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "../SDLHelpers.h"
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
#include "Scrollbar.h"
|
||||||
|
#include "Listbox.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
|
#include "DlgDropDownList.h"
|
||||||
|
|
||||||
|
DlgDropDownList::DlgDropDownList(DropDownList *ddl, SDL_Rect pos, bool add_scrollbar) : Dialog() {
|
||||||
|
this->ddl = ddl;
|
||||||
|
this->pos = pos;
|
||||||
|
setDefaultPos(false);
|
||||||
|
|
||||||
|
background = SDL_CreateSurface(pos.w, pos.h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
memset((int *) background->pixels, 0xFFFFFFFF, pos.w * pos.h * 4);
|
||||||
|
surface = SDL_CreateSurface(background->w, background->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
|
||||||
|
int listbox_width = pos.w;
|
||||||
|
if (add_scrollbar)
|
||||||
|
listbox_width -= 18;
|
||||||
|
Item *listbox = new Listbox(ddl->getList(), ddl->getListboxItemSize(), getRect(0, 0, listbox_width, ddl->getListboxHeight()));
|
||||||
|
((Listbox *) listbox)->setValueChangedFunc(&listboxValueChangedCallback, (void *)this);
|
||||||
|
|
||||||
|
Item *item = new Frame(getRect(0, 0, listbox_width, pos.h));
|
||||||
|
((Frame *)item)->addItem(listbox);
|
||||||
|
addItem(item);
|
||||||
|
|
||||||
|
if (add_scrollbar) {
|
||||||
|
item = new Scrollbar(0, ddl->getListboxHeight() - pos.h, 0, getRect(pos.w - 18, 0, 18, pos.h));
|
||||||
|
((Scrollbar *) item)->setValueChangedFunc(&scrollbarValueChangedCallback, (void *)this);
|
||||||
|
addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
setExit(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
DlgDropDownList::~DlgDropDownList() {
|
||||||
|
deleteSurfaceAndBackground();
|
||||||
|
deleteItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgDropDownList::listboxValueChangedCallback(void *p) {
|
||||||
|
((DlgDropDownList *)p)->listboxValueChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgDropDownList::listboxValueChanged() {
|
||||||
|
int selected = ((Listbox *)((Frame *) items[0])->getItem(0))->getSelected();
|
||||||
|
ddl->setSelected(selected);
|
||||||
|
setExit(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgDropDownList::scrollbarValueChangedCallback(void *p) {
|
||||||
|
((DlgDropDownList *)p)->scrollbarValueChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgDropDownList::scrollbarValueChanged() {
|
||||||
|
int value = ((Scrollbar *) items[1])->getValue();
|
||||||
|
SDL_Rect *pos = ((Frame *) items[0])->getItem(0)->getPos();
|
||||||
|
pos->y = 0 - value;
|
||||||
|
}
|
||||||
19
NewDialogs/DlgDropDownList.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef DLG_DROP_DOWN_LIST
|
||||||
|
#define DLG_DROP_DOWN_LIST
|
||||||
|
|
||||||
|
#include "Dialog.h"
|
||||||
|
#include "DropDownList.h"
|
||||||
|
|
||||||
|
class DlgDropDownList : public Dialog {
|
||||||
|
private:
|
||||||
|
DropDownList *ddl;
|
||||||
|
public:
|
||||||
|
DlgDropDownList(DropDownList *ddl, SDL_Rect pos, bool add_scrollbar);
|
||||||
|
~DlgDropDownList();
|
||||||
|
static void listboxValueChangedCallback(void *p);
|
||||||
|
void listboxValueChanged();
|
||||||
|
static void scrollbarValueChangedCallback(void *p);
|
||||||
|
void scrollbarValueChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
287
NewDialogs/DlgMainMenu.cpp
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <utility>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_image/SDL_image.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
#include <SDL3/SDL_storage.h>
|
||||||
|
|
||||||
|
#include "../SDLHelpers.h"
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
#include "Button.h"
|
||||||
|
#include "Dialog.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
|
#include "DlgMainMenu.h"
|
||||||
|
|
||||||
|
#include "../menu_png.h"
|
||||||
|
|
||||||
|
SDL_EnumerationResult enumStorage(void *userdata, const char *dirname, const char *fname) {
|
||||||
|
SDL_Log("dirname %s fname %s", dirname, fname);
|
||||||
|
SDL_Storage *storage = (SDL_Storage *) ((pair<void *, void *> *)userdata)->first;
|
||||||
|
vector<string> *list = (vector<string> *) ((pair<void *, void *> *)userdata)->second;
|
||||||
|
string path("skin/");
|
||||||
|
path += fname;
|
||||||
|
SDL_PathInfo pi;
|
||||||
|
SDL_GetStoragePathInfo(storage, path.c_str(), &pi);
|
||||||
|
if (pi.type == SDL_PATHTYPE_DIRECTORY) {
|
||||||
|
SDL_Log("is dir");
|
||||||
|
// add name to list if list does not yet have it
|
||||||
|
if (find(list->begin(), list->end(), fname) == list->end()) {
|
||||||
|
list->push_back(fname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SDL_ENUM_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DlgMainMenu::DlgMainMenu() : Dialog() {
|
||||||
|
if (!loadBackground()) {
|
||||||
|
cerr << "Background open failed menu_png! " << SDL_GetError() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<string> list;
|
||||||
|
// adding embedded skins
|
||||||
|
list.push_back("Tavallinen");
|
||||||
|
list.push_back("Alppisusi");
|
||||||
|
list.push_back("Chibi");
|
||||||
|
|
||||||
|
SDL_Storage *storage = SDL_OpenTitleStorage(NULL, 0);
|
||||||
|
if (!storage) {
|
||||||
|
SDL_Log("Error opening title storage %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
pair<void *, void *> userdata(storage, &list);
|
||||||
|
if (!SDL_EnumerateStorageDirectory(storage, "skin", &enumStorage, &userdata)) {
|
||||||
|
SDL_Log("Error enumerating dir %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
|
||||||
|
always_on_top_checkbox = new Checkbox("Pysy päällimmäisenä", getColor(0, 0, 0), getRect(16, 24, 200, 12));
|
||||||
|
always_on_top_checkbox->setSelected(1);
|
||||||
|
always_on_top_checkbox->setButtonFunc(&settingsChangedCallback, (void *)this);
|
||||||
|
always_on_top_checkbox->setName("always_on_top");
|
||||||
|
addItem(always_on_top_checkbox);
|
||||||
|
|
||||||
|
enable_sound_checkbox = new Checkbox("Äänet päälle / pois päältä", getColor(0, 0, 0), getRect(16, 40, 200, 12));
|
||||||
|
enable_sound_checkbox->setSelected(1);
|
||||||
|
enable_sound_checkbox->setButtonFunc(&settingsChangedCallback, (void *)this);
|
||||||
|
enable_sound_checkbox->setName("enable_sound");
|
||||||
|
addItem(enable_sound_checkbox);
|
||||||
|
|
||||||
|
open_menu_on_start_checkbox = new Checkbox("Avaa valikko Rouskun käynnistyessä", getColor(0, 0, 0), getRect(16, 56, 200, 12));
|
||||||
|
open_menu_on_start_checkbox->setSelected(1);
|
||||||
|
open_menu_on_start_checkbox->setButtonFunc(&settingsChangedCallback, (void *)this);
|
||||||
|
open_menu_on_start_checkbox->setName("open_menu_on_start");
|
||||||
|
addItem(open_menu_on_start_checkbox);
|
||||||
|
|
||||||
|
run_away_from_mouse_checkbox = new Checkbox("Juokse hiirtä karkuun", getColor(0, 0, 0), getRect(16, 72, 200, 12));
|
||||||
|
run_away_from_mouse_checkbox->setSelected(0);
|
||||||
|
run_away_from_mouse_checkbox->setButtonFunc(&settingsChangedCallback, (void *)this);
|
||||||
|
run_away_from_mouse_checkbox->setName("run_away_from_mouse");
|
||||||
|
addItem(run_away_from_mouse_checkbox);
|
||||||
|
|
||||||
|
skin_list = new DropDownList(list, &dialogs, getRect(16, 104, 200, 25));
|
||||||
|
skin_list->setSelected(0);
|
||||||
|
skin_list->setValueChangedFunc(&settingsChangedCallback, (void *)this);
|
||||||
|
skin_list->setName("skin_list");
|
||||||
|
addItem(skin_list);
|
||||||
|
|
||||||
|
Item *item = new Button("Sulje valikko", getColor(0xB4, 0xC8, 0xB4), getRect(135, 320, 95, 27));
|
||||||
|
((Button *) item)->setButtonFunc(&contCallback, (void *)this);
|
||||||
|
addItem(item);
|
||||||
|
|
||||||
|
item = new Button("Sulje Rousku", getColor(0xC8, 0xB4, 0xB4), getRect(7, 320, 95, 27));
|
||||||
|
((Button *) item)->setButtonFunc(&quitCallback, (void *)this);
|
||||||
|
addItem(item);
|
||||||
|
|
||||||
|
readSettings();
|
||||||
|
setExit(false);
|
||||||
|
if (!open_menu_on_start_checkbox->isSelected()) {
|
||||||
|
setExit(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
app_exit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DlgMainMenu::~DlgMainMenu() {
|
||||||
|
deleteSurfaceAndBackground();
|
||||||
|
deleteItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::draw() {
|
||||||
|
Dialog::draw();
|
||||||
|
|
||||||
|
// Just drawing preview surface on dialog. Create own Item for preview if needed at some point.
|
||||||
|
if (preview_sfe) {
|
||||||
|
SDL_Rect r = { 57, 128, preview_sfe->w, preview_sfe->h };
|
||||||
|
SDL_BlitSurface(preview_sfe, NULL, surface, &r);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We just draw dialogs on this dialog's surface
|
||||||
|
for (unsigned int x = 0; x < dialogs.size(); x++) {
|
||||||
|
SDL_BlitSurface(dialogs[x]->getSurface(), NULL, surface, dialogs[x]->getPos());
|
||||||
|
//items[x]->drawDone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::onMousePress(int x, int y) {
|
||||||
|
// we are handling other dialogs as integrated to this dialog so passing our events to them
|
||||||
|
for (unsigned int z = 0; z < dialogs.size(); z++) {
|
||||||
|
dialogs[z]->onMousePress(x - dialogs[z]->getPos()->x, y - dialogs[z]->getPos()->y);
|
||||||
|
if (dialogs[z]->isExit()) {
|
||||||
|
delete dialogs[z];
|
||||||
|
dialogs[z] = NULL;
|
||||||
|
dialogs.erase(dialogs.begin()+z);
|
||||||
|
z--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Dialog::onMousePress(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::onMouseRelease(int x, int y) {
|
||||||
|
// we are handling other dialogs as integrated to this dialog so passing our events to them
|
||||||
|
for (unsigned int z = 0; z < dialogs.size(); z++) {
|
||||||
|
dialogs[z]->onMouseRelease(x - dialogs[z]->getPos()->x, y - dialogs[z]->getPos()->y);
|
||||||
|
}
|
||||||
|
return Dialog::onMouseRelease(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::readSettings() {
|
||||||
|
SDL_Storage *strg = SDL_OpenUserStorage("TeamSaunakauha", "Rousku", 0);
|
||||||
|
Uint64 file_size;
|
||||||
|
if (!SDL_GetStorageFileSize(strg, "mem.tsk", &file_size)) {
|
||||||
|
SDL_Log("could not get mem.tsk size %s", SDL_GetError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
char buf[file_size];
|
||||||
|
if (!SDL_ReadStorageFile(strg, "mem.tsk", buf, file_size)) {
|
||||||
|
SDL_Log("mem.tsk read failed %s", SDL_GetError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_CloseStorage(strg);
|
||||||
|
|
||||||
|
string sbuf(buf, file_size);
|
||||||
|
istringstream ssbuf(sbuf);
|
||||||
|
string line;
|
||||||
|
Uint8 lc = 0;
|
||||||
|
while (getline(ssbuf, line)) {
|
||||||
|
switch(lc++) {
|
||||||
|
case 0: always_on_top_checkbox->setSelected(line == "1"); break;
|
||||||
|
case 1: enable_sound_checkbox->setSelected(line == "1"); break;
|
||||||
|
case 2: open_menu_on_start_checkbox->setSelected(line == "1"); break;
|
||||||
|
case 3: run_away_from_mouse_checkbox->setSelected(line == "1"); break;
|
||||||
|
case 4: skin_list->select(line); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::writeSettings() {
|
||||||
|
stringstream ssbuf;
|
||||||
|
ssbuf << (always_on_top_checkbox->isSelected() ? 1 : 0) << endl;
|
||||||
|
ssbuf << (enable_sound_checkbox->isSelected() ? 1 : 0) << endl;
|
||||||
|
ssbuf << (open_menu_on_start_checkbox->isSelected() ? 1 : 0) << endl;
|
||||||
|
ssbuf << (run_away_from_mouse_checkbox->isSelected() ? 1 : 0) << endl;
|
||||||
|
ssbuf << skin_list->getString() << endl;
|
||||||
|
|
||||||
|
SDL_Storage *strg = SDL_OpenUserStorage("TeamSaunakauha", "Rousku", 0);
|
||||||
|
if (!SDL_WriteStorageFile(strg, "mem.tsk", ssbuf.str().c_str(), ssbuf.str().length())) {
|
||||||
|
SDL_Log("mem.tsk write failed %s", SDL_GetError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SDL_CloseStorage(strg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::contCallback(void *p, Item *i) {
|
||||||
|
((DlgMainMenu *)p)->cont();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::cont() {
|
||||||
|
setExit(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::quitCallback(void *p, Item *i) {
|
||||||
|
((DlgMainMenu *)p)->quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::quit() {
|
||||||
|
setAppExit(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::settingsChangedCallback(void *p, Item *i) {
|
||||||
|
((DlgMainMenu *)p)->settingsChanged(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::settingsChanged(Item *i) {
|
||||||
|
writeSettings();
|
||||||
|
if (i->getName().length()) {
|
||||||
|
settings_changed_list.push_back(i->getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::setAppExit(bool app_exit) {
|
||||||
|
this->app_exit = app_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::isAppExit() {
|
||||||
|
return app_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::isAlwaysOnTop() {
|
||||||
|
return always_on_top_checkbox->isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::isEnableSound() {
|
||||||
|
return enable_sound_checkbox->isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::isRunAwayFromMouse() {
|
||||||
|
return run_away_from_mouse_checkbox->isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
string DlgMainMenu::getSkin() {
|
||||||
|
return skin_list->getString();
|
||||||
|
}
|
||||||
|
|
||||||
|
string DlgMainMenu::getChangedSetting() {
|
||||||
|
if (settings_changed_list.size()) {
|
||||||
|
string name = settings_changed_list.back();
|
||||||
|
settings_changed_list.pop_back();
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DlgMainMenu::setPreviewSurface(SDL_Surface *preview_sfe) {
|
||||||
|
this->preview_sfe = preview_sfe;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DlgMainMenu::loadBackground() {
|
||||||
|
SDL_IOStream *io = SDL_IOFromConstMem(menu_png, menu_png_len);
|
||||||
|
if (io == NULL) {
|
||||||
|
SDL_Log("could not open io for menu_png: %s\n", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
background = IMG_Load_IO(io, true);
|
||||||
|
if (background == NULL) {
|
||||||
|
SDL_Log("could not create pet surface: %s\n", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
surface = SDL_CreateSurface(background->w, background->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000));
|
||||||
|
SDL_Rect d;
|
||||||
|
d.x = 0;
|
||||||
|
d.y = 0;
|
||||||
|
d.w = background->w;
|
||||||
|
d.h = background->h;
|
||||||
|
SDL_SetSurfaceClipRect(surface, &d);
|
||||||
|
pos.w = background->w;
|
||||||
|
pos.h = background->h;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
55
NewDialogs/DlgMainMenu.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#ifndef DLG_MAIN_MENU
|
||||||
|
#define DLG_MAIN_MENU
|
||||||
|
|
||||||
|
#include "Dialog.h"
|
||||||
|
#include "Button.h"
|
||||||
|
#include "DropDownList.h"
|
||||||
|
#include "Checkbox.h"
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class DlgMainMenu : public Dialog {
|
||||||
|
private:
|
||||||
|
vector<Dialog *> dialogs;
|
||||||
|
|
||||||
|
Checkbox *always_on_top_checkbox;
|
||||||
|
Checkbox *enable_sound_checkbox;
|
||||||
|
Checkbox *open_menu_on_start_checkbox;
|
||||||
|
Checkbox *run_away_from_mouse_checkbox;
|
||||||
|
DropDownList *skin_list;
|
||||||
|
|
||||||
|
bool app_exit;
|
||||||
|
bool show_menu;
|
||||||
|
vector<string> settings_changed_list;
|
||||||
|
|
||||||
|
SDL_Surface *preview_sfe;
|
||||||
|
public:
|
||||||
|
DlgMainMenu();
|
||||||
|
~DlgMainMenu();
|
||||||
|
void draw();
|
||||||
|
bool onMousePress(int x, int y);
|
||||||
|
bool onMouseRelease(int x, int y);
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
static void contCallback(void *p, Item *i);
|
||||||
|
void cont();
|
||||||
|
static void quitCallback(void *p, Item *i);
|
||||||
|
void quit();
|
||||||
|
static void settingsChangedCallback(void *p, Item *i);
|
||||||
|
void settingsChanged(Item *i);
|
||||||
|
void setAppExit(bool app_exit);
|
||||||
|
bool isAppExit();
|
||||||
|
bool isAlwaysOnTop();
|
||||||
|
bool isEnableSound();
|
||||||
|
bool isRunAwayFromMouse();
|
||||||
|
string getSkin();
|
||||||
|
string getChangedSetting();
|
||||||
|
void setPreviewSurface(SDL_Surface *preview_sfe);
|
||||||
|
bool loadBackground();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
158
NewDialogs/DropDownList.cpp
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "../SDLHelpers.h"
|
||||||
|
|
||||||
|
#include "DropDownList.h"
|
||||||
|
#include "DlgDropDownList.h"
|
||||||
|
|
||||||
|
DropDownList::DropDownList(vector<string> list, vector<Dialog *> *dialogs, SDL_Rect pos) : Item(pos) {
|
||||||
|
this->list = list;
|
||||||
|
this->dialogs = dialogs;
|
||||||
|
selected = 0;
|
||||||
|
pressed = false;
|
||||||
|
listbox_item_size = 20;
|
||||||
|
value_changed_func = NULL;
|
||||||
|
setSurface(SDL_CreateSurface(getPos()->w, getPos()->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)));
|
||||||
|
drawDropDownList();
|
||||||
|
}
|
||||||
|
|
||||||
|
DropDownList::~DropDownList() {
|
||||||
|
SDL_DestroySurface(getSurface());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DropDownList::drawDropDownList() {
|
||||||
|
listbox_height = list.size() * listbox_item_size;
|
||||||
|
|
||||||
|
SDL_Surface *surface = getSurface();
|
||||||
|
int w = getPos()->w;
|
||||||
|
int h = getPos()->h;
|
||||||
|
Uint32 *p = (Uint32 *) surface->pixels;
|
||||||
|
SDL_Color color;
|
||||||
|
for (int y = 0; y < h; y++) {
|
||||||
|
for (int x = 0; x < w; x++) {
|
||||||
|
if (y == 0 || y == h-1 || x == 0 || x == w-1 || x == w-18) {
|
||||||
|
color.r = 0;
|
||||||
|
color.g = 0;
|
||||||
|
color.b = 0;
|
||||||
|
} else {
|
||||||
|
color.r = 255;
|
||||||
|
color.g = 255;
|
||||||
|
color.b = 255;
|
||||||
|
}
|
||||||
|
*p = SDL_MapRGB(SDL_GetPixelFormatDetails(surface->format), NULL, color.r, color.g, color.b);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//drawing arrow
|
||||||
|
p = (Uint32 *) surface->pixels;
|
||||||
|
int posx = w - 13;
|
||||||
|
int posy = h / 2 - 2;
|
||||||
|
for (int y = 0; y < 4; y++) {
|
||||||
|
for (int x = 0; x < 8 - y * 2; x++) {
|
||||||
|
p[(posy + y) * w + (posx + x + y)] = SDL_MapRGB(SDL_GetPixelFormatDetails(surface->format), NULL, color.r, color.g, color.b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Color text_color = {0, 0, 0};
|
||||||
|
vector<string> fonts;
|
||||||
|
fonts.push_back("ariblk.ttf");
|
||||||
|
fonts.push_back("FreeSans.ttf");
|
||||||
|
fonts.push_back("DejaVuSans.ttf");
|
||||||
|
fonts.push_back("arial.ttf");
|
||||||
|
TTF_Font *font = openFont(fonts, 14);
|
||||||
|
SDL_Surface *text_surface;
|
||||||
|
if (!font)
|
||||||
|
cout << "TTF_OpenFont is broken!" << endl;
|
||||||
|
if(!(text_surface = TTF_RenderText_Blended(font, list[selected].c_str(), list[selected].length(), text_color)))
|
||||||
|
cout << SDL_GetError() << endl;
|
||||||
|
SDL_Rect pos;
|
||||||
|
pos.x = 8;
|
||||||
|
pos.y = surface->h / 2 - text_surface->h / 2;
|
||||||
|
SDL_BlitSurface(text_surface, NULL, surface, &pos);
|
||||||
|
SDL_DestroySurface(text_surface);
|
||||||
|
TTF_CloseFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DropDownList::onMousePress(int x, int y) {
|
||||||
|
bool is_in_x = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
bool is_in_y = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
if (is_in_x && is_in_y) {
|
||||||
|
//setSurface(buttonDown);
|
||||||
|
pressed = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DropDownList::onMouseRelease(int x, int y) {
|
||||||
|
bool is_in_x = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
bool is_in_y = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
if (is_in_x && is_in_y && pressed) {
|
||||||
|
int height;
|
||||||
|
bool add_scrollbar;
|
||||||
|
if (listbox_height < 200) {
|
||||||
|
height = listbox_height;
|
||||||
|
add_scrollbar = false;
|
||||||
|
} else {
|
||||||
|
height = 200;
|
||||||
|
add_scrollbar = true;
|
||||||
|
}
|
||||||
|
dialogs->push_back(new DlgDropDownList(this, getRect(getPos()->x, getPos()->y + getPos()->h, getPos()->w, height), add_scrollbar));
|
||||||
|
}
|
||||||
|
//setSurface(buttonUp);
|
||||||
|
pressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<string> DropDownList::getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DropDownList::setSelected(int selected) {
|
||||||
|
this->selected = selected;
|
||||||
|
if (value_changed_func) {
|
||||||
|
(*value_changed_func)(p, this);
|
||||||
|
}
|
||||||
|
drawDropDownList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DropDownList::setValueChangedFunc(void (*value_changed_func)(void *p, Item *i), void *p) {
|
||||||
|
this->value_changed_func = value_changed_func;
|
||||||
|
this->p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
string DropDownList::getString() {
|
||||||
|
return list[selected];
|
||||||
|
}
|
||||||
|
|
||||||
|
void DropDownList::reset() {
|
||||||
|
list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DropDownList::add(string s) {
|
||||||
|
list.push_back(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DropDownList::select(string s) {
|
||||||
|
for (int x = 0; x < list.size(); x++) {
|
||||||
|
if (list[x].compare(s) == 0) {
|
||||||
|
setSelected(x);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DropDownList::getListboxItemSize() {
|
||||||
|
return listbox_item_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DropDownList::getListboxHeight() {
|
||||||
|
return listbox_height;
|
||||||
|
}
|
||||||
40
NewDialogs/DropDownList.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#ifndef DROP_DOWN_LIST
|
||||||
|
#define DROP_DOWN_LIST
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
#include "Dialog.h"
|
||||||
|
|
||||||
|
class DropDownList : public Item {
|
||||||
|
private:
|
||||||
|
vector<string> list;
|
||||||
|
vector<Dialog *> *dialogs;
|
||||||
|
int selected;
|
||||||
|
int listbox_item_size;
|
||||||
|
int listbox_height;
|
||||||
|
bool pressed;
|
||||||
|
void (*value_changed_func)(void *p, Item *i);
|
||||||
|
void *p;
|
||||||
|
public:
|
||||||
|
DropDownList(vector<string> list, vector<Dialog *> *dialogs, SDL_Rect pos);
|
||||||
|
~DropDownList();
|
||||||
|
void drawDropDownList();
|
||||||
|
bool onMousePress(int x, int y);
|
||||||
|
void onMouseRelease(int x, int y);
|
||||||
|
vector<string> getList();
|
||||||
|
void setSelected(int selected);
|
||||||
|
void setValueChangedFunc(void (*value_changed_func)(void *p, Item *i), void *p);
|
||||||
|
string getString();
|
||||||
|
void reset();
|
||||||
|
void add(string s);
|
||||||
|
bool select(string s);
|
||||||
|
int getListboxItemSize();
|
||||||
|
int getListboxHeight();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
65
NewDialogs/Frame.cpp
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
|
Frame::Frame(SDL_Rect pos) : Item(pos) {
|
||||||
|
setSurface(SDL_CreateSurface(getPos()->w, getPos()->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)));
|
||||||
|
memset((int *) getSurface()->pixels, 0xFFFFFFFF, pos.w * pos.h * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
Frame::~Frame() {
|
||||||
|
SDL_DestroySurface(getSurface());
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
delete items[z];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface *Frame::getSurface() {
|
||||||
|
draw();
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Frame::draw() {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
SDL_Rect src = *items[z]->getPos();
|
||||||
|
SDL_Rect dst = {0,0,0,0};
|
||||||
|
if (src.x < 0) {
|
||||||
|
src.x *= -1;
|
||||||
|
} else {
|
||||||
|
dst.x = src.x;
|
||||||
|
src.x = 0;
|
||||||
|
}
|
||||||
|
if (src.y < 0) {
|
||||||
|
src.y *= -1;
|
||||||
|
} else {
|
||||||
|
dst.y = src.y;
|
||||||
|
src.y = 0;
|
||||||
|
}
|
||||||
|
SDL_BlitSurface(items[z]->getSurface(), &src, surface, &dst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Frame::addItem(Item *item) {
|
||||||
|
items.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Item *Frame::getItem(int i) {
|
||||||
|
return items[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Frame::onMousePress(int x, int y) {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onMousePress(x - getPos()->x, y - getPos()->y);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Frame::onMouseRelease(int x, int y) {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onMouseRelease(x - getPos()->x, y - getPos()->y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Frame::onMouseMove(int x, int y) {
|
||||||
|
for (unsigned int z = 0; z < items.size(); z++) {
|
||||||
|
items[z]->onMouseMove(x - getPos()->x, y - getPos()->y);
|
||||||
|
}
|
||||||
|
}
|
||||||
27
NewDialogs/Frame.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef FRAME
|
||||||
|
#define FRAME
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
class Frame : public Item {
|
||||||
|
protected:
|
||||||
|
vector<Item *> items;
|
||||||
|
public:
|
||||||
|
Frame(SDL_Rect pos);
|
||||||
|
~Frame();
|
||||||
|
SDL_Surface *getSurface();
|
||||||
|
void draw();
|
||||||
|
void addItem(Item *item);
|
||||||
|
Item *getItem(int i);
|
||||||
|
bool onMousePress(int x, int y);
|
||||||
|
void onMouseRelease(int x, int y);
|
||||||
|
void onMouseMove(int x, int y);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
58
NewDialogs/Item.cpp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
Item::Item(SDL_Rect pos) {
|
||||||
|
this->pos = pos;
|
||||||
|
needs_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Item::~Item() {
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface *Item::getSurface() {
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::setSurface(SDL_Surface *surface) {
|
||||||
|
needs_redraw = true;
|
||||||
|
this->surface = surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::setPos(SDL_Rect pos) {
|
||||||
|
this->pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Rect *Item::getPos() {
|
||||||
|
return &pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Item::onMousePress(int x, int y) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::onMouseRelease(int x, int y) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::onMouseMove(int x, int y) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::onFingerDown(int x, int y, int finger_id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::onFingerUp(int x, int y, int finger_id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Item::needsRedraw() {
|
||||||
|
return needs_redraw;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::drawDone() {
|
||||||
|
needs_redraw = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::setName(string name) {
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Item::getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
35
NewDialogs/Item.h
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef ITEM_H
|
||||||
|
#define ITEM_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class Item {
|
||||||
|
protected:
|
||||||
|
SDL_Surface *surface;
|
||||||
|
bool needs_redraw;
|
||||||
|
private:
|
||||||
|
SDL_Rect pos;
|
||||||
|
string name;
|
||||||
|
public:
|
||||||
|
Item(SDL_Rect pos);
|
||||||
|
virtual ~Item();
|
||||||
|
virtual SDL_Surface *getSurface();
|
||||||
|
void setSurface(SDL_Surface *surface);
|
||||||
|
void setPos(SDL_Rect pos);
|
||||||
|
SDL_Rect *getPos();
|
||||||
|
virtual bool onMousePress(int x, int y);
|
||||||
|
virtual void onMouseRelease(int x, int y);
|
||||||
|
virtual void onMouseMove(int x, int y);
|
||||||
|
virtual void onFingerDown(int x, int y, int finger_id);
|
||||||
|
virtual void onFingerUp(int x, int y, int finger_id);
|
||||||
|
bool needsRedraw();
|
||||||
|
void drawDone();
|
||||||
|
void setName(string name);
|
||||||
|
string getName();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
91
NewDialogs/Listbox.cpp
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "../SDLHelpers.h"
|
||||||
|
|
||||||
|
#include "Listbox.h"
|
||||||
|
|
||||||
|
Listbox::Listbox(vector<string> list, int item_size, SDL_Rect pos) : Item(pos) {
|
||||||
|
this->list = list;
|
||||||
|
this->item_size = item_size;
|
||||||
|
selected = 1;
|
||||||
|
setSurface(SDL_CreateSurface(getPos()->w, getPos()->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)));
|
||||||
|
drawListbox();
|
||||||
|
}
|
||||||
|
|
||||||
|
Listbox::~Listbox() {
|
||||||
|
SDL_DestroySurface(getSurface());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Listbox::drawListbox() {
|
||||||
|
SDL_Surface *surface = getSurface();
|
||||||
|
int w = getPos()->w;
|
||||||
|
int h = getPos()->h;
|
||||||
|
|
||||||
|
Uint32 *p = (Uint32 *) surface->pixels;
|
||||||
|
SDL_Color color;
|
||||||
|
for (int y = 0; y < h; y++) {
|
||||||
|
for (int x = 0; x < w; x++) {
|
||||||
|
if (y == 0 || y == h-1 || x == 0 || x == w-1) {
|
||||||
|
color.r = 0;
|
||||||
|
color.g = 0;
|
||||||
|
color.b = 0;
|
||||||
|
} else {
|
||||||
|
color.r = 255;
|
||||||
|
color.g = 255;
|
||||||
|
color.b = 255;
|
||||||
|
}
|
||||||
|
*p = SDL_MapRGB(SDL_GetPixelFormatDetails(surface->format), NULL, color.r, color.g, color.b);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<string> fonts;
|
||||||
|
fonts.push_back("ariblk.ttf");
|
||||||
|
fonts.push_back("FreeSans.ttf");
|
||||||
|
fonts.push_back("DejaVuSans.ttf");
|
||||||
|
TTF_Font *font = openFont(fonts, 14);
|
||||||
|
if (!font) {
|
||||||
|
cout << "TTF_OpenFont is broken!" << endl;
|
||||||
|
} else {
|
||||||
|
for (int x = 0; x < list.size(); x++) {
|
||||||
|
SDL_Color text_color = {0, 0, 0};
|
||||||
|
SDL_Surface *text_surface;
|
||||||
|
if(!(text_surface = TTF_RenderText_Blended(font, list[x].c_str(), list[x].length(), text_color))) {
|
||||||
|
cout << SDL_GetError() << endl;
|
||||||
|
}
|
||||||
|
SDL_Rect pos;
|
||||||
|
pos.x = 8;
|
||||||
|
pos.y = x * item_size;
|
||||||
|
SDL_BlitSurface(text_surface, NULL, surface, &pos);
|
||||||
|
SDL_DestroySurface(text_surface);
|
||||||
|
}
|
||||||
|
TTF_CloseFont(font);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Listbox::onMousePress(int x, int y) {
|
||||||
|
bool is_in_x = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
bool is_in_y = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
if (is_in_x && is_in_y) {
|
||||||
|
selected = (y - getPos()->y) / item_size;
|
||||||
|
if (value_changed_func) {
|
||||||
|
(*value_changed_func)(p);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Listbox::setValueChangedFunc(void (*value_changed_func)(void *p), void *p) {
|
||||||
|
this->value_changed_func = value_changed_func;
|
||||||
|
this->p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Listbox::getSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
26
NewDialogs/Listbox.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef LISTBOX
|
||||||
|
#define LISTBOX
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
class Listbox : public Item {
|
||||||
|
private:
|
||||||
|
vector<string> list;
|
||||||
|
int selected;
|
||||||
|
int item_size;
|
||||||
|
void (*value_changed_func)(void *p);
|
||||||
|
void *p;
|
||||||
|
public:
|
||||||
|
Listbox(vector<string> list, int item_size, SDL_Rect pos);
|
||||||
|
~Listbox();
|
||||||
|
void drawListbox();
|
||||||
|
bool onMousePress(int x, int y);
|
||||||
|
void setValueChangedFunc(void (*value_changed_func)(void *p), void *p);
|
||||||
|
int getSelected();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
103
NewDialogs/Scrollbar.cpp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#include "Scrollbar.h"
|
||||||
|
|
||||||
|
Scrollbar::Scrollbar(int min_value, int max_value, int value, SDL_Rect pos) : Item(pos) {
|
||||||
|
vertical = (pos.h > pos.w);
|
||||||
|
this->min_value = min_value;
|
||||||
|
this->max_value = max_value;
|
||||||
|
this->value = value;
|
||||||
|
bar_size = 18;
|
||||||
|
pressed = false;
|
||||||
|
value_changed_func = NULL;
|
||||||
|
setSurface(SDL_CreateSurface(getPos()->w, getPos()->h, SDL_GetPixelFormatForMasks(32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)));
|
||||||
|
drawScrollbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
Scrollbar::~Scrollbar() {
|
||||||
|
SDL_DestroySurface(getSurface());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrollbar::drawScrollbar() {
|
||||||
|
SDL_Surface *surface = getSurface();
|
||||||
|
int w = getPos()->w;
|
||||||
|
int h = getPos()->h;
|
||||||
|
|
||||||
|
Uint32 *p = (Uint32 *) surface->pixels;
|
||||||
|
SDL_Color color;
|
||||||
|
for (int y = 0; y < h; y++) {
|
||||||
|
for (int x = 0; x < w; x++) {
|
||||||
|
int x_or_y = (vertical ? y : x);
|
||||||
|
bool bar_pos_test = (x_or_y > getBarPos() && x_or_y < getBarPos() + bar_size);
|
||||||
|
|
||||||
|
if (y == 0 || y == h-1 || x == 0 || x == w-1 || bar_pos_test) {
|
||||||
|
color.r = 0;
|
||||||
|
color.g = 0;
|
||||||
|
color.b = 0;
|
||||||
|
} else {
|
||||||
|
color.r = 255;
|
||||||
|
color.g = 255;
|
||||||
|
color.b = 255;
|
||||||
|
}
|
||||||
|
*p = SDL_MapRGB(SDL_GetPixelFormatDetails(surface->format), NULL, color.r, color.g, color.b);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Scrollbar::onMousePress(int x, int y) {
|
||||||
|
bool is_in_x = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
bool is_in_y = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
if (is_in_x && is_in_y) {
|
||||||
|
//setSurface(buttonDown);
|
||||||
|
mouse_offset = (vertical ? y : x) - getBarPos();
|
||||||
|
pressed = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrollbar::onMouseRelease(int x, int y) {
|
||||||
|
//bool is_in_x = x > getPos()->x && x < getPos()->x + getPos()->w;
|
||||||
|
//bool is_in_y = y > getPos()->y && y < getPos()->y + getPos()->h;
|
||||||
|
//if (is_in_x && is_in_y && pressed) {
|
||||||
|
if (pressed) {
|
||||||
|
setValueByBarPos((vertical ? y : x) - mouse_offset);
|
||||||
|
drawScrollbar();
|
||||||
|
if (value_changed_func) {
|
||||||
|
(*value_changed_func)(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//setSurface(buttonUp);
|
||||||
|
pressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrollbar::onMouseMove(int x, int y) {
|
||||||
|
if (pressed) {
|
||||||
|
setValueByBarPos((vertical ? y : x) - mouse_offset);
|
||||||
|
drawScrollbar();
|
||||||
|
if (value_changed_func)
|
||||||
|
(*value_changed_func)(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Scrollbar::getBarPos() {
|
||||||
|
int w_or_h = (vertical ? getPos()->h : getPos()->w);
|
||||||
|
return (w_or_h - bar_size) * (value - min_value) / (max_value - min_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrollbar::setValueByBarPos(int pos) {
|
||||||
|
int w_or_h = (vertical ? getPos()->h : getPos()->w);
|
||||||
|
value = (max_value - min_value) * pos / (w_or_h - bar_size) + min_value;
|
||||||
|
if (value < min_value)
|
||||||
|
value = min_value;
|
||||||
|
if (value > max_value)
|
||||||
|
value = max_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrollbar::setValueChangedFunc(void (*value_changed_func)(void *p), void *p) {
|
||||||
|
this->value_changed_func = value_changed_func;
|
||||||
|
this->p = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Scrollbar::getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
32
NewDialogs/Scrollbar.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#ifndef SCROLLBAR
|
||||||
|
#define SCROLLBAR
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
class Scrollbar : public Item {
|
||||||
|
private:
|
||||||
|
bool vertical;
|
||||||
|
int min_value;
|
||||||
|
int max_value;
|
||||||
|
int value;
|
||||||
|
int bar_size;
|
||||||
|
int mouse_offset;
|
||||||
|
bool pressed;
|
||||||
|
void (*value_changed_func)(void *p);
|
||||||
|
void *p;
|
||||||
|
public:
|
||||||
|
Scrollbar(int min_value, int max_value, int value, SDL_Rect pos);
|
||||||
|
~Scrollbar();
|
||||||
|
void drawScrollbar();
|
||||||
|
bool onMousePress(int x, int y);
|
||||||
|
void onMouseRelease(int x, int y);
|
||||||
|
void onMouseMove(int x, int y);
|
||||||
|
int getBarPos();
|
||||||
|
void setValueByBarPos(int pos);
|
||||||
|
void setValueChangedFunc(void (*value_changed_func)(void *p), void *p);
|
||||||
|
int getValue();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
45
SDLHelpers.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#ifndef SDLHELPERS_H
|
||||||
|
#define SDLHELPERS_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
static const char *font_paths[] = {"C:/windows/fonts/", "/usr/share/fonts/TTF/", "./"};
|
||||||
|
static const short font_path_count = 3;
|
||||||
|
|
||||||
|
static SDL_Rect getRect(Sint16 x, Sint16 y, Uint16 w, Uint16 h) {
|
||||||
|
SDL_Rect rect;
|
||||||
|
rect.x = x;
|
||||||
|
rect.y = y;
|
||||||
|
rect.w = w;
|
||||||
|
rect.h = h;
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SDL_Color getColor(Uint8 r, Uint8 g, Uint8 b) {
|
||||||
|
SDL_Color color;
|
||||||
|
color.r = r;
|
||||||
|
color.g = g;
|
||||||
|
color.b = b;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
static TTF_Font *openFont(std::vector<std::string> fonts, int size) {
|
||||||
|
TTF_Font *font = NULL;
|
||||||
|
for (int x = 0; x < fonts.size(); x++) {
|
||||||
|
for (int y = 0; y < font_path_count; y++) {
|
||||||
|
std::string val(font_paths[y]);
|
||||||
|
val.append(fonts[x]);
|
||||||
|
font = TTF_OpenFont(val.c_str(), size);
|
||||||
|
if (font)
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
47
Sound.cpp
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#include "Sound.h"
|
||||||
|
|
||||||
|
Sound::Sound() {
|
||||||
|
is_open = false;
|
||||||
|
stream = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sound::setSound(SoundData *sound_data) {
|
||||||
|
if (sound_data->len && !is_open) {
|
||||||
|
//SDL_Log("audio open, len %d", sound_data->len);
|
||||||
|
stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &sound_data->spec, &streamCb, sound_data);
|
||||||
|
//stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &sound_data.spec, NULL, NULL);
|
||||||
|
if (stream) {
|
||||||
|
is_open = true;
|
||||||
|
} else {
|
||||||
|
SDL_Log("Could not open audio stream %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stream && is_open) {
|
||||||
|
if (sound_data->len) {
|
||||||
|
SDL_SetAudioStreamGetCallback(stream, streamCb, sound_data);
|
||||||
|
SDL_ResumeAudioStreamDevice(stream);
|
||||||
|
} else {
|
||||||
|
SDL_SetAudioStreamGetCallback(stream, NULL, sound_data);
|
||||||
|
}
|
||||||
|
/*int len = SDL_GetAudioStreamQueued(stream);
|
||||||
|
SDL_Log("LEN %d paused %d", len);
|
||||||
|
if (!len) {
|
||||||
|
SDL_PutAudioStreamData(stream, sound_data.buf, sound_data.len);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sound::streamCb(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount) {
|
||||||
|
SoundData* sound_data = (SoundData *) userdata;
|
||||||
|
if ((!sound_data->is_played || sound_data->loop) && additional_amount) {
|
||||||
|
//SDL_Log("LEN2 %d total_amount %d additional_amount %d", sound_data->len, total_amount, additional_amount);
|
||||||
|
SDL_PutAudioStreamData(stream, sound_data->buf, sound_data->len);
|
||||||
|
sound_data->is_played = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sound::closeSound() {
|
||||||
|
SDL_DestroyAudioStream(stream);
|
||||||
|
stream = NULL;
|
||||||
|
is_open = false;
|
||||||
|
}
|
||||||
20
Sound.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef SOUND_H
|
||||||
|
#define SOUND_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_audio.h>
|
||||||
|
|
||||||
|
#include "SoundData.h"
|
||||||
|
|
||||||
|
class Sound {
|
||||||
|
private:
|
||||||
|
SDL_AudioStream *stream;
|
||||||
|
bool is_open;
|
||||||
|
public:
|
||||||
|
Sound();
|
||||||
|
void setSound(SoundData *sound_data);
|
||||||
|
static void streamCb(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount);
|
||||||
|
void closeSound();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
15
SoundData.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef SOUND_DATA_H
|
||||||
|
#define SOUND_DATA_H
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
class SoundData {
|
||||||
|
public:
|
||||||
|
bool is_played;
|
||||||
|
bool loop;
|
||||||
|
SDL_AudioSpec spec;
|
||||||
|
Uint8 *buf;
|
||||||
|
Uint32 len;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
427
embed.h
Normal file
@@ -0,0 +1,427 @@
|
|||||||
|
|
||||||
|
enum skin_name { Tavallinen, Alppisusi, Chibi };
|
||||||
|
enum skin_state { falling, haukahdus, hoksaa, hyppaa, kiali, laukka, laukka2, paikka, pissaus, platsahtaa, putoo, pyorii, pyoriivasemmalle, roikkuu, rouskutus };
|
||||||
|
|
||||||
|
// create with echo $(for n in $(find skin -name "*.png"; find skin -name "*.wav"; find skin -name "*.tsk"); do xxd -i $n; done) > embed_data.h
|
||||||
|
#include "embed_data.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class embed_data {
|
||||||
|
public:
|
||||||
|
unsigned char *data;
|
||||||
|
unsigned int len;
|
||||||
|
};
|
||||||
|
|
||||||
|
embed_data skin_Tavallinen_falling[4] = {
|
||||||
|
{skin_Tavallinen_falling_1_png, skin_Tavallinen_falling_1_png_len},
|
||||||
|
{skin_Tavallinen_falling_2_png, skin_Tavallinen_falling_2_png_len},
|
||||||
|
{skin_Tavallinen_falling_3_png, skin_Tavallinen_falling_3_png_len},
|
||||||
|
{skin_Tavallinen_falling_4_png, skin_Tavallinen_falling_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_haukahdus[4] = {
|
||||||
|
{skin_Tavallinen_haukahdus_1_png, skin_Tavallinen_haukahdus_1_png_len},
|
||||||
|
{skin_Tavallinen_haukahdus_2_png, skin_Tavallinen_haukahdus_2_png_len},
|
||||||
|
{skin_Tavallinen_haukahdus_3_png, skin_Tavallinen_haukahdus_3_png_len},
|
||||||
|
{skin_Tavallinen_haukahdus_4_png, skin_Tavallinen_haukahdus_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_hoksaa[4] = {
|
||||||
|
{skin_Tavallinen_hoksaa_1_png, skin_Tavallinen_hoksaa_1_png_len},
|
||||||
|
{skin_Tavallinen_hoksaa_2_png, skin_Tavallinen_hoksaa_2_png_len},
|
||||||
|
{skin_Tavallinen_hoksaa_3_png, skin_Tavallinen_hoksaa_3_png_len},
|
||||||
|
{skin_Tavallinen_hoksaa_4_png, skin_Tavallinen_hoksaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_hyppaa[4] = {
|
||||||
|
{skin_Tavallinen_hyppaa_1_png, skin_Tavallinen_hyppaa_1_png_len},
|
||||||
|
{skin_Tavallinen_hyppaa_2_png, skin_Tavallinen_hyppaa_2_png_len},
|
||||||
|
{skin_Tavallinen_hyppaa_3_png, skin_Tavallinen_hyppaa_3_png_len},
|
||||||
|
{skin_Tavallinen_hyppaa_4_png, skin_Tavallinen_hyppaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_kiali[4] = {
|
||||||
|
{skin_Tavallinen_kiali_1_png, skin_Tavallinen_kiali_1_png_len},
|
||||||
|
{skin_Tavallinen_kiali_2_png, skin_Tavallinen_kiali_2_png_len},
|
||||||
|
{skin_Tavallinen_kiali_3_png, skin_Tavallinen_kiali_3_png_len},
|
||||||
|
{skin_Tavallinen_kiali_4_png, skin_Tavallinen_kiali_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_laukka[6] = {
|
||||||
|
{skin_Tavallinen_laukka_1_png, skin_Tavallinen_laukka_1_png_len},
|
||||||
|
{skin_Tavallinen_laukka_2_png, skin_Tavallinen_laukka_2_png_len},
|
||||||
|
{skin_Tavallinen_laukka_3_png, skin_Tavallinen_laukka_3_png_len},
|
||||||
|
{skin_Tavallinen_laukka_4_png, skin_Tavallinen_laukka_4_png_len},
|
||||||
|
{skin_Tavallinen_laukka_5_png, skin_Tavallinen_laukka_5_png_len},
|
||||||
|
{skin_Tavallinen_laukka_6_png, skin_Tavallinen_laukka_6_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_laukka2[6] = {
|
||||||
|
{skin_Tavallinen_laukka2_1_png, skin_Tavallinen_laukka2_1_png_len},
|
||||||
|
{skin_Tavallinen_laukka2_2_png, skin_Tavallinen_laukka2_2_png_len},
|
||||||
|
{skin_Tavallinen_laukka2_3_png, skin_Tavallinen_laukka2_3_png_len},
|
||||||
|
{skin_Tavallinen_laukka2_4_png, skin_Tavallinen_laukka2_4_png_len},
|
||||||
|
{skin_Tavallinen_laukka2_5_png, skin_Tavallinen_laukka2_5_png_len},
|
||||||
|
{skin_Tavallinen_laukka2_6_png, skin_Tavallinen_laukka2_6_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_paikka[4] = {
|
||||||
|
{skin_Tavallinen_paikka_1_png, skin_Tavallinen_paikka_1_png_len},
|
||||||
|
{skin_Tavallinen_paikka_2_png, skin_Tavallinen_paikka_2_png_len},
|
||||||
|
{skin_Tavallinen_paikka_3_png, skin_Tavallinen_paikka_3_png_len},
|
||||||
|
{skin_Tavallinen_paikka_4_png, skin_Tavallinen_paikka_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_pissaus[7] = {
|
||||||
|
{skin_Tavallinen_pissaus_1_png, skin_Tavallinen_pissaus_1_png_len},
|
||||||
|
{skin_Tavallinen_pissaus_2_png, skin_Tavallinen_pissaus_2_png_len},
|
||||||
|
{skin_Tavallinen_pissaus_3_png, skin_Tavallinen_pissaus_3_png_len},
|
||||||
|
{skin_Tavallinen_pissaus_4_png, skin_Tavallinen_pissaus_4_png_len},
|
||||||
|
{skin_Tavallinen_pissaus_5_png, skin_Tavallinen_pissaus_5_png_len},
|
||||||
|
{skin_Tavallinen_pissaus_6_png, skin_Tavallinen_pissaus_6_png_len},
|
||||||
|
{skin_Tavallinen_pissaus_7_png, skin_Tavallinen_pissaus_7_png_len},
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_platsahtaa[4] = {
|
||||||
|
{skin_Tavallinen_platsahtaa_1_png, skin_Tavallinen_platsahtaa_1_png_len},
|
||||||
|
{skin_Tavallinen_platsahtaa_2_png, skin_Tavallinen_platsahtaa_2_png_len},
|
||||||
|
{skin_Tavallinen_platsahtaa_3_png, skin_Tavallinen_platsahtaa_3_png_len},
|
||||||
|
{skin_Tavallinen_platsahtaa_4_png, skin_Tavallinen_platsahtaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_putoo[4] = {
|
||||||
|
{skin_Tavallinen_putoo_1_png, skin_Tavallinen_putoo_1_png_len},
|
||||||
|
{skin_Tavallinen_putoo_2_png, skin_Tavallinen_putoo_2_png_len},
|
||||||
|
{skin_Tavallinen_putoo_3_png, skin_Tavallinen_putoo_3_png_len},
|
||||||
|
{skin_Tavallinen_putoo_4_png, skin_Tavallinen_putoo_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_pyorii[4] = {
|
||||||
|
{skin_Tavallinen_pyorii_1_png, skin_Tavallinen_pyorii_1_png_len},
|
||||||
|
{skin_Tavallinen_pyorii_2_png, skin_Tavallinen_pyorii_2_png_len},
|
||||||
|
{skin_Tavallinen_pyorii_3_png, skin_Tavallinen_pyorii_3_png_len},
|
||||||
|
{skin_Tavallinen_pyorii_4_png, skin_Tavallinen_pyorii_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_pyoriivasemmalle[4] = {
|
||||||
|
{skin_Tavallinen_pyoriivasemmalle_1_png, skin_Tavallinen_pyoriivasemmalle_1_png_len},
|
||||||
|
{skin_Tavallinen_pyoriivasemmalle_2_png, skin_Tavallinen_pyoriivasemmalle_2_png_len},
|
||||||
|
{skin_Tavallinen_pyoriivasemmalle_3_png, skin_Tavallinen_pyoriivasemmalle_3_png_len},
|
||||||
|
{skin_Tavallinen_pyoriivasemmalle_4_png, skin_Tavallinen_pyoriivasemmalle_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_roikkuu[1] = {
|
||||||
|
{skin_Tavallinen_roikkuu_1_png, skin_Tavallinen_roikkuu_1_png_len},
|
||||||
|
};
|
||||||
|
embed_data skin_Tavallinen_rouskutus[4] = {
|
||||||
|
{skin_Tavallinen_rouskutus_1_png, skin_Tavallinen_rouskutus_1_png_len},
|
||||||
|
{skin_Tavallinen_rouskutus_2_png, skin_Tavallinen_rouskutus_2_png_len},
|
||||||
|
{skin_Tavallinen_rouskutus_3_png, skin_Tavallinen_rouskutus_3_png_len},
|
||||||
|
{skin_Tavallinen_rouskutus_4_png, skin_Tavallinen_rouskutus_4_png_len}
|
||||||
|
};
|
||||||
|
|
||||||
|
embed_data *skin_Tavallinen[15] = {
|
||||||
|
skin_Tavallinen_falling,
|
||||||
|
skin_Tavallinen_haukahdus,
|
||||||
|
skin_Tavallinen_hoksaa,
|
||||||
|
skin_Tavallinen_hyppaa,
|
||||||
|
skin_Tavallinen_kiali,
|
||||||
|
skin_Tavallinen_laukka,
|
||||||
|
skin_Tavallinen_laukka2,
|
||||||
|
skin_Tavallinen_paikka,
|
||||||
|
skin_Tavallinen_pissaus,
|
||||||
|
skin_Tavallinen_platsahtaa,
|
||||||
|
skin_Tavallinen_putoo,
|
||||||
|
skin_Tavallinen_pyorii,
|
||||||
|
skin_Tavallinen_pyoriivasemmalle,
|
||||||
|
skin_Tavallinen_roikkuu,
|
||||||
|
skin_Tavallinen_rouskutus
|
||||||
|
};
|
||||||
|
|
||||||
|
embed_data skin_Alppisusi_falling[4] = {
|
||||||
|
{skin_Alppisusi_falling_1_png, skin_Alppisusi_falling_1_png_len},
|
||||||
|
{skin_Alppisusi_falling_2_png, skin_Alppisusi_falling_2_png_len},
|
||||||
|
{skin_Alppisusi_falling_3_png, skin_Alppisusi_falling_3_png_len},
|
||||||
|
{skin_Alppisusi_falling_4_png, skin_Alppisusi_falling_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_haukahdus[4] = {
|
||||||
|
{skin_Alppisusi_haukahdus_1_png, skin_Alppisusi_haukahdus_1_png_len},
|
||||||
|
{skin_Alppisusi_haukahdus_2_png, skin_Alppisusi_haukahdus_2_png_len},
|
||||||
|
{skin_Alppisusi_haukahdus_3_png, skin_Alppisusi_haukahdus_3_png_len},
|
||||||
|
{skin_Alppisusi_haukahdus_4_png, skin_Alppisusi_haukahdus_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_hoksaa[4] = {
|
||||||
|
{skin_Alppisusi_hoksaa_1_png, skin_Alppisusi_hoksaa_1_png_len},
|
||||||
|
{skin_Alppisusi_hoksaa_2_png, skin_Alppisusi_hoksaa_2_png_len},
|
||||||
|
{skin_Alppisusi_hoksaa_3_png, skin_Alppisusi_hoksaa_3_png_len},
|
||||||
|
{skin_Alppisusi_hoksaa_4_png, skin_Alppisusi_hoksaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_hyppaa[4] = {
|
||||||
|
{skin_Alppisusi_hyppaa_1_png, skin_Alppisusi_hyppaa_1_png_len},
|
||||||
|
{skin_Alppisusi_hyppaa_2_png, skin_Alppisusi_hyppaa_2_png_len},
|
||||||
|
{skin_Alppisusi_hyppaa_3_png, skin_Alppisusi_hyppaa_3_png_len},
|
||||||
|
{skin_Alppisusi_hyppaa_4_png, skin_Alppisusi_hyppaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_kiali[4] = {
|
||||||
|
{skin_Alppisusi_kiali_1_png, skin_Alppisusi_kiali_1_png_len},
|
||||||
|
{skin_Alppisusi_kiali_2_png, skin_Alppisusi_kiali_2_png_len},
|
||||||
|
{skin_Alppisusi_kiali_3_png, skin_Alppisusi_kiali_3_png_len},
|
||||||
|
{skin_Alppisusi_kiali_4_png, skin_Alppisusi_kiali_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_laukka[6] = {
|
||||||
|
{skin_Alppisusi_laukka_1_png, skin_Alppisusi_laukka_1_png_len},
|
||||||
|
{skin_Alppisusi_laukka_2_png, skin_Alppisusi_laukka_2_png_len},
|
||||||
|
{skin_Alppisusi_laukka_3_png, skin_Alppisusi_laukka_3_png_len},
|
||||||
|
{skin_Alppisusi_laukka_4_png, skin_Alppisusi_laukka_4_png_len},
|
||||||
|
{skin_Alppisusi_laukka_5_png, skin_Alppisusi_laukka_5_png_len},
|
||||||
|
{skin_Alppisusi_laukka_6_png, skin_Alppisusi_laukka_6_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_laukka2[6] = {
|
||||||
|
{skin_Alppisusi_laukka2_1_png, skin_Alppisusi_laukka2_1_png_len},
|
||||||
|
{skin_Alppisusi_laukka2_2_png, skin_Alppisusi_laukka2_2_png_len},
|
||||||
|
{skin_Alppisusi_laukka2_3_png, skin_Alppisusi_laukka2_3_png_len},
|
||||||
|
{skin_Alppisusi_laukka2_4_png, skin_Alppisusi_laukka2_4_png_len},
|
||||||
|
{skin_Alppisusi_laukka2_5_png, skin_Alppisusi_laukka2_5_png_len},
|
||||||
|
{skin_Alppisusi_laukka2_6_png, skin_Alppisusi_laukka2_6_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_paikka[4] = {
|
||||||
|
{skin_Alppisusi_paikka_1_png, skin_Alppisusi_paikka_1_png_len},
|
||||||
|
{skin_Alppisusi_paikka_2_png, skin_Alppisusi_paikka_2_png_len},
|
||||||
|
{skin_Alppisusi_paikka_3_png, skin_Alppisusi_paikka_3_png_len},
|
||||||
|
{skin_Alppisusi_paikka_4_png, skin_Alppisusi_paikka_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_pissaus[7] = {
|
||||||
|
{skin_Alppisusi_pissaus_1_png, skin_Alppisusi_pissaus_1_png_len},
|
||||||
|
{skin_Alppisusi_pissaus_2_png, skin_Alppisusi_pissaus_2_png_len},
|
||||||
|
{skin_Alppisusi_pissaus_3_png, skin_Alppisusi_pissaus_3_png_len},
|
||||||
|
{skin_Alppisusi_pissaus_4_png, skin_Alppisusi_pissaus_4_png_len},
|
||||||
|
{skin_Alppisusi_pissaus_5_png, skin_Alppisusi_pissaus_5_png_len},
|
||||||
|
{skin_Alppisusi_pissaus_6_png, skin_Alppisusi_pissaus_6_png_len},
|
||||||
|
{skin_Alppisusi_pissaus_7_png, skin_Alppisusi_pissaus_7_png_len},
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_platsahtaa[4] = {
|
||||||
|
{skin_Alppisusi_platsahtaa_1_png, skin_Alppisusi_platsahtaa_1_png_len},
|
||||||
|
{skin_Alppisusi_platsahtaa_2_png, skin_Alppisusi_platsahtaa_2_png_len},
|
||||||
|
{skin_Alppisusi_platsahtaa_3_png, skin_Alppisusi_platsahtaa_3_png_len},
|
||||||
|
{skin_Alppisusi_platsahtaa_4_png, skin_Alppisusi_platsahtaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_putoo[4] = {
|
||||||
|
{skin_Alppisusi_putoo_1_png, skin_Alppisusi_putoo_1_png_len},
|
||||||
|
{skin_Alppisusi_putoo_2_png, skin_Alppisusi_putoo_2_png_len},
|
||||||
|
{skin_Alppisusi_putoo_3_png, skin_Alppisusi_putoo_3_png_len},
|
||||||
|
{skin_Alppisusi_putoo_4_png, skin_Alppisusi_putoo_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_pyorii[4] = {
|
||||||
|
{skin_Alppisusi_pyorii_1_png, skin_Alppisusi_pyorii_1_png_len},
|
||||||
|
{skin_Alppisusi_pyorii_2_png, skin_Alppisusi_pyorii_2_png_len},
|
||||||
|
{skin_Alppisusi_pyorii_3_png, skin_Alppisusi_pyorii_3_png_len},
|
||||||
|
{skin_Alppisusi_pyorii_4_png, skin_Alppisusi_pyorii_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_pyoriivasemmalle[4] = {
|
||||||
|
{skin_Alppisusi_pyoriivasemmalle_1_png, skin_Alppisusi_pyoriivasemmalle_1_png_len},
|
||||||
|
{skin_Alppisusi_pyoriivasemmalle_2_png, skin_Alppisusi_pyoriivasemmalle_2_png_len},
|
||||||
|
{skin_Alppisusi_pyoriivasemmalle_3_png, skin_Alppisusi_pyoriivasemmalle_3_png_len},
|
||||||
|
{skin_Alppisusi_pyoriivasemmalle_4_png, skin_Alppisusi_pyoriivasemmalle_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_roikkuu[1] = {
|
||||||
|
{skin_Alppisusi_roikkuu_1_png, skin_Alppisusi_roikkuu_1_png_len},
|
||||||
|
};
|
||||||
|
embed_data skin_Alppisusi_rouskutus[4] = {
|
||||||
|
{skin_Alppisusi_rouskutus_1_png, skin_Alppisusi_rouskutus_1_png_len},
|
||||||
|
{skin_Alppisusi_rouskutus_2_png, skin_Alppisusi_rouskutus_2_png_len},
|
||||||
|
{skin_Alppisusi_rouskutus_3_png, skin_Alppisusi_rouskutus_3_png_len},
|
||||||
|
{skin_Alppisusi_rouskutus_4_png, skin_Alppisusi_rouskutus_4_png_len}
|
||||||
|
};
|
||||||
|
|
||||||
|
embed_data *skin_Alppisusi[15] = {
|
||||||
|
skin_Alppisusi_falling,
|
||||||
|
skin_Alppisusi_haukahdus,
|
||||||
|
skin_Alppisusi_hoksaa,
|
||||||
|
skin_Alppisusi_hyppaa,
|
||||||
|
skin_Alppisusi_kiali,
|
||||||
|
skin_Alppisusi_laukka,
|
||||||
|
skin_Alppisusi_laukka2,
|
||||||
|
skin_Alppisusi_paikka,
|
||||||
|
skin_Alppisusi_pissaus,
|
||||||
|
skin_Alppisusi_platsahtaa,
|
||||||
|
skin_Alppisusi_putoo,
|
||||||
|
skin_Alppisusi_pyorii,
|
||||||
|
skin_Alppisusi_pyoriivasemmalle,
|
||||||
|
skin_Alppisusi_roikkuu,
|
||||||
|
skin_Alppisusi_rouskutus
|
||||||
|
};
|
||||||
|
|
||||||
|
embed_data skin_Chibi_falling[4] = {
|
||||||
|
{skin_Chibi_falling_1_png, skin_Chibi_falling_1_png_len},
|
||||||
|
{skin_Chibi_falling_2_png, skin_Chibi_falling_2_png_len},
|
||||||
|
{skin_Chibi_falling_3_png, skin_Chibi_falling_3_png_len},
|
||||||
|
{skin_Chibi_falling_4_png, skin_Chibi_falling_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_haukahdus[4] = {
|
||||||
|
{skin_Chibi_haukahdus_1_png, skin_Chibi_haukahdus_1_png_len},
|
||||||
|
{skin_Chibi_haukahdus_2_png, skin_Chibi_haukahdus_2_png_len},
|
||||||
|
{skin_Chibi_haukahdus_3_png, skin_Chibi_haukahdus_3_png_len},
|
||||||
|
{skin_Chibi_haukahdus_4_png, skin_Chibi_haukahdus_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_hoksaa[4] = {
|
||||||
|
{skin_Chibi_hoksaa_1_png, skin_Chibi_hoksaa_1_png_len},
|
||||||
|
{skin_Chibi_hoksaa_2_png, skin_Chibi_hoksaa_2_png_len},
|
||||||
|
{skin_Chibi_hoksaa_3_png, skin_Chibi_hoksaa_3_png_len},
|
||||||
|
{skin_Chibi_hoksaa_4_png, skin_Chibi_hoksaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_hyppaa[4] = {
|
||||||
|
{skin_Chibi_hyppaa_1_png, skin_Chibi_hyppaa_1_png_len},
|
||||||
|
{skin_Chibi_hyppaa_2_png, skin_Chibi_hyppaa_2_png_len},
|
||||||
|
{skin_Chibi_hyppaa_3_png, skin_Chibi_hyppaa_3_png_len},
|
||||||
|
{skin_Chibi_hyppaa_4_png, skin_Chibi_hyppaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_kiali[4] = {
|
||||||
|
{skin_Chibi_kiali_1_png, skin_Chibi_kiali_1_png_len},
|
||||||
|
{skin_Chibi_kiali_2_png, skin_Chibi_kiali_2_png_len},
|
||||||
|
{skin_Chibi_kiali_3_png, skin_Chibi_kiali_3_png_len},
|
||||||
|
{skin_Chibi_kiali_4_png, skin_Chibi_kiali_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_laukka[6] = {
|
||||||
|
{skin_Chibi_laukka_1_png, skin_Chibi_laukka_1_png_len},
|
||||||
|
{skin_Chibi_laukka_2_png, skin_Chibi_laukka_2_png_len},
|
||||||
|
{skin_Chibi_laukka_3_png, skin_Chibi_laukka_3_png_len},
|
||||||
|
{skin_Chibi_laukka_4_png, skin_Chibi_laukka_4_png_len},
|
||||||
|
{skin_Chibi_laukka_5_png, skin_Chibi_laukka_5_png_len},
|
||||||
|
{skin_Chibi_laukka_6_png, skin_Chibi_laukka_6_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_laukka2[6] = {
|
||||||
|
{skin_Chibi_laukka2_1_png, skin_Chibi_laukka2_1_png_len},
|
||||||
|
{skin_Chibi_laukka2_2_png, skin_Chibi_laukka2_2_png_len},
|
||||||
|
{skin_Chibi_laukka2_3_png, skin_Chibi_laukka2_3_png_len},
|
||||||
|
{skin_Chibi_laukka2_4_png, skin_Chibi_laukka2_4_png_len},
|
||||||
|
{skin_Chibi_laukka2_5_png, skin_Chibi_laukka2_5_png_len},
|
||||||
|
{skin_Chibi_laukka2_6_png, skin_Chibi_laukka2_6_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_paikka[4] = {
|
||||||
|
{skin_Chibi_paikka_1_png, skin_Chibi_paikka_1_png_len},
|
||||||
|
{skin_Chibi_paikka_2_png, skin_Chibi_paikka_2_png_len},
|
||||||
|
{skin_Chibi_paikka_3_png, skin_Chibi_paikka_3_png_len},
|
||||||
|
{skin_Chibi_paikka_4_png, skin_Chibi_paikka_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_pissaus[7] = {
|
||||||
|
{skin_Chibi_pissaus_1_png, skin_Chibi_pissaus_1_png_len},
|
||||||
|
{skin_Chibi_pissaus_2_png, skin_Chibi_pissaus_2_png_len},
|
||||||
|
{skin_Chibi_pissaus_3_png, skin_Chibi_pissaus_3_png_len},
|
||||||
|
{skin_Chibi_pissaus_4_png, skin_Chibi_pissaus_4_png_len},
|
||||||
|
{skin_Chibi_pissaus_5_png, skin_Chibi_pissaus_5_png_len},
|
||||||
|
{skin_Chibi_pissaus_6_png, skin_Chibi_pissaus_6_png_len},
|
||||||
|
{skin_Chibi_pissaus_7_png, skin_Chibi_pissaus_7_png_len},
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_platsahtaa[4] = {
|
||||||
|
{skin_Chibi_platsahtaa_1_png, skin_Chibi_platsahtaa_1_png_len},
|
||||||
|
{skin_Chibi_platsahtaa_2_png, skin_Chibi_platsahtaa_2_png_len},
|
||||||
|
{skin_Chibi_platsahtaa_3_png, skin_Chibi_platsahtaa_3_png_len},
|
||||||
|
{skin_Chibi_platsahtaa_4_png, skin_Chibi_platsahtaa_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_putoo[4] = {
|
||||||
|
{skin_Chibi_putoo_1_png, skin_Chibi_putoo_1_png_len},
|
||||||
|
{skin_Chibi_putoo_2_png, skin_Chibi_putoo_2_png_len},
|
||||||
|
{skin_Chibi_putoo_3_png, skin_Chibi_putoo_3_png_len},
|
||||||
|
{skin_Chibi_putoo_4_png, skin_Chibi_putoo_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_pyorii[4] = {
|
||||||
|
{skin_Chibi_pyorii_1_png, skin_Chibi_pyorii_1_png_len},
|
||||||
|
{skin_Chibi_pyorii_2_png, skin_Chibi_pyorii_2_png_len},
|
||||||
|
{skin_Chibi_pyorii_3_png, skin_Chibi_pyorii_3_png_len},
|
||||||
|
{skin_Chibi_pyorii_4_png, skin_Chibi_pyorii_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_pyoriivasemmalle[4] = {
|
||||||
|
{skin_Chibi_pyoriivasemmalle_1_png, skin_Chibi_pyoriivasemmalle_1_png_len},
|
||||||
|
{skin_Chibi_pyoriivasemmalle_2_png, skin_Chibi_pyoriivasemmalle_2_png_len},
|
||||||
|
{skin_Chibi_pyoriivasemmalle_3_png, skin_Chibi_pyoriivasemmalle_3_png_len},
|
||||||
|
{skin_Chibi_pyoriivasemmalle_4_png, skin_Chibi_pyoriivasemmalle_4_png_len}
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_roikkuu[1] = {
|
||||||
|
{skin_Chibi_roikkuu_1_png, skin_Chibi_roikkuu_1_png_len},
|
||||||
|
};
|
||||||
|
embed_data skin_Chibi_rouskutus[4] = {
|
||||||
|
{skin_Chibi_rouskutus_1_png, skin_Chibi_rouskutus_1_png_len},
|
||||||
|
{skin_Chibi_rouskutus_2_png, skin_Chibi_rouskutus_2_png_len},
|
||||||
|
{skin_Chibi_rouskutus_3_png, skin_Chibi_rouskutus_3_png_len},
|
||||||
|
{skin_Chibi_rouskutus_4_png, skin_Chibi_rouskutus_4_png_len}
|
||||||
|
};
|
||||||
|
|
||||||
|
embed_data *skin_Chibi[15] = {
|
||||||
|
skin_Chibi_falling,
|
||||||
|
skin_Chibi_haukahdus,
|
||||||
|
skin_Chibi_hoksaa,
|
||||||
|
skin_Chibi_hyppaa,
|
||||||
|
skin_Chibi_kiali,
|
||||||
|
skin_Chibi_laukka,
|
||||||
|
skin_Chibi_laukka2,
|
||||||
|
skin_Chibi_paikka,
|
||||||
|
skin_Chibi_pissaus,
|
||||||
|
skin_Chibi_platsahtaa,
|
||||||
|
skin_Chibi_putoo,
|
||||||
|
skin_Chibi_pyorii,
|
||||||
|
skin_Chibi_pyoriivasemmalle,
|
||||||
|
skin_Chibi_roikkuu,
|
||||||
|
skin_Chibi_rouskutus
|
||||||
|
};
|
||||||
|
|
||||||
|
map <string, int> img_name_map = {
|
||||||
|
{"falling", 0},
|
||||||
|
{"haukahdus", 1},
|
||||||
|
{"hoksaa", 2},
|
||||||
|
{"hyppaa", 3},
|
||||||
|
{"kiali", 4},
|
||||||
|
{"laukka", 5},
|
||||||
|
{"laukka2", 6},
|
||||||
|
{"paikka", 7},
|
||||||
|
{"pissaus", 8},
|
||||||
|
{"platsahtaa", 9},
|
||||||
|
{"putoo", 10},
|
||||||
|
{"pyorii", 11},
|
||||||
|
{"pyoriivasemmalle", 12},
|
||||||
|
{"roikkuu", 13},
|
||||||
|
{"rouskutus", 14}
|
||||||
|
};
|
||||||
|
|
||||||
|
class SkinsEmbed {
|
||||||
|
public:
|
||||||
|
embed_data *getSkin(string skin, string img_name) {
|
||||||
|
//return NULL;
|
||||||
|
if (skin == "Tavallinen") {
|
||||||
|
return skin_Tavallinen[img_name_map[img_name]];
|
||||||
|
} else if (skin == "Alppisusi") {
|
||||||
|
return skin_Alppisusi[img_name_map[img_name]];
|
||||||
|
} else if (skin == "Chibi") {
|
||||||
|
return skin_Chibi[img_name_map[img_name]];
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pair<unsigned char *, unsigned int> getSound(string skin, string img_name) {
|
||||||
|
//return make_pair((unsigned char *) NULL, 0);
|
||||||
|
if (skin == "Tavallinen") {
|
||||||
|
if (img_name == "haukahdus") {
|
||||||
|
return make_pair(skin_Tavallinen_haukahdus_roh2_wav, skin_Tavallinen_haukahdus_roh2_wav_len);
|
||||||
|
} else if (img_name == "platsahtaa") {
|
||||||
|
return make_pair(skin_Tavallinen_platsahtaa_tomsmaahan_wav, skin_Tavallinen_platsahtaa_tomsmaahan_wav_len);
|
||||||
|
}
|
||||||
|
} else if (skin == "Alppisusi") {
|
||||||
|
if (img_name == "haukahdus") {
|
||||||
|
return make_pair(skin_Alppisusi_haukahdus_roh_wav, skin_Alppisusi_haukahdus_roh_wav_len);
|
||||||
|
} else if (img_name == "platsahtaa") {
|
||||||
|
return make_pair(skin_Alppisusi_platsahtaa_tomsmaahan_wav, skin_Alppisusi_platsahtaa_tomsmaahan_wav_len);
|
||||||
|
}
|
||||||
|
} else if (skin == "Chibi") {
|
||||||
|
if (img_name == "haukahdus") {
|
||||||
|
return make_pair(skin_Chibi_haukahdus_roh_wav, skin_Chibi_haukahdus_roh_wav_len);
|
||||||
|
} else if (img_name == "platsahtaa") {
|
||||||
|
return make_pair(skin_Chibi_platsahtaa_tomsmaahan_wav, skin_Chibi_platsahtaa_tomsmaahan_wav_len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return make_pair((unsigned char *) NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
string getParams(string skin) {
|
||||||
|
//return "";
|
||||||
|
if (skin == "Tavallinen") {
|
||||||
|
return string((char *)skin_Tavallinen_tsk, skin_Tavallinen_tsk_len);
|
||||||
|
} else if (skin == "Alppisusi") {
|
||||||
|
return string((char *)skin_Alppisusi_tsk, skin_Alppisusi_tsk_len);
|
||||||
|
} else if (skin == "Chibi") {
|
||||||
|
return string((char *)skin_Chibi_tsk, skin_Chibi_tsk_len);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
192
main.cpp
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3_image/SDL_image.h>
|
||||||
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include "Animal.h"
|
||||||
|
#include "NewDialogs/DlgMainMenu.h"
|
||||||
|
#include "Sound.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (!SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO)) {
|
||||||
|
SDL_Log("Could not init SDL %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!TTF_Init()) {
|
||||||
|
SDL_Log("TTF_Init: %s", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Window *sdl_window = SDL_CreateWindow("Rousku", 10, 10, SDL_WINDOW_TRANSPARENT | SDL_WINDOW_BORDERLESS | SDL_WINDOW_UTILITY | SDL_WINDOW_ALWAYS_ON_TOP);
|
||||||
|
if (sdl_window == NULL) {
|
||||||
|
SDL_Log("error creating window");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
SDL_WindowID sdl_window_id = SDL_GetWindowID(sdl_window);
|
||||||
|
|
||||||
|
SDL_Window *sdl_menu_win = SDL_CreateWindow("Rouskun asetukset", 10, 10, SDL_WINDOW_HIDDEN);
|
||||||
|
if (sdl_menu_win == NULL) {
|
||||||
|
SDL_Log("error creating window");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Renderer *sdl_renderer = SDL_CreateRenderer(sdl_window, NULL);
|
||||||
|
if (sdl_renderer == NULL) {
|
||||||
|
SDL_Log("error creating renderer");
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Renderer *sdl_menu_renderer = SDL_CreateRenderer(sdl_menu_win, NULL);
|
||||||
|
if (sdl_menu_renderer == NULL) {
|
||||||
|
SDL_Log("error creating renderer");
|
||||||
|
}
|
||||||
|
|
||||||
|
Sound sound;
|
||||||
|
|
||||||
|
bool press = false;
|
||||||
|
Uint64 prev_press_ticks = 0;
|
||||||
|
float mouse_win_rel_x, mouse_win_rel_y;
|
||||||
|
SDL_Rect old_menu_size = { 10, 10, 0, 0 };
|
||||||
|
DlgMainMenu *dlg_menu = new DlgMainMenu();
|
||||||
|
|
||||||
|
Animal rousku(dlg_menu->getSkin());
|
||||||
|
|
||||||
|
int num_displays;
|
||||||
|
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);
|
||||||
|
SDL_Log("Found %d display(s)", num_displays);
|
||||||
|
for (unsigned i = 0; i < num_displays; i++) {
|
||||||
|
SDL_Log("Display %d", displays[i]);
|
||||||
|
const SDL_DisplayMode *dm = SDL_GetCurrentDisplayMode(displays[i]);
|
||||||
|
if (!dm) {
|
||||||
|
SDL_Log("Couldn't get display mode: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Log("screen w %d h %d", dm->w, dm->h);
|
||||||
|
rousku.disp_pos.w = dm->w;
|
||||||
|
rousku.disp_pos.h = dm->h;
|
||||||
|
rousku.disp_pos.x = dm->w / 2;
|
||||||
|
rousku.disp_pos.y = dm->h / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get MOUSE_DOWN event when clicking unfocused window
|
||||||
|
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
|
||||||
|
|
||||||
|
while (!dlg_menu->isAppExit()) {
|
||||||
|
SDL_Event event;
|
||||||
|
SDL_zero(event);
|
||||||
|
while (SDL_PollEvent(&event)) {
|
||||||
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
|
} else if (event.type == SDL_EVENT_KEY_UP) {
|
||||||
|
} else if (event.type == SDL_EVENT_QUIT) {
|
||||||
|
dlg_menu->setAppExit(true);
|
||||||
|
} else if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
|
||||||
|
if (event.button.windowID == sdl_window_id) {
|
||||||
|
SDL_Log("btn down");
|
||||||
|
rousku.setSpecialState(hang);
|
||||||
|
press = true;
|
||||||
|
mouse_win_rel_x = event.button.x;
|
||||||
|
mouse_win_rel_y = event.button.y;
|
||||||
|
Uint64 ticks = SDL_GetTicks();
|
||||||
|
|
||||||
|
// show menu if double clicking
|
||||||
|
if (ticks - prev_press_ticks < 300) {
|
||||||
|
dlg_menu->setExit(false);
|
||||||
|
}
|
||||||
|
prev_press_ticks = ticks;
|
||||||
|
} else {
|
||||||
|
dlg_menu->onMousePress(event.button.x, event.button.y);
|
||||||
|
}
|
||||||
|
} else if (event.type == SDL_EVENT_MOUSE_BUTTON_UP) {
|
||||||
|
if (press) {
|
||||||
|
SDL_Log("btn up");
|
||||||
|
rousku.setSpecialState(drop);
|
||||||
|
rousku.resetTimes(SDL_GetTicks());
|
||||||
|
press = false;
|
||||||
|
} else {
|
||||||
|
dlg_menu->onMouseRelease(event.button.x, event.button.y);
|
||||||
|
}
|
||||||
|
} else if (event.type == SDL_EVENT_MOUSE_MOTION) {
|
||||||
|
if (event.button.windowID == sdl_window_id) {
|
||||||
|
if (press) {
|
||||||
|
float motion_x, motion_y;
|
||||||
|
SDL_GetGlobalMouseState(&motion_x, &motion_y);
|
||||||
|
rousku.disp_pos.x = motion_x - mouse_win_rel_x;
|
||||||
|
rousku.disp_pos.y = motion_y - mouse_win_rel_y;
|
||||||
|
} else if (dlg_menu->isRunAwayFromMouse()) {
|
||||||
|
rousku.shouldRunAway(event.motion.x < (float) rousku.getImage()->w / 2 ? 1 : -1); // selecting direction to run in parameter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string changed_setting = dlg_menu->getChangedSetting();
|
||||||
|
if (changed_setting == "skin_list") {
|
||||||
|
rousku.readSkin(dlg_menu->getSkin());
|
||||||
|
rousku.setSpecialState(drop);
|
||||||
|
}
|
||||||
|
Uint64 delay = rousku.step(SDL_GetTicks(), press);
|
||||||
|
if (rousku.hasStateChanged()) {
|
||||||
|
sound.closeSound(); // so it will be reloaded with right format
|
||||||
|
}
|
||||||
|
SDL_Surface *animal_sfe = rousku.getImage();
|
||||||
|
|
||||||
|
SDL_Texture *sdl_texture = SDL_CreateTexture(sdl_renderer, animal_sfe->format, SDL_TEXTUREACCESS_STREAMING, animal_sfe->w, animal_sfe->h);
|
||||||
|
if (!sdl_texture) {
|
||||||
|
SDL_Log("Couldn't create texture: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_SetWindowPosition(sdl_window, rousku.disp_pos.x, rousku.disp_pos.y);
|
||||||
|
SDL_SetWindowSize(sdl_window, animal_sfe->w, animal_sfe->h);
|
||||||
|
SDL_SetWindowShape(sdl_window, animal_sfe);
|
||||||
|
|
||||||
|
SDL_UpdateTexture(sdl_texture, NULL, animal_sfe->pixels, animal_sfe->pitch);
|
||||||
|
SDL_RenderClear(sdl_renderer);
|
||||||
|
SDL_RenderTexture(sdl_renderer, sdl_texture, NULL, NULL);
|
||||||
|
SDL_RenderPresent(sdl_renderer);
|
||||||
|
|
||||||
|
SDL_DestroyTexture(sdl_texture);
|
||||||
|
if (dlg_menu->isExit()) {
|
||||||
|
SDL_HideWindow(sdl_menu_win);
|
||||||
|
} else {
|
||||||
|
dlg_menu->setPreviewSurface(rousku.getPreviewSurface());
|
||||||
|
|
||||||
|
SDL_Surface *dlg_menu_sfe = dlg_menu->getSurface();
|
||||||
|
SDL_Texture *sdl_menu_texture = SDL_CreateTexture(sdl_menu_renderer, dlg_menu_sfe->format, SDL_TEXTUREACCESS_STREAMING, dlg_menu_sfe->w, dlg_menu_sfe->h);
|
||||||
|
if (!sdl_menu_texture) {
|
||||||
|
SDL_Log("Couldn't create texture: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (dlg_menu_sfe->w != old_menu_size.w || dlg_menu_sfe->h != old_menu_size.h) {
|
||||||
|
SDL_SetWindowSize(sdl_menu_win, dlg_menu_sfe->w, dlg_menu_sfe->h);
|
||||||
|
old_menu_size.w = dlg_menu_sfe->w;
|
||||||
|
old_menu_size.h = dlg_menu_sfe->h;
|
||||||
|
}
|
||||||
|
SDL_UpdateTexture(sdl_menu_texture, NULL, dlg_menu_sfe->pixels, dlg_menu_sfe->pitch);
|
||||||
|
SDL_RenderClear(sdl_menu_renderer);
|
||||||
|
SDL_RenderTexture(sdl_menu_renderer, sdl_menu_texture, NULL, NULL);
|
||||||
|
SDL_RenderPresent(sdl_menu_renderer);
|
||||||
|
|
||||||
|
SDL_DestroyTexture(sdl_menu_texture);
|
||||||
|
SDL_ShowWindow(sdl_menu_win);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dlg_menu->isEnableSound()) {
|
||||||
|
SoundData *sd = rousku.getSound();
|
||||||
|
sound.setSound(sd);
|
||||||
|
} else {
|
||||||
|
sound.closeSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_SetWindowAlwaysOnTop(sdl_window, dlg_menu->isAlwaysOnTop()); // FIXME on false seems to stay behind tint2, but otherwis still stays on top of normal windows, maybe because of UTILITY-window?
|
||||||
|
|
||||||
|
SDL_Delay(delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_DestroyWindow(sdl_window);
|
||||||
|
SDL_Quit();
|
||||||
|
TTF_Quit();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
122
skin/Alppisusi.tsk
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
name=jump
|
||||||
|
img_name=hyppaa
|
||||||
|
count=4
|
||||||
|
interval=200
|
||||||
|
x=0
|
||||||
|
y=-7
|
||||||
|
|
||||||
|
name=pee
|
||||||
|
img_name=pissaus
|
||||||
|
count=7
|
||||||
|
interval=20
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=roll_left
|
||||||
|
img_name=pyoriivasemmalle
|
||||||
|
count=4
|
||||||
|
interval=150
|
||||||
|
x=-3
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=roll_right
|
||||||
|
img_name=pyorii
|
||||||
|
count=4
|
||||||
|
interval=150
|
||||||
|
x=3
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=notice
|
||||||
|
img_name=hoksaa
|
||||||
|
count=4
|
||||||
|
interval=100
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=tongue
|
||||||
|
img_name=kiali
|
||||||
|
count=4
|
||||||
|
interval=100
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=crunch
|
||||||
|
img_name=rouskutus
|
||||||
|
count=4
|
||||||
|
interval=200
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=bark
|
||||||
|
img_name=haukahdus
|
||||||
|
count=4
|
||||||
|
interval=120
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
sound=roh.wav
|
||||||
|
loop=1
|
||||||
|
|
||||||
|
name=jump_end
|
||||||
|
img_name=falling
|
||||||
|
count=4
|
||||||
|
interval=200
|
||||||
|
x=0
|
||||||
|
y=9
|
||||||
|
|
||||||
|
name=left
|
||||||
|
img_name=laukka2
|
||||||
|
count=6
|
||||||
|
interval=200
|
||||||
|
x=-1
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=right
|
||||||
|
img_name=laukka
|
||||||
|
count=6
|
||||||
|
interval=200
|
||||||
|
x=1
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=fast_left
|
||||||
|
img_name=laukka2
|
||||||
|
count=6
|
||||||
|
interval=50
|
||||||
|
x=-5
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=fast_right
|
||||||
|
img_name=laukka
|
||||||
|
count=6
|
||||||
|
interval=50
|
||||||
|
x=5
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=drop
|
||||||
|
img_name=putoo
|
||||||
|
count=4
|
||||||
|
interval=100
|
||||||
|
x=0
|
||||||
|
y=10
|
||||||
|
|
||||||
|
name=stay
|
||||||
|
img_name=paikka
|
||||||
|
count=4
|
||||||
|
interval=200
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
|
||||||
|
name=flop
|
||||||
|
img_name=platsahtaa
|
||||||
|
count=4
|
||||||
|
interval=100
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
|
sound=tomsmaahan.wav
|
||||||
|
loop=0
|
||||||
|
|
||||||
|
name=hang
|
||||||
|
img_name=roikkuu
|
||||||
|
count=1
|
||||||
|
interval=1000
|
||||||
|
x=0
|
||||||
|
y=0
|
||||||
BIN
skin/Alppisusi/falling/1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/falling/2.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/falling/3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/falling/4.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/haukahdus/1.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/haukahdus/2.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/haukahdus/3.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/haukahdus/4.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/haukahdus/roh.wav
Normal file
BIN
skin/Alppisusi/hoksaa/1.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/hoksaa/2.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/hoksaa/3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/hoksaa/4.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/hyppaa/1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/hyppaa/2.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/hyppaa/3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/hyppaa/4.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/kiali/1.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
skin/Alppisusi/kiali/2.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
skin/Alppisusi/kiali/3.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/kiali/4.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/laukka/1.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka/2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka/3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/laukka/4.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka/5.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/laukka/6.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/laukka2/1.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka2/2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka2/3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka2/4.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/laukka2/5.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/laukka2/6.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/paikka/1.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/paikka/2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/paikka/3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/paikka/4.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/pissaus/1.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/pissaus/2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/pissaus/3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/pissaus/4.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/pissaus/5.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/pissaus/6.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/pissaus/7.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/platsahtaa/1.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/platsahtaa/2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/platsahtaa/3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/platsahtaa/4.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
skin/Alppisusi/platsahtaa/tomsmaahan.wav
Normal file
BIN
skin/Alppisusi/putoo/1.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
skin/Alppisusi/putoo/2.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
skin/Alppisusi/putoo/3.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
skin/Alppisusi/putoo/4.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
skin/Alppisusi/pyorii/1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
skin/Alppisusi/pyorii/2.png
Normal file
|
After Width: | Height: | Size: 974 B |
BIN
skin/Alppisusi/pyorii/3.png
Normal file
|
After Width: | Height: | Size: 1001 B |
BIN
skin/Alppisusi/pyorii/4.png
Normal file
|
After Width: | Height: | Size: 975 B |
BIN
skin/Alppisusi/pyoriivasemmalle/1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
skin/Alppisusi/pyoriivasemmalle/2.png
Normal file
|
After Width: | Height: | Size: 975 B |
BIN
skin/Alppisusi/pyoriivasemmalle/3.png
Normal file
|
After Width: | Height: | Size: 997 B |
BIN
skin/Alppisusi/pyoriivasemmalle/4.png
Normal file
|
After Width: | Height: | Size: 974 B |
BIN
skin/Alppisusi/roikkuu/1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
skin/Alppisusi/rouskutus/1.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/rouskutus/2.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
skin/Alppisusi/rouskutus/3.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |