mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-04 05:59:22 +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();
|
||||
|
||||
jmanager_refresh_screen();
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
|
||||
jalert("Normal==First Alert||&Ok");
|
||||
jalert ("Error"
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <allegro.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "jinete/jinete/jinete.h"
|
||||
#include "jinete/jinete.h"
|
||||
|
||||
static JWidget check, radio[12];
|
||||
|
||||
|
@ -167,7 +167,7 @@ void set_my_palette (void)
|
||||
/* Theme */
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -137,8 +137,8 @@ static bool tip_hook(JWidget widget, JMessage msg)
|
||||
int h = jrect_h(window->rc);
|
||||
jwindow_remap(window);
|
||||
jwindow_position(window,
|
||||
MID (0, ji_mouse_x (0)-w/2, JI_SCREEN_W-w),
|
||||
MID (0, ji_mouse_y (0)-h/2, JI_SCREEN_H-h));
|
||||
MID(0, jmouse_x(0)-w/2, JI_SCREEN_W-w),
|
||||
MID(0, jmouse_y(0)-h/2, JI_SCREEN_H-h));
|
||||
jwindow_open(window);
|
||||
|
||||
tip->time = -1;
|
||||
@ -159,8 +159,9 @@ static JWidget tip_window_new(const char *text)
|
||||
jwidget_set_align(window, JI_CENTER | JI_MIDDLE);
|
||||
|
||||
/* 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_add_hook(window, JI_WIDGET, tip_window_hook, NULL);
|
||||
jwidget_init_theme(window);
|
||||
|
@ -133,7 +133,7 @@ void draw_gui()
|
||||
{
|
||||
jwidget_dirty(manager);
|
||||
jwidget_flush_redraw(manager);
|
||||
jmanager_dispatch_draw_messages();
|
||||
//jmanager_dispatch_draw_messages();
|
||||
}
|
||||
|
||||
float get_speed(void)
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <allegro.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "jinete/jbase.h"
|
||||
#include "jinete/jinete.h"
|
||||
|
||||
#include "raster/algo.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;
|
||||
|
||||
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->x = x2;
|
||||
point->y = y2;
|
||||
*shape = jlist_append (*shape, point);
|
||||
jlist_append(shape, point);
|
||||
}
|
||||
|
||||
void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
||||
{
|
||||
BEZIER_NODE *node;
|
||||
JList it, shape = NULL;
|
||||
JList shape = jlist_new();
|
||||
JLink link;
|
||||
int c, vertices;
|
||||
int *points;
|
||||
|
||||
@ -157,7 +158,7 @@ void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
||||
node->next->prev_y,
|
||||
node->next->x,
|
||||
node->next->y,
|
||||
(void *)&shape, (AlgoLine)add_shape_seg);
|
||||
(void *)shape, (AlgoLine)add_shape_seg);
|
||||
}
|
||||
|
||||
if (node == path->last)
|
||||
@ -167,16 +168,20 @@ void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
|
||||
vertices = jlist_length(shape);
|
||||
if (vertices > 0) {
|
||||
points = jmalloc(sizeof(int) * vertices * 2);
|
||||
for (c=0, it=shape; it; it=it->next) {
|
||||
points[c++] = ((Point *)it->data)->x;
|
||||
points[c++] = ((Point *)it->data)->y;
|
||||
|
||||
c = 0;
|
||||
JI_LIST_FOR_EACH(shape, link) {
|
||||
points[c++] = ((Point *)link->data)->x;
|
||||
points[c++] = ((Point *)link->data)->y;
|
||||
}
|
||||
polygon(bmp, vertices, points, color);
|
||||
ji_free(points);
|
||||
jfree(points);
|
||||
}
|
||||
|
||||
for (it=shape; it; it=it->next)
|
||||
jfree(it->data);
|
||||
JI_LIST_FOR_EACH(shape, link);
|
||||
jfree(link->data);
|
||||
|
||||
jlist_free(shape);
|
||||
}
|
||||
|
||||
void draw_art_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path)
|
||||
|
@ -54,7 +54,7 @@ void test ()
|
||||
|
||||
/* build the layers */
|
||||
{
|
||||
Layer *layer = layer_new (sprite->imgtype);
|
||||
Layer *layer = layer_new(sprite);
|
||||
|
||||
/* add this layer to the sprite */
|
||||
layer_add_layer(sprite->set, layer);
|
||||
@ -63,6 +63,7 @@ void test ()
|
||||
{
|
||||
int i, c, image_index;
|
||||
Image *image;
|
||||
Cel *cel;
|
||||
|
||||
for (i=0; i<32; i++) {
|
||||
/* make the image */
|
||||
@ -79,15 +80,16 @@ void test ()
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
layer_add_frame (layer,
|
||||
frame_new (i, /* frpos */
|
||||
image_index, /* image */
|
||||
cos(AL_PI*i/16)*64, /* x */
|
||||
sin(AL_PI*i/16)*64, /* y */
|
||||
128+sin(AL_PI*i/32)*127)); /* opacity */
|
||||
/* cel properties */
|
||||
cel = cel_new(i, image_index);
|
||||
cel_set_position(cel,
|
||||
cos(AL_PI*i/16)*64,
|
||||
sin(AL_PI*i/16)*64);
|
||||
cel_set_opacity(cel, 128+sin(AL_PI*i/32)*127);
|
||||
|
||||
layer_add_cel(layer, cel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -98,11 +100,11 @@ void test ()
|
||||
mouse_x-sprite->w/2, mouse_y-sprite->h/2);
|
||||
image_to_allegro(image_screen, bmp, 0, 0);
|
||||
|
||||
if (key[KEY_LEFT]) sprite->frpos--;
|
||||
if (key[KEY_RIGHT]) sprite->frpos++;
|
||||
if (key[KEY_LEFT]) sprite->frame--;
|
||||
if (key[KEY_RIGHT]) sprite->frame++;
|
||||
|
||||
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);
|
||||
} while (!key[KEY_ESC]);
|
||||
|
||||
@ -116,7 +118,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
allegro_init();
|
||||
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_keyboard();
|
||||
install_mouse();
|
||||
|
Loading…
Reference in New Issue
Block a user