mirror of
https://github.com/zoriya/Gamacon.git
synced 2026-06-04 20:36:28 +00:00
Reversing the click order
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/9/20.
|
||||
//
|
||||
|
||||
#ifndef _KEYBINDINGS_H_
|
||||
#define _KEYBINDINGS_H_
|
||||
|
||||
#include <SFML/Window/Keyboard.h>
|
||||
|
||||
typedef enum gc_keybindings
|
||||
{
|
||||
ESCAPE = sfKeyEscape
|
||||
} gc_keybindings;
|
||||
|
||||
#endif //_KEYBINDINGS_H_
|
||||
@@ -13,6 +13,7 @@ struct gc_list
|
||||
{
|
||||
void *data;
|
||||
gc_list *next;
|
||||
gc_list *prev;
|
||||
};
|
||||
|
||||
gc_list *list_add(gc_list *list, void *obj);
|
||||
|
||||
@@ -30,6 +30,8 @@ struct gc_scene
|
||||
|
||||
gc_list *callbacks;
|
||||
callback_t (*get_callback)(gc_scene *this, char *name);
|
||||
|
||||
bool is_paused;
|
||||
};
|
||||
|
||||
callback_t scene_get_callback(gc_scene *scene, char *name);
|
||||
|
||||
+2
-3
@@ -41,11 +41,10 @@ gc_scene *scene_create(gc_engine *engine, const char *xmlpath)
|
||||
gc_scene *scene = malloc(sizeof(gc_scene));
|
||||
node *n = NULL;
|
||||
|
||||
if (!scene)
|
||||
return (NULL);
|
||||
if (xmlpath && !(n = xml_parse(xmlpath)))
|
||||
if (!scene || (xmlpath && !(n = xml_parse(xmlpath))))
|
||||
return (NULL);
|
||||
scene_load_data(engine, scene, n);
|
||||
scene->is_paused = false;
|
||||
scene->entities = NULL;
|
||||
scene->entities_by_cmp = NULL;
|
||||
scene->add_entity = &entity_add;
|
||||
|
||||
@@ -21,7 +21,9 @@ void clickable_onclick(gc_engine *engine, gc_vector2 position)
|
||||
if (!scene)
|
||||
return;
|
||||
entities = scene->get_entity_by_cmp(scene, "clickable_component");
|
||||
for (gc_list *ent = entities; ent; ent = ent->next) {
|
||||
while (entities->next)
|
||||
entities = entities->next;
|
||||
for (gc_list *ent = entities; ent; ent = ent->prev) {
|
||||
tra = GETCMP(((gc_entity *)ent->data), transform_component);
|
||||
if ((tra->position.x - tra->size.x / 2) <= position.x
|
||||
&& (tra->position.y + tra->size.y / 2) >= position.y
|
||||
|
||||
@@ -14,11 +14,15 @@ gc_list *list_add(gc_list *list, void *obj)
|
||||
|
||||
if (!list) {
|
||||
list = malloc(sizeof(gc_list));
|
||||
if (list)
|
||||
list->prev = NULL;
|
||||
listconst = list;
|
||||
} else {
|
||||
while (list->next)
|
||||
list = list->next;
|
||||
list->next = malloc(sizeof(gc_list));
|
||||
if (list->next)
|
||||
list->next->prev = list;
|
||||
list = list->next;
|
||||
}
|
||||
if (!list)
|
||||
|
||||
Reference in New Issue
Block a user