Remove SLK_config.h, update SLKIMAGE files, add SLK_core_set_visible
Scrapped idea of optional features, Things like that will be managed as seperate, complete projects with SoftLKlib as a git submodule. Those subprojects should come with a set of tools.
This commit is contained in:
parent
7d9bd5bb45
commit
012737d608
11 changed files with 41 additions and 62 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,20 +0,0 @@
|
||||||
JASC-PAL
|
|
||||||
0100
|
|
||||||
17
|
|
||||||
0 0 0
|
|
||||||
69 36 52
|
|
||||||
20 12 28
|
|
||||||
211 170 154
|
|
||||||
223 239 215
|
|
||||||
211 125 44
|
|
||||||
219 215 93
|
|
||||||
211 69 73
|
|
||||||
134 77 48
|
|
||||||
77 73 77
|
|
||||||
48 52 109
|
|
||||||
117 113 97
|
|
||||||
109 195 203
|
|
||||||
134 150 162
|
|
||||||
109 170 44
|
|
||||||
52 101 36
|
|
||||||
89 125 207
|
|
|
@ -14,20 +14,22 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
int canvas_pos_x = 128;
|
int canvas_pos_x = 128;
|
||||||
int canvas_pos_y = 128;
|
int canvas_pos_y = 128;
|
||||||
float canvas_scale = 2.0f;
|
float canvas_scale = 1.0f;
|
||||||
SLK_layer_create(0,SLK_LAYER_RGB);
|
SLK_layer_create(0,SLK_LAYER_PAL);
|
||||||
SLK_layer_activate(0,1);
|
SLK_layer_activate(0,1);
|
||||||
SLK_layer_set_current(0);
|
SLK_layer_set_current(0);
|
||||||
SLK_draw_rgb_set_changed(1);
|
|
||||||
SLK_layer_set_dynamic(0,0);
|
SLK_layer_set_dynamic(0,0);
|
||||||
SLK_layer_set_size(0,256,224);
|
|
||||||
SLK_layer_set_pos(0,canvas_pos_x,canvas_pos_y);
|
SLK_layer_set_pos(0,canvas_pos_x,canvas_pos_y);
|
||||||
SLK_layer_set_scale(0,canvas_scale);
|
SLK_layer_set_scale(0,canvas_scale);
|
||||||
SLK_draw_rgb_set_clear_color(SLK_color_create(255,255,255,255));
|
SLK_draw_pal_set_clear_paxel(SLK_color_create_paxel(0,0));
|
||||||
SLK_draw_rgb_clear();
|
SLK_draw_pal_clear();
|
||||||
SLK_RGB_sprite *logo = SLK_rgb_sprite_load("assets/logo.png");
|
SLK_Pal_sprite *logo = SLK_pal_sprite_load("assets/0.slk");
|
||||||
SLK_draw_rgb_sprite(logo,0,0);
|
SLK_layer_set_size(0,logo->width,logo->height);
|
||||||
SLK_rgb_sprite_destroy(logo);
|
SLK_draw_pal_clear();
|
||||||
|
SLK_draw_pal_sprite(logo,0,0);
|
||||||
|
SLK_pal_sprite_destroy(logo);
|
||||||
|
SLK_layer_set_palette(0,SLK_palette_load("data/3-3-2.pal"));
|
||||||
|
|
||||||
|
|
||||||
while(SLK_core_running())
|
while(SLK_core_running())
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,6 +125,7 @@ void SLK_setup(int width, int height, int layer_num, const char *title, int full
|
||||||
void SLK_update();
|
void SLK_update();
|
||||||
void SLK_core_set_title(const char *title);
|
void SLK_core_set_title(const char *title);
|
||||||
void SLK_core_set_fullscreen(int fullscreen);
|
void SLK_core_set_fullscreen(int fullscreen);
|
||||||
|
void SLK_core_set_visible(int visible);
|
||||||
void SLK_core_set_icon(const SLK_RGB_sprite *icon);
|
void SLK_core_set_icon(const SLK_RGB_sprite *icon);
|
||||||
int SLK_core_get_width();
|
int SLK_core_get_width();
|
||||||
int SLK_core_get_height();
|
int SLK_core_get_height();
|
||||||
|
|
20
lib/makefile
20
lib/makefile
|
@ -4,34 +4,34 @@ libSLK.a: glad.o SLK_core.o SLK_color.o SLK_draw_pal.o SLK_draw_rgb.o SLK_input.
|
||||||
glad.o: ../src/glad/glad.c ../include/glad/glad.h
|
glad.o: ../src/glad/glad.c ../include/glad/glad.h
|
||||||
gcc -O3 -c $< -lm -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_core.o: ../src/SLK/SLK_core.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_input_i.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_draw_rgb_i.h ../src/SLK/SLK_draw_pal_i.h ../src/SLK/SLK_layer_i.h ../src/SLK/SLK_config.h
|
SLK_core.o: ../src/SLK/SLK_core.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_input_i.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_draw_rgb_i.h ../src/SLK/SLK_draw_pal_i.h ../src/SLK/SLK_layer_i.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_color.o: ../src/SLK/SLK_color.c ../include/SLK/SLK_functions.h ../include/SLK/SLK_types.h ../src/SLK/SLK_config.h
|
SLK_color.o: ../src/SLK/SLK_color.c ../include/SLK/SLK_functions.h ../include/SLK/SLK_types.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_draw_pal.o: ../src/SLK/SLK_draw_pal.c ../include/SLK/SLK_functions.h ../include/SLK/SLK_types.h ../src/SLK/SLK_draw_pal_i.h ../src/SLK/SLK_config.h
|
SLK_draw_pal.o: ../src/SLK/SLK_draw_pal.c ../include/SLK/SLK_functions.h ../include/SLK/SLK_types.h ../src/SLK/SLK_draw_pal_i.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_draw_rgb.o: ../src/SLK/SLK_draw_rgb.c ../include/SLK/SLK_functions.h ../include/SLK/SLK_types.h ../src/SLK/SLK_draw_rgb_i.h ../src/SLK/SLK_config.h
|
SLK_draw_rgb.o: ../src/SLK/SLK_draw_rgb.c ../include/SLK/SLK_functions.h ../include/SLK/SLK_types.h ../src/SLK/SLK_draw_rgb_i.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_input.o: ../src/SLK/SLK_input.c ../include/SLK/SLK_types.h ../src/SLK/SLK_input_i.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_layer_i.h ../src/SLK/SLK_config.h
|
SLK_input.o: ../src/SLK/SLK_input.c ../include/SLK/SLK_types.h ../src/SLK/SLK_input_i.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_layer_i.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_layer.o: ../src/SLK/SLK_layer.c ../include/glad/glad.h ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_draw_rgb_i.h ../src/SLK/SLK_draw_pal_i.h ../src/SLK/SLK_layer_i.h ../src/SLK/SLK_config.h
|
SLK_layer.o: ../src/SLK/SLK_layer.c ../include/glad/glad.h ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_draw_rgb_i.h ../src/SLK/SLK_draw_pal_i.h ../src/SLK/SLK_layer_i.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_palette.o: ../src/SLK/SLK_palette.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_config.h
|
SLK_palette.o: ../src/SLK/SLK_palette.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_render.o: ../src/SLK/SLK_render.c ../include/glad/glad.h ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_layer_i.h ../src/SLK/SLK_config.h
|
SLK_render.o: ../src/SLK/SLK_render.c ../include/glad/glad.h ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_render_i.h ../src/SLK/SLK_layer_i.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_sprite_pal.o: ../src/SLK/SLK_sprite_pal.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_config.h
|
SLK_sprite_pal.o: ../src/SLK/SLK_sprite_pal.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_sprite_rgb.o: ../src/SLK/SLK_sprite_rgb.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h ../src/SLK/SLK_config.h
|
SLK_sprite_rgb.o: ../src/SLK/SLK_sprite_rgb.c ../include/SLK/SLK_types.h ../include/SLK/SLK_functions.h
|
||||||
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
gcc -O3 -c $< -lm -lSDL2 -ldl -lGL -Wall
|
||||||
|
|
||||||
SLK_timer.o: ../src/SLK/SLK_timer.c ../include/SLK/SLK_functions.h
|
SLK_timer.o: ../src/SLK/SLK_timer.c ../include/SLK/SLK_functions.h
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 2020, Lukas Holzbeierlein (Captain4LK)
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _SLK_CONFIG_H_
|
|
||||||
|
|
||||||
#define _SLK_CONFIG_H_
|
|
||||||
|
|
||||||
//SLK config file,
|
|
||||||
//optional features are specified here
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -64,6 +64,7 @@ void SLK_core_set_title(const char *title)
|
||||||
SDL_SetWindowTitle(sdl_window,title);
|
SDL_SetWindowTitle(sdl_window,title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sets the window in windowed or fullscreen mode.
|
||||||
void SLK_core_set_fullscreen(int fullscreen)
|
void SLK_core_set_fullscreen(int fullscreen)
|
||||||
{
|
{
|
||||||
if(fullscreen)
|
if(fullscreen)
|
||||||
|
@ -79,6 +80,15 @@ void SLK_core_set_fullscreen(int fullscreen)
|
||||||
SLK_i_render_update_viewport();
|
SLK_i_render_update_viewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Shows or hides the window.
|
||||||
|
void SLK_core_set_visible(int visible)
|
||||||
|
{
|
||||||
|
if(visible)
|
||||||
|
SDL_ShowWindow(sdl_window);
|
||||||
|
else
|
||||||
|
SDL_HideWindow(sdl_window);
|
||||||
|
}
|
||||||
|
|
||||||
//Sets the icon of the window.
|
//Sets the icon of the window.
|
||||||
//I did not test this since I am using
|
//I did not test this since I am using
|
||||||
//a window manager without titlebars.
|
//a window manager without titlebars.
|
||||||
|
|
|
@ -96,6 +96,7 @@ SLK_Pal_sprite *SLK_pal_sprite_load(const char *path)
|
||||||
FILE *f = fopen(path,"rb");
|
FILE *f = fopen(path,"rb");
|
||||||
SLK_Pal_sprite *s = NULL;
|
SLK_Pal_sprite *s = NULL;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
char file_type[512];
|
||||||
|
|
||||||
if(f==NULL)
|
if(f==NULL)
|
||||||
{
|
{
|
||||||
|
@ -103,6 +104,14 @@ SLK_Pal_sprite *SLK_pal_sprite_load(const char *path)
|
||||||
|
|
||||||
return SLK_pal_sprite_create(1,1);
|
return SLK_pal_sprite_create(1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fread(file_type,sizeof(char),8,f);
|
||||||
|
file_type[8] = '\0';
|
||||||
|
if(strcmp(file_type,"SLKIMAGE")!=0)
|
||||||
|
{
|
||||||
|
printf("%s does not seem to be a SLKIMAGE file\n",path);
|
||||||
|
return SLK_pal_sprite_create(1,1);
|
||||||
|
}
|
||||||
|
|
||||||
fread(&width,sizeof(int),1,f);
|
fread(&width,sizeof(int),1,f);
|
||||||
fread(&height,sizeof(int),1,f);
|
fread(&height,sizeof(int),1,f);
|
||||||
|
|
Loading…
Reference in a new issue