Not yet, it's using the GPU_NEAREST filter right now. I could change it to GPU_LINEAR easily: https://github.com/xerpi/sf2dlib/blob/master/libsf2d/source/sf2d_texture.c#L165Hi, is there an easy way to apply filtering/anti-aliasing/whatever when drawing a texture with scaling? Cheers
Cool thanks, I guess it would be nice to have the choiceNot yet, it's using the GPU_NEAREST filter right now. I could change it to GPU_LINEAR easily: https://github.com/xerpi/sf2dlib/blob/master/libsf2d/source/sf2d_texture.c#L165
You need to install Python: https://www.python.org/downloads/If i want to compile a programm with this library i got this message
shader.vsh
make[1]: python: Command not found
make[1]: *** [shader.vsh.o] Error 127
make: *** [build] Error 2
can someone help me
I already installed (2.7 and 3.4.3)You need to install Python: https://www.python.org/downloads/
Try setting the environment variables (PATH) to point to the python binaries.I already installed (2.7 and 3.4.3)
So i am confused
Ok it worked. Thanks!Try setting the environment variables (PATH) to point to the python binaries.
#include <stdio.h>
#include <3ds.h>
#include <sf2d.h>
touchPosition Stylus;
u32 kDown;
u32 kHeld;
extern const struct {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel;
unsigned char pixel_data[];
} number_img, colorzone_img;
typedef struct
{
sf2d_texture * texture;
}
images;
images numbers, colorzone;
int base10_length(u32 number)
{
int length = 1;
while (number > 9) {
length++;
number /= 10;
}
return length;
}
void draw_number_base10(u32 number, u16 posx, u16 posy)
{
int num_len = base10_length(number);
u16 cur_posx = posx + (num_len - 1) * 12;
while (number > 0) {
u8 digit = number % 10;
sf2d_draw_texture_part(numbers.texture, cur_posx, posy, digit*8, 0, 8, 10);
cur_posx -= 12;
number /= 10;
}
}
int main()
{
sf2d_init();
//sf2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
numbers.texture = sf2d_create_texture(number_img.width, number_img.height, GPU_RGBA8, SF2D_PLACE_RAM);
sf2d_fill_texture_from_RGBA8(numbers.texture, number_img.pixel_data, number_img.width, number_img.height);
sf2d_texture_tile32(numbers.texture);
colorzone.texture = sf2d_create_texture(colorzone_img.width, colorzone_img.height, GPU_RGBA8, SF2D_PLACE_RAM);
sf2d_fill_texture_from_RGBA8(colorzone.texture, colorzone_img.pixel_data, colorzone_img.width, colorzone_img.height);
sf2d_texture_tile32(colorzone.texture);
u32 color = 0;
while (aptMainLoop()) {
hidScanInput();
u32 held = hidKeysHeld();
if (held & KEY_TOUCH) {
hidTouchRead(&Stylus);
color = sf2d_get_pixel(colorzone.texture, Stylus.px, Stylus.py);
}
if (held & KEY_START) break;
sf2d_start_frame(GFX_TOP, GFX_LEFT);
sf2d_draw_rectangle(0, 0, 400, 240, __builtin_bswap32(color));
sf2d_end_frame();
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
sf2d_draw_texture(colorzone.texture, 0, 0);
draw_number_base10(color, 10, 10);
sf2d_end_frame();
sf2d_swapbuffers();
}
sf2d_free_texture(numbers.texture);
sf2d_free_texture(colorzone.texture);
sf2d_fini();
return 0;
}
linking sf2d_sample.elf
d:/devkitPro/libctru/lib\libsf2d.a(sf2d.o): In function `sf2d_init_advanced':
d:/devkitPro/ctrulib/sf2dlib-master/libsf2d/source/sf2d.c:88: undefined reference to `shader_vsh_shbin_size'
d:/devkitPro/ctrulib/sf2dlib-master/libsf2d/source/sf2d.c:88: undefined reference to `shader_vsh_shbin'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/d/devkitPro/ctrulib/sf2dlib-master/sample/sf2d_sample.elf] Error
1
make: *** [build] Error 2
Can't immediately see where that's from, but is your ctrulib up to date?
D:\devkitPro\ctrulib\libctru>make install
make[1]: `/d/devkitPro/ctrulib/libctru/lib/libctru.a' is up to date.
mkdir -p /D/devkitPro/libctru
bzip2 -cd libctru-0.5.0.tar.bz2 | tar -x -C /D/devkitPro/libctru
shader.vsh
/bin/sh: bin2s: command not found
sf2d.c
bin2s is a devkitPro program, so your environment path variables probably aren't set up right. Look at a devkitARM installation guide again.
My PATH variable was always pointing to the devitARM/bin folder, but in there are a lot of exe s, but no bin2s.exe ?! I tried to update my devkitPro, but there is no aviable update. What can I do? :/Exactly, his PATH environment variable isn't pointing to the devkitARM/bin folder.