Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Michael Baum
cngine
Commits
0627c8c4
Commit
0627c8c4
authored
Jan 15, 2022
by
Christian Michael Baum
🏀
Browse files
Allegro 4 compiles city night again
parent
abfda71d
Changes
4
Hide whitespace changes
Inline
Side-by-side
impl/allegro4.c
View file @
0627c8c4
...
...
@@ -71,7 +71,7 @@ static DumbProperties CN__load_dumb_properties_file()
}
#endif
CN_bool
CN_Init
(
CN_Options
*
options
)
CN_bool
CN_
Backend_
Init
(
CN_Options
*
options
)
{
int
errors
=
allegro_init
(),
mode
;
if
(
options
==
NULL
)
{
...
...
@@ -179,7 +179,7 @@ void CN_Backend_FinalizeFrame()
if
((
CN_bool
)
keyboard_needs_poll
())
poll_keyboard
();
}
CN_bool
CN_Deinit
(
void
)
CN_bool
CN_
Backend_
Deinit
(
void
)
{
CN_Assert
(
allegro4_backend
!=
NULL
);
/*
...
...
@@ -199,6 +199,11 @@ CN_bool CN_Deinit(void)
return
CN_true
;
}
CN_bool
CN_Backend_CanReinit
(
void
)
{
return
CN_false
;
}
CN_bool
CN_ExitCondition
()
{
return
CN_exit
;
...
...
@@ -210,7 +215,9 @@ CN_Image *CN_Image_Load(const char *path)
{
int
length
=
strlen
(
path
);
CN_Image
*
image
=
NULL
;
if
(
path
[
length
-
3
]
==
'g'
)
/* Assume GIF*/
if
(
path
[
length
-
3
]
==
'g'
&&
path
[
length
-
2
]
==
'i'
&&
path
[
length
-
1
]
==
'f'
)
{
#ifdef CN_ALGIF
image
=
load_gif
(
path
,
NULL
);
...
...
@@ -236,7 +243,7 @@ CN_Image *CN_Image_Create(int width, int height)
}
/* These are where the original draw functions were */
#include
"
shared
/draw.c"
#include
"
../img
/draw.c"
size_t
CN_Image_EstimateSizeOf
(
const
CN_Image
*
image
)
{
...
...
@@ -538,9 +545,9 @@ int main(int argc, char **argv)
CN_Init
(
argc
,
argv
);
while
(
!
CN_ExitCondition
())
{
CN_Frame
(
argc
,
argv
);
CN_Frame
(
CN_GetDeltaTime
()
);
}
CN_Deinit
(
argc
,
argv
);
CN_Deinit
();
}
#endif
...
...
impl/allegro4.h
View file @
0627c8c4
...
...
@@ -47,8 +47,8 @@ typedef struct Allegro4_Backend {
AL_DUH_PLAYER
*
duh_player
;
DumbProperties
dumb_properties
;
#endif
/* CN_DUMB */
volatile
int
CN_msecs
;
volatile
int
CN_ticks
;
volatile
unsigned
int
CN_msecs
;
volatile
unsigned
int
CN_ticks
;
unsigned
char
keyup
[
KEY_MAX
];
unsigned
char
keydown
[
KEY_MAX
];
}
Allegro4_Backend
;
...
...
@@ -70,6 +70,9 @@ typedef MIDI CN_MIDI_Impl;
typedef
void
CN_Music_Impl
;
typedef
int
CN_Key_Impl
;
/* TODO: This is a placeholder. */
typedef
char
CN_MouseButton_Impl
;
/*Input defines*/
#define CN_KEY__A KEY_A
#define CN_KEY__B KEY_B
...
...
impl/part/alleginl.h
View file @
0627c8c4
...
...
@@ -15,7 +15,7 @@ static CN_inline char CN_CharKeyDown()
return
(
x
&&
0xff
);
}
static
CN_inline
int
CN_GetDeltaTime
(
void
)
static
CN_inline
unsigned
int
CN_GetDeltaTime
(
void
)
{
int
temp
=
allegro4_backend
->
CN_msecs
;
if
(
allegro4_backend
->
CN_msecs
>
0
)
...
...
@@ -54,6 +54,11 @@ static CN_inline void CN_IncrementTicker()
allegro4_backend
->
CN_ticks
++
;
}
END_OF_FUNCTION
(
CN_IncrementTicker
)
static
CN_inline
unsigned
int
CN_GetMilliseconds
(
void
)
{
return
allegro4_backend
->
CN_msecs
;
}
static
CN_inline
CN_RGB
CN_Image_GetRGB
(
const
CN_RGB
*
pal
,
CN_Image
*
image
,
int
x
,
int
y
)
{
...
...
meson.build
View file @
0627c8c4
sdl2_dep = dependency(
'sdl2',
required : get_option('cnbackend') == 'sdl2',
method : 'auto'
)
sdl2_image_dep = dependency(
'SDL2_image',
required : get_option('cnbackend') == 'sdl2',
method : 'auto'
)
if get_option('cnbackend') == 'sdl2'
sdl2_dep = dependency(
'sdl2',
required : true,
method : 'auto'
)
sdl2_image_dep = dependency(
'SDL2_image',
required : false,
method : 'auto'
)
sdl2_mixer_dep = dependency(
'SDL2_mixer',
required : false,
method : 'auto'
)
sdl2_mixer_dep = dependency(
'SDL2_mixer',
required : get_option('cnbackend') == 'sdl2',
method : 'auto'
)
if sdl2_dep.found()
add_project_arguments('-DCN_SDL2', language : 'c')
cngine_deps = [sdl2_dep, sdl2_image_dep, sdl2_mixer_dep]
add_project_arguments('-DCN_SDL2', language : 'c')
if not sdl2_image_dep.found()
add_project_arguments('-DCN_NO_IMAGE', language : 'c')
endif
...
...
@@ -26,12 +29,35 @@ if sdl2_dep.found()
endif
endif
if get_option('cnbackend') == 'allegro4'
allegro4_dep = dependency(
'allegro',
required : true,
method : 'auto'
)
dumb_dep = dependency(
'dumb',
required : false,
method : 'auto'
)
cngine_deps = [allegro4_dep, dumb_dep]
add_project_arguments('-DCN_ALLEGRO4', language : 'c')
if dumb_dep.found()
add_project_arguments('-DCN_DUMB', language : 'c')
endif
endif
lua_dep = dependency(
'lua',
version : '5.1',
required : false,
method : 'auto')
cngine_deps += lua_dep
if not lua_dep.found()
add_project_arguments('-DCN_NO_LUA', language : 'c')
endif
...
...
@@ -62,4 +88,4 @@ cngine_sources = files(
'img/pcx.c',
'img/pixmap.c')
cngine_deps = [sdl2_dep, sdl2_image_dep, sdl2_mixer_dep, lua_dep]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment