mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-15 15:14:16 +00:00
Fixed the tests
This commit is contained in:
parent
7a0913c2cf
commit
c50df75059
@ -55,7 +55,7 @@ int main (int argc, char *argv[])
|
|||||||
ji_set_standard_theme();
|
ji_set_standard_theme();
|
||||||
|
|
||||||
jmanager_refresh_screen();
|
jmanager_refresh_screen();
|
||||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||||
|
|
||||||
jalert("Normal==First Alert||&Ok");
|
jalert("Normal==First Alert||&Ok");
|
||||||
jalert ("Error"
|
jalert ("Error"
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <allegro.h>
|
#include <allegro.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "jinete/jinete/jinete.h"
|
#include "jinete/jinete.h"
|
||||||
|
|
||||||
static JWidget check, radio[12];
|
static JWidget check, radio[12];
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ void set_my_palette (void)
|
|||||||
/* Theme */
|
/* Theme */
|
||||||
|
|
||||||
static void theme_regen(void);
|
static void theme_regen(void);
|
||||||
static void theme_set_cursor (int type);
|
static BITMAP *theme_set_cursor(int type, int *focus_x, int *focus_y);
|
||||||
static void theme_init_widget(JWidget widget);
|
static void theme_init_widget(JWidget widget);
|
||||||
static JRegion theme_get_window_mask(JWidget widget);
|
static JRegion theme_get_window_mask(JWidget widget);
|
||||||
|
|
||||||
@ -212,9 +212,9 @@ static void theme_regen (void)
|
|||||||
ji_get_theme()->desktop_color = makecol(0, 128, 196);
|
ji_get_theme()->desktop_color = makecol(0, 128, 196);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void theme_set_cursor (int type)
|
static BITMAP *theme_set_cursor(int type, int *focus_x, int *focus_y)
|
||||||
{
|
{
|
||||||
set_mouse_sprite (NULL); /* use default Allegro cursor */
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void theme_init_widget(JWidget widget)
|
static void theme_init_widget(JWidget widget)
|
||||||
|
@ -137,8 +137,8 @@ static bool tip_hook(JWidget widget, JMessage msg)
|
|||||||
int h = jrect_h(window->rc);
|
int h = jrect_h(window->rc);
|
||||||
jwindow_remap(window);
|
jwindow_remap(window);
|
||||||
jwindow_position(window,
|
jwindow_position(window,
|
||||||
MID (0, ji_mouse_x (0)-w/2, JI_SCREEN_W-w),
|
MID(0, jmouse_x(0)-w/2, JI_SCREEN_W-w),
|
||||||
MID (0, ji_mouse_y (0)-h/2, JI_SCREEN_H-h));
|
MID(0, jmouse_y(0)-h/2, JI_SCREEN_H-h));
|
||||||
jwindow_open(window);
|
jwindow_open(window);
|
||||||
|
|
||||||
tip->time = -1;
|
tip->time = -1;
|
||||||
@ -159,8 +159,9 @@ static JWidget tip_window_new(const char *text)
|
|||||||
jwidget_set_align(window, JI_CENTER | JI_MIDDLE);
|
jwidget_set_align(window, JI_CENTER | JI_MIDDLE);
|
||||||
|
|
||||||
/* remove decorative widgets */
|
/* remove decorative widgets */
|
||||||
JI_LIST_EACH_SAFE(window->children, link, next)
|
JI_LIST_FOR_EACH_SAFE(window->children, link, next) {
|
||||||
jwidget_free(link->data);
|
jwidget_free(link->data);
|
||||||
|
}
|
||||||
|
|
||||||
jwidget_add_hook(window, JI_WIDGET, tip_window_hook, NULL);
|
jwidget_add_hook(window, JI_WIDGET, tip_window_hook, NULL);
|
||||||
jwidget_init_theme(window);
|
jwidget_init_theme(window);
|
||||||
|
@ -133,7 +133,7 @@ void draw_gui()
|
|||||||
{
|
{
|
||||||
jwidget_dirty(manager);
|
jwidget_dirty(manager);
|
||||||
jwidget_flush_redraw(manager);
|
jwidget_flush_redraw(manager);
|
||||||
jmanager_dispatch_draw_messages();
|
//jmanager_dispatch_draw_messages();
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_speed(void)
|
float get_speed(void)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <allegro.h>
|
#include <allegro.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "jinete/jbase.h"
|
#include "jinete/jinete.h"
|
||||||
|
|
||||||
#include "raster/algo.h"
|
#include "raster/algo.h"
|
||||||
#include "raster/image.h"
|
#include "raster/image.h"
|
||||||
@ -131,18 +131,19 @@ void draw_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int flags, int color)
|
|||||||
|
|
||||||
typedef struct Point { int x, y; } Point;
|
typedef struct Point { int x, y; } Point;
|
||||||
|
|
||||||
static void add_shape_seg(int x1, int y1, int x2, int y2, JList *shape)
|
static void add_shape_seg(int x1, int y1, int x2, int y2, JList shape)
|
||||||
{
|
{
|
||||||
Point *point = jnew(Point, 1);
|
Point *point = jnew(Point, 1);
|
||||||
point->x = x2;
|
point->x = x2;
|
||||||
point->y = y2;
|
point->y = y2;
|
||||||
*shape = jlist_append (*shape, point);
|
jlist_append(shape, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
||||||
{
|
{
|
||||||
BEZIER_NODE *node;
|
BEZIER_NODE *node;
|
||||||
JList it, shape = NULL;
|
JList shape = jlist_new();
|
||||||
|
JLink link;
|
||||||
int c, vertices;
|
int c, vertices;
|
||||||
int *points;
|
int *points;
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
|||||||
node->next->prev_y,
|
node->next->prev_y,
|
||||||
node->next->x,
|
node->next->x,
|
||||||
node->next->y,
|
node->next->y,
|
||||||
(void *)&shape, (AlgoLine)add_shape_seg);
|
(void *)shape, (AlgoLine)add_shape_seg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node == path->last)
|
if (node == path->last)
|
||||||
@ -167,16 +168,20 @@ void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
|||||||
vertices = jlist_length(shape);
|
vertices = jlist_length(shape);
|
||||||
if (vertices > 0) {
|
if (vertices > 0) {
|
||||||
points = jmalloc(sizeof(int) * vertices * 2);
|
points = jmalloc(sizeof(int) * vertices * 2);
|
||||||
for (c=0, it=shape; it; it=it->next) {
|
|
||||||
points[c++] = ((Point *)it->data)->x;
|
c = 0;
|
||||||
points[c++] = ((Point *)it->data)->y;
|
JI_LIST_FOR_EACH(shape, link) {
|
||||||
|
points[c++] = ((Point *)link->data)->x;
|
||||||
|
points[c++] = ((Point *)link->data)->y;
|
||||||
}
|
}
|
||||||
polygon(bmp, vertices, points, color);
|
polygon(bmp, vertices, points, color);
|
||||||
ji_free(points);
|
jfree(points);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (it=shape; it; it=it->next)
|
JI_LIST_FOR_EACH(shape, link);
|
||||||
jfree(it->data);
|
jfree(link->data);
|
||||||
|
|
||||||
|
jlist_free(shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_art_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path)
|
void draw_art_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path)
|
||||||
|
@ -54,7 +54,7 @@ void test ()
|
|||||||
|
|
||||||
/* build the layers */
|
/* build the layers */
|
||||||
{
|
{
|
||||||
Layer *layer = layer_new (sprite->imgtype);
|
Layer *layer = layer_new(sprite);
|
||||||
|
|
||||||
/* add this layer to the sprite */
|
/* add this layer to the sprite */
|
||||||
layer_add_layer(sprite->set, layer);
|
layer_add_layer(sprite->set, layer);
|
||||||
@ -63,6 +63,7 @@ void test ()
|
|||||||
{
|
{
|
||||||
int i, c, image_index;
|
int i, c, image_index;
|
||||||
Image *image;
|
Image *image;
|
||||||
|
Cel *cel;
|
||||||
|
|
||||||
for (i=0; i<32; i++) {
|
for (i=0; i<32; i++) {
|
||||||
/* make the image */
|
/* make the image */
|
||||||
@ -79,15 +80,16 @@ void test ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add the new image in the stock */
|
/* add the new image in the stock */
|
||||||
image_index = stock_add_image (layer->stock, image);
|
image_index = stock_add_image(sprite->stock, image);
|
||||||
|
|
||||||
/* image property */
|
/* cel properties */
|
||||||
layer_add_frame (layer,
|
cel = cel_new(i, image_index);
|
||||||
frame_new (i, /* frpos */
|
cel_set_position(cel,
|
||||||
image_index, /* image */
|
cos(AL_PI*i/16)*64,
|
||||||
cos(AL_PI*i/16)*64, /* x */
|
sin(AL_PI*i/16)*64);
|
||||||
sin(AL_PI*i/16)*64, /* y */
|
cel_set_opacity(cel, 128+sin(AL_PI*i/32)*127);
|
||||||
128+sin(AL_PI*i/32)*127)); /* opacity */
|
|
||||||
|
layer_add_cel(layer, cel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,11 +100,11 @@ void test ()
|
|||||||
mouse_x-sprite->w/2, mouse_y-sprite->h/2);
|
mouse_x-sprite->w/2, mouse_y-sprite->h/2);
|
||||||
image_to_allegro(image_screen, bmp, 0, 0);
|
image_to_allegro(image_screen, bmp, 0, 0);
|
||||||
|
|
||||||
if (key[KEY_LEFT]) sprite->frpos--;
|
if (key[KEY_LEFT]) sprite->frame--;
|
||||||
if (key[KEY_RIGHT]) sprite->frpos++;
|
if (key[KEY_RIGHT]) sprite->frame++;
|
||||||
|
|
||||||
text_mode(makecol (0, 0, 0));
|
text_mode(makecol (0, 0, 0));
|
||||||
textprintf(bmp, font, 0, 0, makecol (255, 255, 255), "%d", sprite->frpos);
|
textprintf(bmp, font, 0, 0, makecol(255, 255, 255), "%d", sprite->frame);
|
||||||
blit(bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
blit(bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
||||||
} while (!key[KEY_ESC]);
|
} while (!key[KEY_ESC]);
|
||||||
|
|
||||||
@ -116,7 +118,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
allegro_init();
|
allegro_init();
|
||||||
set_color_depth(16);
|
set_color_depth(16);
|
||||||
set_gfx_mode (GFX_AUTODETECT, 320, 200, 0, 0);
|
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0);
|
||||||
install_timer();
|
install_timer();
|
||||||
install_keyboard();
|
install_keyboard();
|
||||||
install_mouse();
|
install_mouse();
|
||||||
|
Loading…
Reference in New Issue
Block a user