Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Sylvain PILLOT | 630e6d7bba | |
Sylvain PILLOT | ed95b0c307 | |
Lephenixnoir | 1fa16bf5f8 | |
Sylvain PILLOT | 642c2e9877 | |
Sylvain PILLOT | c9f5807205 | |
Sylvain PILLOT | 816c6e1187 | |
Sylvain PILLOT | ba57b0aa4a |
|
@ -32,6 +32,7 @@ add_custom_command(
|
|||
set(SOURCES
|
||||
|
||||
src/main.cpp
|
||||
src/sequencer/sequencer.cpp
|
||||
|
||||
src/utilities/fast_trig.cpp
|
||||
src/utilities/extrakeyboard.cpp
|
||||
|
@ -44,7 +45,7 @@ set(SOURCES
|
|||
src/shaders/filledpoly.cpp
|
||||
src/shaders/line.cpp
|
||||
src/shaders/starfieldshader.cpp
|
||||
|
||||
|
||||
src/shmup/entity.cpp
|
||||
src/shmup/collections.cpp
|
||||
src/shmup/impact.cpp
|
||||
|
@ -56,11 +57,12 @@ set(SOURCES
|
|||
src/shmup/bonus.cpp
|
||||
src/shmup/boss.cpp
|
||||
src/shmup/trajectory.cpp
|
||||
src/shmup/laser.cpp
|
||||
# ...
|
||||
)
|
||||
|
||||
set(ASSETS_cg
|
||||
#assets-cg/font.png
|
||||
assets-cg/font_shmup.png
|
||||
assets-cg/milifont.png
|
||||
|
||||
assets-cg/Sprites/Explosions/firstboom.png
|
||||
|
@ -107,7 +109,7 @@ set(ASSETS_cg
|
|||
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
|
||||
|
||||
add_executable(shmup ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
|
||||
target_compile_options(shmup PRIVATE -Wall -Wextra -Os -std=c++20)
|
||||
target_compile_options(shmup PRIVATE -Wall -Wextra -O3 -std=c++20)
|
||||
target_link_options(shmup PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage -fno-use-cxa-atexit -fpermissive)
|
||||
target_link_libraries(shmup Azur::Azur -lnum LibProf::LibProf Gint::Gint -lstdc++)
|
||||
|
||||
|
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
14
TODO.txt
14
TODO.txt
|
@ -5,7 +5,7 @@
|
|||
- [DONE] better keyboard management engine for keypressed() and keyreleased() events
|
||||
- Mettre une système d'ajustement de FPS mini avec switch des niveaux d'overclock à la volée de manière dynamique
|
||||
- [DONE] Mettre en place un système de collision en "pixel perfect" pour mode jeu "Asteroids Alert !!!"
|
||||
- refactoriser les classes des entités "mobiles"
|
||||
- [DONE] refactoriser les classes des entités "mobiles"
|
||||
o class Entity (position, box, ID, trajectory)
|
||||
~~> class Enemy : public Entity (+shoot, +life)
|
||||
~~> class Boss : public Enemy (+multiple shoots, +multiple life)
|
||||
|
@ -38,8 +38,16 @@
|
|||
- implémenter un système de boost des munitions si on garde le doigt appuyé sur la touche de laser
|
||||
|
||||
|
||||
## Assets
|
||||
- Fontes de caractères
|
||||
- Ecrans intermédiaires
|
||||
- Boss
|
||||
- Ennemies avec différentes couleurs en fonction du niveau
|
||||
- Armes et Bullets qui correspondent
|
||||
|
||||
|
||||
## Scenario
|
||||
- implémenter un système de séquences avec des vagues de monstres qui arrivent les unes après les autres
|
||||
- implémenter un séquenceur/programmateur de partie avec des vagues de monstres qui arrivent les unes après les autres
|
||||
- possibilité d'avoir dans les séquences:
|
||||
o fond étoilé ou non
|
||||
o niveau tiled ou non
|
||||
|
@ -47,6 +55,8 @@
|
|||
o sequence de monstres avec trajectoires
|
||||
o boss de fin
|
||||
o eventuelles récompenses/upgrades de vaisseau
|
||||
o niveau d'entrée / niveau de milieu / niveau de sortie d'une station spatiale
|
||||
|
||||
|
||||
|
||||
## Bosses
|
||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -6,3 +6,12 @@ milifont.png:
|
|||
grid.size: 3x5
|
||||
grid.padding: 1
|
||||
proportional: true
|
||||
|
||||
font_shmup.png:
|
||||
type: font
|
||||
name: font_shmup
|
||||
charset: print
|
||||
grid.size: 10x13
|
||||
grid.padding: 0
|
||||
grid.border: 0
|
||||
proportional: true
|
||||
|
|
32
src/config.h
32
src/config.h
|
@ -6,7 +6,37 @@
|
|||
#define DEBUG_MODE 0
|
||||
#define USB 0
|
||||
#define MORE_RAM 1
|
||||
#define CALCEMU 1
|
||||
#define CALCEMU 0
|
||||
#define OVERCLOCK 1
|
||||
|
||||
|
||||
|
||||
/* usual colors*/
|
||||
#define RGB565_BLACK 0x0000
|
||||
#define RGB565_RED 0xF800
|
||||
#define RGB565_GREEN 0x07E0
|
||||
#define RGB565_BLUE 0x001F
|
||||
#define RGB565_YELLOW 0xFFE0
|
||||
#define RGB565_PURPLE 0xF81F
|
||||
#define RGB565_CYAN 0x07FF
|
||||
#define RGB565_WHITE 0xFFFF
|
||||
|
||||
/* advanced palette */
|
||||
#define RGB565_DARKORANGE 0xF280
|
||||
#define RGB565_ORANGE 0xF4A0
|
||||
#define RGB565_LIGHORANGE 0xF5C0
|
||||
|
||||
#define RGB565_LEMONYELLOW 0xF7C6
|
||||
#define RGB565_APPLEGREEN 0xCF25
|
||||
#define RGB565_LEAFGREEN 0x6566
|
||||
|
||||
#define RGB565_OCEANBLUE 0x0479
|
||||
#define RGB565_AZURBLUE 0x023E
|
||||
#define RGB565_DEEPBLUE 0x3813
|
||||
|
||||
#define RGB565_DEEPPURPLE 0x8015
|
||||
#define RGB565_CHERRYRED 0xA0C9
|
||||
#define RGB565_BLOODYRED 0xF122
|
||||
|
||||
|
||||
#endif
|
121
src/main.cpp
121
src/main.cpp
|
@ -1,4 +1,6 @@
|
|||
#include "config.h"
|
||||
#include "shmup/laser.h"
|
||||
#include "utilities/vector2D.h"
|
||||
|
||||
#include <azur/azur.h>
|
||||
#include <azur/gint/render.h>
|
||||
|
@ -34,6 +36,8 @@
|
|||
|
||||
#include "shaders/MyAzurShaders.h"
|
||||
|
||||
#include "sequencer/sequencer.h"
|
||||
|
||||
#include "shmup/player.h"
|
||||
|
||||
#include "shmup/particles.h"
|
||||
|
@ -55,7 +59,7 @@ bool screenshot = false;
|
|||
bool record = false;
|
||||
bool textoutput = false;
|
||||
bool exitToOS = false;
|
||||
uint8_t texttodraw=1;
|
||||
uint8_t verbosity=1;
|
||||
|
||||
|
||||
|
||||
|
@ -86,6 +90,8 @@ std::vector<Impact*> MyImpacts;
|
|||
std::vector<Bonus*> MyBonuses;
|
||||
std::vector<Trajectory*> MyTrajectories;
|
||||
|
||||
|
||||
|
||||
Background MyBackground;
|
||||
|
||||
Player *MyPlayer;
|
||||
|
@ -225,6 +231,31 @@ static void update( float dt )
|
|||
}
|
||||
}
|
||||
|
||||
if(MyPlayer->Is_Laser_Activated())
|
||||
{
|
||||
for(int u=0; u<MyPlayer->Lasers.size(); u++)
|
||||
{
|
||||
for( unsigned j=0; j<MyEnemies.size(); j++ )
|
||||
{
|
||||
if(MyEnemies[j]->Test_Impact( MyPlayer->Lasers[u] )==true)
|
||||
{
|
||||
//TODO : we can create a list of impacts here, to be rendered later on
|
||||
Create_Impact( (int) MyEnemies[j]->x, (int) MyEnemies[j]->y );
|
||||
}
|
||||
}
|
||||
|
||||
if (MyBoss)
|
||||
if(MyBoss->Test_Impact(MyPlayer->Lasers[u])==true)
|
||||
{
|
||||
//TODO : we can create a list of impacts here, to be rendered later on
|
||||
|
||||
//Create_Impact( (int) MyBoss->x, (int) MyBoss->y );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(unsigned int i=0; i<MyEnemiesBullets.size(); i++)
|
||||
{
|
||||
MyEnemiesBullets[i]->Update( dt );
|
||||
|
@ -299,20 +330,24 @@ static void render( void )
|
|||
|
||||
MyPlayer->Render();
|
||||
|
||||
if(MyPlayer->Is_Laser_Activated())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#if(BIAS)
|
||||
if (texttodraw>=1) Azur_draw_text(1,01, "FPS = %.0f", (float) (1000000.0f / elapsedTime) );
|
||||
//if (texttodraw>=1) Azur_draw_text(1,11, "Part.= %d - Bull.= %d", MyParticles.size(), MyPlayerBullets.size() );
|
||||
//if (texttodraw>=1 && !MyEnemies.empty()) Azur_draw_text(1,21, "Ennmy Life= %d", MyEnemies[0]->life );
|
||||
|
||||
if (texttodraw>=2) Azur_draw_text(1,31, "Update = %.3f ms", (float) time_update / 1000.0f );
|
||||
if (texttodraw>=2) Azur_draw_text(1,41, "Render = %.3f ms", (float) time_render / 1000.0f );
|
||||
if (texttodraw>=2) Azur_draw_text(1,51, ">Total = %.0f ms", (float) elapsedTime / 1000.0f );
|
||||
if (verbosity>=1) Azur_draw_text_shmup(0, 0, "FPS = %.0f", (float) (1000000.0f / elapsedTime) );
|
||||
if (verbosity>=2) Azur_draw_text_shmup(0, 15, "LAZ = %d", MyPlayer->Lasers.size() );
|
||||
if (verbosity>=2) Azur_draw_text_shmup(0, 30, "Part.= %d - Bull.= %d", MyParticles.size(), MyPlayerBullets.size() );
|
||||
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,45, "Update = %.3f ms", (float) time_update / 1000.0f );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,60, "Render = %.3f ms", (float) time_render / 1000.0f );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,75, ">Total = %.0f ms", (float) elapsedTime / 1000.0f );
|
||||
|
||||
#if(MORE_RAM)
|
||||
if (texttodraw>=3) Azur_draw_text(1,81, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory);
|
||||
if (texttodraw>=3) Azur_draw_text(1,91, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory);
|
||||
if (texttodraw>=3) Azur_draw_text(1,101, "Mem Peak Used : %d", _uram_stats->peak_used_memory + extram_stats->peak_used_memory );
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,90, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory);
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,105, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory);
|
||||
if (verbosity>=3) Azur_draw_text_shmup(0,120, "Mem Peak Used : %d", _uram_stats->peak_used_memory + extram_stats->peak_used_memory );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -338,6 +373,15 @@ static void get_inputs( float dt )
|
|||
if (MyPlayer->Shoot_OK(tempshoot, BULLET_LASER)) Create_Player_Shoot(2);
|
||||
}
|
||||
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_F4))
|
||||
{
|
||||
if (MyPlayer->Shoot_OK(tempshoot, LASER))
|
||||
{
|
||||
MyPlayer->Activate_Laser();
|
||||
}
|
||||
}
|
||||
else MyPlayer->Desactivate_Laser();
|
||||
|
||||
if (MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyHoldPressed(MYKEY_EXIT)) {exitToOS = true; };
|
||||
|
||||
|
||||
|
@ -348,10 +392,10 @@ static void get_inputs( float dt )
|
|||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_DEL) && usb_is_open()) {textoutput = true;};
|
||||
#endif
|
||||
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) {texttodraw=0;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) {texttodraw=1;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) {texttodraw=2;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) {texttodraw=3;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) {verbosity=0;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) {verbosity=1;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) {verbosity=2;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) {verbosity=3;}
|
||||
if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F5))
|
||||
{
|
||||
drawback = !drawback;
|
||||
|
@ -467,6 +511,22 @@ void debug_crash_msg( char *chain )
|
|||
}
|
||||
*/
|
||||
|
||||
int EntryClockLevel;
|
||||
|
||||
void InitOverClock( void )
|
||||
{
|
||||
EntryClockLevel = clock_get_speed();
|
||||
clock_set_speed( CLOCK_SPEED_F5 );
|
||||
}
|
||||
|
||||
void RestoreOVerClock( void )
|
||||
{
|
||||
clock_set_speed( EntryClockLevel );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
exitToOS = false;
|
||||
|
@ -488,21 +548,25 @@ int main(void)
|
|||
|
||||
azrp_starfield_init( 250 );
|
||||
|
||||
Create_Enemies( );
|
||||
#if(OVERCLOCK)
|
||||
InitOverClock();
|
||||
#endif
|
||||
|
||||
//Create_Enemies( );
|
||||
|
||||
MyPlayer = new Player( azrp_width/4, azrp_height/2, 0);
|
||||
|
||||
/*
|
||||
|
||||
MyBoss = new Boss( 3*azrp_width/4, azrp_height/2, 0);
|
||||
|
||||
|
||||
Point2D *A = new Point2D( 348, 112 );
|
||||
Point2D *B = new Point2D( 371, 199 );
|
||||
Point2D *C = new Point2D( 198, 149 );
|
||||
Point2D *D = new Point2D( 25, 199 );
|
||||
Point2D *E = new Point2D( 25, 25 );
|
||||
Point2D *F = new Point2D( 198, 75 );
|
||||
Point2D *G = new Point2D( 371, 25 );
|
||||
Vector2D *A = new Vector2D( 348, 112 );
|
||||
Vector2D *B = new Vector2D( 371, 199 );
|
||||
Vector2D *C = new Vector2D( 198, 149 );
|
||||
Vector2D *D = new Vector2D( 25, 199 );
|
||||
Vector2D *E = new Vector2D( 25, 25 );
|
||||
Vector2D *F = new Vector2D( 198, 75 );
|
||||
Vector2D *G = new Vector2D( 371, 25 );
|
||||
|
||||
Trajectory *MyTrajectory= new Trajectory();
|
||||
MyTrajectory->AddPoint( A );
|
||||
|
@ -515,7 +579,7 @@ int main(void)
|
|||
|
||||
MyBoss->hasTrajectory = true;
|
||||
MyBoss->pathToFollow = MyTrajectory;
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
#if(DBGCRSH)
|
||||
|
@ -528,6 +592,8 @@ int main(void)
|
|||
usb_open(interfaces, GINT_CALL_NULL);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
prof_init();
|
||||
|
||||
do
|
||||
|
@ -610,5 +676,10 @@ int main(void)
|
|||
|
||||
if (canWeAllocateMoreRam) FreeMoreRAM( );
|
||||
|
||||
|
||||
#if(OVERCLOCK)
|
||||
RestoreOVerClock();
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include "sequencer.h"
|
||||
|
||||
Sequencer::Sequencer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Sequencer::~Sequencer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sequencer::Load_Sequence( uint16_t sequence )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Sequencer::Update( float dt )
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef SEQUENCER_H
|
||||
#define SEQUENCER_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t ID;
|
||||
uint16_t Item;
|
||||
uint16_t Duration;
|
||||
} SequenceItem;
|
||||
|
||||
|
||||
class Sequencer
|
||||
{
|
||||
public:
|
||||
|
||||
Sequencer();
|
||||
~Sequencer();
|
||||
|
||||
void Load_Sequence( uint16_t sequence );
|
||||
void Update( float dt );
|
||||
|
||||
private:
|
||||
uint64_t timecursor;
|
||||
|
||||
std::vector< SequenceItem > GamePlay;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -12,7 +12,6 @@ void azrp_starfield_init( uint8_t nbstars );
|
|||
void azrp_starfield_close( void );
|
||||
|
||||
|
||||
|
||||
void azrp_shader_line_configure(void);
|
||||
void azrp_shader_circle_configure(void);
|
||||
void azrp_shader_filledcircle_configure(void);
|
||||
|
|
|
@ -54,7 +54,8 @@ void Bonus::Update( float dt )
|
|||
}
|
||||
else
|
||||
{
|
||||
pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, true, &x, &y );
|
||||
if (pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, loopTrajectory, &x, &y ) == -1)
|
||||
toberemoved=true;
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
|
|
@ -24,11 +24,7 @@ class Bonus : public Entity
|
|||
|
||||
private:
|
||||
int8_t dirx, diry;
|
||||
libnum::num currentframe;
|
||||
|
||||
libnum::num currentframe;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,19 +1,21 @@
|
|||
#include "../config.h"
|
||||
|
||||
#include "boss.h"
|
||||
#include "bullet.h"
|
||||
#include <cstdint>
|
||||
#include <num/num.h>
|
||||
#include <gint/rtc.h>
|
||||
#include <sys/types.h>
|
||||
#include "../utilities/fast_trig.h"
|
||||
|
||||
#include <gint/gint.h>
|
||||
|
||||
#include "collections.h"
|
||||
#include "player.h"
|
||||
#include "boss.h"
|
||||
#include "bullet.h"
|
||||
|
||||
#include "../utilities/fast_trig.h"
|
||||
#include "../shaders/MyAzurShaders.h"
|
||||
#include "../utilities/vector2D.h"
|
||||
|
||||
|
||||
extern bopti_image_t img_Lifebar;
|
||||
extern bopti_image_t img_Boss1;
|
||||
extern bopti_image_t img_BossGun;
|
||||
|
@ -25,7 +27,7 @@ extern std::vector<Bullet*> MyEnemiesBullets;
|
|||
extern Player *MyPlayer;
|
||||
|
||||
#define NB_PIECES_BOSS 12
|
||||
#define NB_GUNS 12
|
||||
#define NB_GUNS 6
|
||||
|
||||
libnum::num XdataBossInternal[NB_PIECES_BOSS];
|
||||
libnum::num YdataBossInternal[NB_PIECES_BOSS];
|
||||
|
@ -36,6 +38,7 @@ BossPart Pieces[NB_PIECES_BOSS*2];
|
|||
|
||||
libnum::num xGuns[NB_GUNS];
|
||||
libnum::num yGuns[NB_GUNS];
|
||||
uint8_t NbActiveGun = 0;
|
||||
|
||||
BossGun Guns[NB_GUNS];
|
||||
|
||||
|
@ -112,6 +115,7 @@ Boss::Boss( int16_t _x, int16_t _y, uint8_t _id ) : Enemy( _x, _y, _id )
|
|||
}
|
||||
|
||||
hasTrajectory=false;
|
||||
loopTrajectory = true;
|
||||
|
||||
lastshoot0 = rtc_ticks();
|
||||
lastshoot1 = rtc_ticks();
|
||||
|
@ -158,7 +162,8 @@ void Boss::Update( float dt )
|
|||
{
|
||||
if (hasTrajectory)
|
||||
{
|
||||
pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, true, &x, &y );
|
||||
if (pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, loopTrajectory, &x, &y ) == -1)
|
||||
toberemoved=true;
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
@ -213,6 +218,11 @@ void Boss::Update( float dt )
|
|||
uint32_t tempshoot = rtc_ticks();
|
||||
|
||||
bool hasExternalGun = false;
|
||||
NbActiveGun = 0;
|
||||
|
||||
for( int i=0; i<NB_GUNS; i++ )
|
||||
if (Guns[i].toberemoved==false)
|
||||
NbActiveGun++;
|
||||
|
||||
if (Shoot_OK( tempshoot, BULLET_ENEMY_RED ))
|
||||
{
|
||||
|
@ -232,7 +242,8 @@ void Boss::Update( float dt )
|
|||
}
|
||||
}
|
||||
|
||||
if (hasExternalGun==false)
|
||||
//if (hasExternalGun==false)
|
||||
if (NbActiveGun==0)
|
||||
if(Shoot_OK( tempshoot, BULLET_ENEMY_GREEN ))
|
||||
{
|
||||
/* central shoot from the main ship only if no more other gun shooting */
|
||||
|
@ -403,26 +414,123 @@ bool Boss::Test_Impact( Bullet *projectile )
|
|||
|
||||
|
||||
|
||||
bool Boss::Test_Impact( Laser *projectile )
|
||||
{
|
||||
|
||||
Vector2D Start( projectile->sx, projectile->sy );
|
||||
Vector2D Direction( projectile->dx, projectile->dy );
|
||||
|
||||
bool hit = false;
|
||||
|
||||
/* We check if the laser collides with the shield of the boss */
|
||||
for( int i=0; i< NB_PIECES_BOSS; i++ )
|
||||
{
|
||||
if (Pieces[i*2].toberemoved == false)
|
||||
{
|
||||
Vector2D A( XdataBossExternal[ Pieces[i*2].P1 ], YdataBossExternal[ Pieces[i*2].P1 ]);
|
||||
Vector2D B( XdataBossExternal[ Pieces[i*2].P2 ], YdataBossExternal[ Pieces[i*2].P2 ]);
|
||||
Vector2D C( XdataBossInternal[ Pieces[i*2].P3 ], YdataBossInternal[ Pieces[i*2].P3 ]);
|
||||
|
||||
if (LineTriangle_Collision( Start, Direction, A, B, C))
|
||||
{
|
||||
Pieces[i*2].life -= projectile->strength;
|
||||
Create_Impact(((int) (A.x + B.x + C.x))/3, ((int) (A.y + B.y + C.y))/3 );
|
||||
if (Pieces[i*2].life<=0)
|
||||
{
|
||||
Pieces[i*2].toberemoved = true;
|
||||
Create_Explosion(((int) (A.x + B.x + C.x))/3, ((int) (A.y + B.y + C.y))/3 );
|
||||
|
||||
}
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pieces[i*2+1].toberemoved == false)
|
||||
{
|
||||
Vector2D A( XdataBossInternal[ Pieces[i*2+1].P1 ], YdataBossInternal[ Pieces[i*2+1].P1 ]);
|
||||
Vector2D B( XdataBossInternal[ Pieces[i*2+1].P2 ], YdataBossInternal[ Pieces[i*2+1].P2 ]);
|
||||
Vector2D C( XdataBossExternal[ Pieces[i*2+1].P3 ], YdataBossExternal[ Pieces[i*2+1].P3 ]);
|
||||
|
||||
if (LineTriangle_Collision( Start, Direction, A, B, C))
|
||||
{
|
||||
Pieces[i*2+1].life -= projectile->strength;
|
||||
Create_Impact(((int) (A.x + B.x + C.x))/3, ((int) (A.y + B.y + C.y))/3 );
|
||||
if (Pieces[i*2+1].life<=0)
|
||||
{
|
||||
Pieces[i*2+1].toberemoved = true;
|
||||
Create_Explosion(((int) (A.x + B.x + C.x))/3, ((int) (A.y + B.y + C.y))/3 );
|
||||
}
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* We check if the laser collides with the cannons of the boss */
|
||||
for( int i=0; i<NB_GUNS; i++ )
|
||||
{
|
||||
if (Guns[i].toberemoved == false)
|
||||
{
|
||||
Vector2D BoxMin( xGuns[i] - libnum::num(img_BossGun.width/2), yGuns[i] - libnum::num(img_BossGun.height/2) );
|
||||
Vector2D BoxMax( xGuns[i] + libnum::num(img_BossGun.width/2), yGuns[i] + libnum::num(img_BossGun.height/2) );
|
||||
|
||||
if (LineRectangle_Collision( Start, Direction, BoxMin, BoxMax ))
|
||||
{
|
||||
Guns[i].life -= projectile->strength;
|
||||
Create_Impact( (int) xGuns[i], (int) yGuns[i] );
|
||||
if (Guns[i].life<0)
|
||||
{
|
||||
Guns[i].toberemoved = true;
|
||||
Create_Explosion( (int) xGuns[i], (int) yGuns[i] );
|
||||
}
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* We check if the laser collides with the main ship part of the boss */
|
||||
Vector2D BoxMin( libnum::num(this->xmin), libnum::num(this->ymin) );
|
||||
Vector2D BoxMax( libnum::num(this->xmax), libnum::num(this->ymax) );
|
||||
|
||||
if (LineRectangle_Collision( Start, Direction, BoxMin, BoxMax ))
|
||||
{
|
||||
life -= projectile->strength;
|
||||
Create_Impact( (int) x, (int) y );
|
||||
if (life<0)
|
||||
{
|
||||
this->toberemoved = true;
|
||||
Create_Explosion( (int) this->x, (int) this->y );
|
||||
}
|
||||
hit = true;
|
||||
}
|
||||
|
||||
return hit;
|
||||
}
|
||||
|
||||
|
||||
bool Boss::Shoot_OK( uint32_t tempshoot, uint8_t shootID )
|
||||
{
|
||||
if (shootID==BULLET_ENEMY_RED)
|
||||
{
|
||||
if(tempshoot-lastshoot0>1)
|
||||
if(tempshoot-lastshoot0>30)
|
||||
{
|
||||
lastshoot0=tempshoot;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else if (shootID==BULLET_ENEMY_GREEN)
|
||||
|
||||
if (shootID==BULLET_ENEMY_GREEN)
|
||||
{
|
||||
if(tempshoot-lastshoot1>1)
|
||||
if(tempshoot-lastshoot1>75)
|
||||
{
|
||||
lastshoot1=tempshoot;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
#include "bullet.h"
|
||||
#include "enemy.h"
|
||||
#include "trajectory.h"
|
||||
#include "laser.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
|
@ -38,7 +39,8 @@ class Boss : public Enemy
|
|||
|
||||
virtual void Update( float dt ) override;
|
||||
virtual void Render( void ) override;
|
||||
virtual bool Test_Impact( Bullet *projectile ) override;
|
||||
bool Test_Impact( Bullet *projectile ) override;
|
||||
bool Test_Impact( Laser *projectile ) override;
|
||||
|
||||
uint32_t lastshoot = 0;
|
||||
uint8_t rotSpeed;
|
||||
|
|
|
@ -10,6 +10,7 @@ enum
|
|||
BULLET_NORMAL,
|
||||
BULLET_BLUE,
|
||||
BULLET_LASER,
|
||||
LASER,
|
||||
BULLET_ENEMY_BLUE,
|
||||
BULLET_ENEMY_RED,
|
||||
BULLET_ENEMY_GREEN,
|
||||
|
|
|
@ -67,8 +67,6 @@ void Create_Enemies( void )
|
|||
MyEnemies.push_back( e4 );
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Vector2D *A = new Vector2D( 348, 112 );
|
||||
Vector2D *B = new Vector2D( 371, 199 );
|
||||
Vector2D *C = new Vector2D( 198, 149 );
|
||||
|
@ -77,7 +75,6 @@ void Create_Enemies( void )
|
|||
Vector2D *F = new Vector2D( 198, 75 );
|
||||
Vector2D *G = new Vector2D( 371, 25 );
|
||||
|
||||
|
||||
Trajectory *MyPath= new Trajectory();
|
||||
MyPath->AddPoint( A );
|
||||
MyPath->AddPoint( B );
|
||||
|
@ -88,6 +85,7 @@ void Create_Enemies( void )
|
|||
MyPath->AddPoint( G );
|
||||
MyTrajectories.push_back( MyPath );
|
||||
|
||||
|
||||
Enemy* e5 = new Enemy( 348, 112, 2);
|
||||
e5->hasTrajectory = true;
|
||||
e5->pathToFollow = MyPath;
|
||||
|
@ -110,9 +108,79 @@ void Create_Enemies( void )
|
|||
MyEnemies.push_back( e5 );
|
||||
MyEnemies.push_back( e6 );
|
||||
MyEnemies.push_back( e7 );
|
||||
|
||||
|
||||
Vector2D *A1 = new Vector2D( 450, 0 );
|
||||
Vector2D *B1 = new Vector2D( 400, 0 );
|
||||
Vector2D *C1 = new Vector2D( 350, 25 );
|
||||
Vector2D *D1 = new Vector2D( 300, 25 );
|
||||
Vector2D *E1 = new Vector2D( 250, 100 );
|
||||
Vector2D *F1 = new Vector2D( 100, 100 );
|
||||
Vector2D *G1 = new Vector2D( 50, 25 );
|
||||
Vector2D *H1 = new Vector2D( 0, 25 );
|
||||
Vector2D *I1 = new Vector2D( -100, 0 );
|
||||
|
||||
|
||||
Trajectory *MyPath1= new Trajectory();
|
||||
MyPath1->AddPoint( A1 );
|
||||
MyPath1->AddPoint( B1 );
|
||||
MyPath1->AddPoint( C1 );
|
||||
MyPath1->AddPoint( D1 );
|
||||
MyPath1->AddPoint( E1 );
|
||||
MyPath1->AddPoint( F1 );
|
||||
MyPath1->AddPoint( G1 );
|
||||
MyPath1->AddPoint( H1 );
|
||||
MyPath1->AddPoint( I1 );
|
||||
MyTrajectories.push_back( MyPath1 );
|
||||
|
||||
|
||||
Enemy* e8 = new Enemy( 450, 0, 1);
|
||||
e8->hasTrajectory = true;
|
||||
e8->pathToFollow = MyPath1;
|
||||
MyPath1->AddRegistry();
|
||||
e8->Set_Accumulated_Time(1.0f);
|
||||
|
||||
Enemy* e9 = new Enemy( 450, 0, 1);
|
||||
e9->hasTrajectory = true;
|
||||
e9->pathToFollow = MyPath1;
|
||||
MyPath1->AddRegistry();
|
||||
e9->Set_Accumulated_Time(0.75f);
|
||||
e9->Set_Loop_Trajectory(false);
|
||||
|
||||
Enemy* e10 = new Enemy( 450, 0, 1);
|
||||
e10->hasTrajectory = true;
|
||||
e10->pathToFollow = MyPath1;
|
||||
MyPath1->AddRegistry();
|
||||
e10->Set_Accumulated_Time(0.50f);
|
||||
|
||||
Enemy* e11 = new Enemy( 450, 0, 1);
|
||||
e11->hasTrajectory = true;
|
||||
e11->pathToFollow = MyPath1;
|
||||
MyPath1->AddRegistry();
|
||||
e11->Set_Accumulated_Time(0.25f);
|
||||
e11->Set_Loop_Trajectory(false);
|
||||
|
||||
Enemy* e12 = new Enemy( 450, 0, 1);
|
||||
e12->hasTrajectory = true;
|
||||
e12->pathToFollow = MyPath1;
|
||||
MyPath1->AddRegistry();
|
||||
e12->Set_Accumulated_Time(0.0f);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MyEnemies.push_back( e8 );
|
||||
MyEnemies.push_back( e9 );
|
||||
MyEnemies.push_back( e10 );
|
||||
MyEnemies.push_back( e11 );
|
||||
MyEnemies.push_back( e12 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Create_Explosion( uint16_t xexplosion, uint16_t yexplosion )
|
||||
{
|
||||
srand(rtc_ticks());
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "bullet.h"
|
||||
#include <num/num.h>
|
||||
#include <gint/rtc.h>
|
||||
#include "../utilities/utilities.h"
|
||||
|
||||
extern bopti_image_t img_Lifebar;
|
||||
extern bopti_image_t img_mainship2;
|
||||
|
@ -55,6 +56,11 @@ Enemy::~Enemy()
|
|||
|
||||
}
|
||||
|
||||
void Enemy::Set_Loop_Trajectory( bool value )
|
||||
{
|
||||
loopTrajectory = value;
|
||||
}
|
||||
|
||||
void Enemy::Update( float dt )
|
||||
{
|
||||
if (!hasTrajectory)
|
||||
|
@ -68,7 +74,8 @@ void Enemy::Update( float dt )
|
|||
}
|
||||
else
|
||||
{
|
||||
pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, true, &x, &y );
|
||||
if (pathToFollow->CalculatePosition( &accumulatedTime, dt, speed, loopTrajectory, &x, &y ) == -1)
|
||||
toberemoved=true;
|
||||
}
|
||||
|
||||
xmin = (int) x - width;
|
||||
|
@ -145,6 +152,25 @@ bool Enemy::Test_Impact( Bullet *projectile )
|
|||
else return false;
|
||||
}
|
||||
|
||||
|
||||
bool Enemy::Test_Impact( Laser *projectile )
|
||||
{
|
||||
Vector2D Start( projectile->sx, projectile->sy );
|
||||
Vector2D Direction( projectile->dx, projectile->dy );
|
||||
|
||||
Vector2D BoxMin( xmin, ymin );
|
||||
Vector2D BoxMax( xmax, ymax );
|
||||
|
||||
if (LineRectangle_Collision( Start, Direction, BoxMin, BoxMax))
|
||||
{
|
||||
life -= projectile->strength;
|
||||
projectile->toberemoved = true;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
void Enemy::Set_Speed_Vector( uint8_t _sp, uint8_t _xd, uint8_t _yd )
|
||||
{
|
||||
speed = _sp;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "bullet.h"
|
||||
#include "entity.h"
|
||||
#include "trajectory.h"
|
||||
|
||||
#include "laser.h"
|
||||
|
||||
class Enemy : public Entity
|
||||
{
|
||||
|
@ -21,15 +21,18 @@ class Enemy : public Entity
|
|||
|
||||
virtual void Update( float dt ) override;
|
||||
virtual void Render( void ) override;
|
||||
virtual void Set_Loop_Trajectory( bool value ) override;
|
||||
|
||||
virtual bool Test_Impact( Bullet *projectile ) override;
|
||||
virtual bool Test_Impact( Bullet *projectile );
|
||||
virtual bool Test_Impact( Laser *projectile );
|
||||
|
||||
void Set_Speed_Vector( uint8_t _sp, uint8_t _xd, uint8_t _yd);
|
||||
|
||||
virtual void Set_Accumulated_Time( float value );
|
||||
|
||||
|
||||
private:
|
||||
int8_t dirx, diry; // vector of the current direction of the ennemy (TODO : to implement more complex displacement pattern)
|
||||
|
||||
uint32_t lastshottime;
|
||||
virtual bool Shoot_OK( uint32_t tempshoot, uint8_t shootID );
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ Entity::Entity( int16_t _x, int16_t _y, uint8_t _id )
|
|||
toberemoved = false;
|
||||
hasTrajectory = false;
|
||||
accumulatedTime = 0.0f;
|
||||
loopTrajectory = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +29,7 @@ void Entity::Render( void )
|
|||
|
||||
}
|
||||
|
||||
bool Entity::Test_Impact( Bullet *projectile )
|
||||
void Entity::Set_Loop_Trajectory( bool value )
|
||||
{
|
||||
|
||||
loopTrajectory = value;
|
||||
}
|
|
@ -18,7 +18,7 @@ class Entity
|
|||
|
||||
virtual void Update( float dt );
|
||||
virtual void Render( void );
|
||||
virtual bool Test_Impact( Bullet *projectile );
|
||||
virtual void Set_Loop_Trajectory( bool value );
|
||||
|
||||
|
||||
libnum::num x, y; // center position of the boss
|
||||
|
@ -30,6 +30,7 @@ class Entity
|
|||
bool toberemoved;
|
||||
|
||||
bool hasTrajectory = false;
|
||||
bool loopTrajectory = true;
|
||||
Trajectory *pathToFollow;
|
||||
float accumulatedTime;
|
||||
int16_t life0;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#include "laser.h"
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <num/num.h>
|
||||
#include <azur/gint/render.h>
|
||||
#include "../shaders/MyAzurShaders.h"
|
||||
|
||||
|
||||
Laser::Laser( uint16_t _sx, uint16_t _sy, int16_t _dx, int16_t _dy, uint16_t _id )
|
||||
{
|
||||
sx = libnum::num(_sx);
|
||||
sy = libnum::num(_sy);
|
||||
dx = libnum::num(_dx);
|
||||
dy = libnum::num(_dy);
|
||||
ID = _id;
|
||||
strength = 1;
|
||||
}
|
||||
|
||||
Laser::~Laser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Laser::Update( float dt )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Laser::Render( void )
|
||||
{
|
||||
// TODO this is juste for quick implementation : a thick Line Shader will be needed to be able to plot lasers in every directions
|
||||
azrp_line((int) sx , (int) sy , (int) (sx+dx*1000) , (int) (sy+dy*1000) , C_WHITE );
|
||||
//azrp_line((int) sx-1, (int) sy-1, (int) (sx+dx*1000)-1, (int) (sy+dy*1000)-1, RGB565_OCEANBLUE );
|
||||
//azrp_line((int) sx-2, (int) sy-2, (int) (sx+dx*1000)-2, (int) (sy+dy*1000)-2, RGB565_AZURBLUE );
|
||||
//azrp_line((int) sx+1, (int) sy+1, (int) (sx+dx*1000)+1, (int) (sy+dy*1000)+1, RGB565_OCEANBLUE );
|
||||
//azrp_line((int) sx+2, (int) sy+2, (int) (sx+dx*1000)+2, (int) (sy+dy*1000)+2, RGB565_AZURBLUE );
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef LASER_H
|
||||
#define LASER_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <num/num.h>
|
||||
|
||||
|
||||
class Laser
|
||||
{
|
||||
public:
|
||||
Laser( uint16_t _sx, uint16_t _sy, int16_t _dx, int16_t _dy, uint16_t _id );
|
||||
~Laser();
|
||||
void Update( float dt );
|
||||
void Render( void );
|
||||
|
||||
uint8_t ID;
|
||||
|
||||
libnum::num sx, sy;
|
||||
libnum::num dx, dy;
|
||||
|
||||
uint8_t strength;
|
||||
|
||||
bool toberemoved;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -6,8 +6,11 @@
|
|||
#include <num/num.h>
|
||||
#include <gint/rtc.h>
|
||||
#include "../utilities/fast_trig.h"
|
||||
#include "../utilities/utilities.h"
|
||||
#include "background.h"
|
||||
|
||||
#include "laser.h"
|
||||
|
||||
|
||||
extern bopti_image_t img_Lifebar;
|
||||
extern bopti_image_t *img_mainship1;
|
||||
|
@ -24,6 +27,11 @@ extern bopti_image_t img_player_ship8;
|
|||
extern bopti_image_t img_Satellite_Lvl1;
|
||||
extern Background MyBackground;
|
||||
|
||||
|
||||
int laser_angle = 0;
|
||||
int laser_incre = 1;
|
||||
|
||||
|
||||
Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
||||
{
|
||||
img_mainship1 = &img_player_ship7;
|
||||
|
@ -42,7 +50,9 @@ Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
|||
ymin = (int) y - height;
|
||||
ymax = (int) y + height;
|
||||
|
||||
if (ID==0) life = 1000;
|
||||
life0=10000;
|
||||
|
||||
if (ID==0) life = 10000;
|
||||
|
||||
lastshoot0 = rtc_ticks();
|
||||
lastshoot1 = rtc_ticks();
|
||||
|
@ -58,8 +68,12 @@ Player::Player( int16_t _x, int16_t _y, uint8_t _id )
|
|||
|
||||
Player::~Player()
|
||||
{
|
||||
|
||||
|
||||
for(unsigned int i=0; i<Lasers.size(); i++)
|
||||
{
|
||||
delete( Lasers[i] );
|
||||
Lasers.erase( Lasers.begin() + i );
|
||||
}
|
||||
Lasers.clear();
|
||||
}
|
||||
|
||||
void Player::Update( float dt )
|
||||
|
@ -74,14 +88,30 @@ void Player::Update( float dt )
|
|||
satAngle += satSpeed * dt / 25000.0f;
|
||||
if (satAngle>360.0f) satAngle-=360.0f;
|
||||
}
|
||||
|
||||
if(isLaser)
|
||||
{
|
||||
for(unsigned int i=0; i<Lasers.size(); i++)
|
||||
{
|
||||
Lasers[i]->sx = libnum::num(xmax);
|
||||
Lasers[i]->sy = y;
|
||||
}
|
||||
|
||||
laser_angle += laser_incre;
|
||||
if (laser_angle>15 || laser_angle<0) laser_incre *= -1;
|
||||
|
||||
Lasers[1]->dx = FastCosInt( laser_angle );
|
||||
Lasers[1]->dy = FastSinInt( laser_angle );
|
||||
|
||||
Lasers[2]->dx = FastCosInt( laser_angle );
|
||||
Lasers[2]->dy = - FastSinInt( laser_angle );
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Render( void )
|
||||
{
|
||||
azrp_subimage_p8_effect( (int) x - img_Lifebar.width/2, ymin - 10, &img_Lifebar, 0, 0, img_Lifebar.width, 7, DIMAGE_NONE );
|
||||
|
||||
if (ID==0) azrp_image_p8_effect(xmin, ymin, img_mainship1, DIMAGE_NONE);
|
||||
|
||||
int w = img_Satellite_Lvl1.width/2;
|
||||
int h = img_Satellite_Lvl1.height/2;
|
||||
|
||||
|
@ -99,12 +129,18 @@ void Player::Render( void )
|
|||
}
|
||||
}
|
||||
|
||||
int16_t life0=1000;
|
||||
|
||||
if (life>life0*2/3) azrp_subimage_p8_effect((int) x - img_Lifebar.width/2, ymin - 9, &img_Lifebar, 0, 7, (img_Lifebar.width*life)/life0, 5, DIMAGE_NONE );
|
||||
else if (life>life0/3) azrp_subimage_p8_effect((int) x - img_Lifebar.width/2, ymin - 9, &img_Lifebar, 0, 12, (img_Lifebar.width*life)/life0, 5, DIMAGE_NONE );
|
||||
else azrp_subimage_p8_effect((int) x - img_Lifebar.width/2, ymin - 9, &img_Lifebar, 0, 17, (img_Lifebar.width*life)/life0, 5, DIMAGE_NONE );
|
||||
|
||||
if (isLaser)
|
||||
{
|
||||
for(unsigned int i=0; i<Lasers.size(); i++)
|
||||
Lasers[i]->Render();
|
||||
}
|
||||
|
||||
if (ID==0) azrp_image_p8_effect(xmin, ymin, img_mainship1, DIMAGE_NONE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,12 +155,36 @@ bool Player::Test_Impact( Bullet *projectile )
|
|||
else return false;
|
||||
}
|
||||
|
||||
|
||||
bool Player::Test_Impact( Laser *projectile )
|
||||
{
|
||||
Vector2D Start( projectile->sx, projectile->sy );
|
||||
Vector2D Direction( projectile->dx, projectile->dy );
|
||||
|
||||
Vector2D BoxMin( xmin, ymin );
|
||||
Vector2D BoxMax( xmax, ymax );
|
||||
|
||||
if (LineRectangle_Collision( Start, Direction, BoxMin, BoxMax))
|
||||
{
|
||||
life -= projectile->strength;
|
||||
projectile->toberemoved = true;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
bool Player::Test_Impact( Bonus *bonus )
|
||||
{
|
||||
if (bonus->x >= xmin && bonus->x <= xmax && bonus->y >= ymin && bonus->y <= ymax )
|
||||
{
|
||||
if (bonus->ID==0) life = 1000;
|
||||
else if (bonus->ID==1) satNumber++;
|
||||
if (bonus->ID==0)
|
||||
{
|
||||
life += 1000;
|
||||
if (life>life0) life=life0;
|
||||
}
|
||||
else if (bonus->ID==1)
|
||||
satNumber++;
|
||||
|
||||
bonus->toberemoved = true;
|
||||
return true;
|
||||
|
@ -177,7 +237,16 @@ bool Player::Shoot_OK( uint32_t tempshoot, uint8_t shootID )
|
|||
}
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
else if (shootID==LASER)
|
||||
{
|
||||
Activate_Laser();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Desactivate_Laser();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Go_Left( float dt )
|
||||
|
@ -230,4 +299,43 @@ void Player::Go_Down( float dt )
|
|||
libnum::num a = libnum::num( dt / 90000.0f );
|
||||
MyBackground.IncYCoordinate( a );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Player::Activate_Laser( void )
|
||||
{
|
||||
if(isLaser==false)
|
||||
{
|
||||
isLaser = true;
|
||||
|
||||
Laser *mylaser1 = new Laser( (int) xmax, (int) y, 1, 0, LASER );
|
||||
Lasers.push_back( mylaser1 );
|
||||
|
||||
Laser *mylaser2 = new Laser( (int) xmax, (int) y, 1, 0, LASER );
|
||||
Lasers.push_back( mylaser2 );
|
||||
|
||||
Laser *mylaser3 = new Laser( (int) xmax, (int) y, 1, 0, LASER );
|
||||
Lasers.push_back( mylaser3 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Player::Desactivate_Laser( void )
|
||||
{
|
||||
if(isLaser==true)
|
||||
{
|
||||
isLaser = false;
|
||||
|
||||
for(unsigned int i=0; i<Lasers.size(); i++)
|
||||
{
|
||||
delete( Lasers[i] );
|
||||
Lasers.erase( Lasers.begin() + i );
|
||||
}
|
||||
Lasers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::Is_Laser_Activated( void )
|
||||
{
|
||||
return isLaser;
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
#include "bullet.h"
|
||||
#include "enemy.h"
|
||||
#include "bonus.h"
|
||||
#include "laser.h"
|
||||
|
||||
class Player
|
||||
{
|
||||
|
@ -22,6 +23,7 @@ class Player
|
|||
void Render( void );
|
||||
|
||||
bool Test_Impact( Bullet *projectile );
|
||||
bool Test_Impact( Laser *projectile );
|
||||
bool Test_Impact( Bonus *bonus );
|
||||
bool Test_Collision( Enemy *adverseship );
|
||||
void Set_Speed( uint8_t _sp );
|
||||
|
@ -32,12 +34,17 @@ class Player
|
|||
void Go_Right( float dt );
|
||||
void Go_Up( float dt );
|
||||
void Go_Down( float dt );
|
||||
|
||||
void Activate_Laser( void );
|
||||
void Desactivate_Laser( void );
|
||||
bool Is_Laser_Activated( void );
|
||||
|
||||
libnum::num x, y; // center position of the player
|
||||
uint8_t width, height; // width and height -for the hitbox
|
||||
int16_t xmin, xmax, ymin, ymax; // square hitbox (to speed up the bullet impact calculations)
|
||||
uint8_t ID;
|
||||
int16_t life;
|
||||
uint16_t life0;
|
||||
uint8_t speed; // speed of the player
|
||||
uint32_t lastshoot0 = 0;
|
||||
uint32_t lastshoot1 = 0;
|
||||
|
@ -47,10 +54,13 @@ class Player
|
|||
uint8_t satLevel;
|
||||
uint8_t satNumber;
|
||||
uint8_t satSpeed;
|
||||
std::vector <Laser*> Lasers;
|
||||
|
||||
private:
|
||||
float satAngle;
|
||||
uint8_t satRadius;
|
||||
bool isLaser = false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -34,11 +34,19 @@ void Trajectory::DeleteRegistry( void )
|
|||
registration--;
|
||||
}
|
||||
|
||||
void Trajectory::CalculatePosition( float *accumulatedTime, float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn )
|
||||
int8_t Trajectory::CalculatePosition( float *accumulatedTime, float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn )
|
||||
{
|
||||
*accumulatedTime += speed * time / 2000000.0f;
|
||||
if (*accumulatedTime>ControlPoints.size()) *accumulatedTime-=ControlPoints.size();
|
||||
if (*accumulatedTime<0) *accumulatedTime+=ControlPoints.size();
|
||||
|
||||
if( !looped && (*accumulatedTime>ControlPoints.size()))
|
||||
return -1;
|
||||
|
||||
if (*accumulatedTime>ControlPoints.size())
|
||||
*accumulatedTime -= ControlPoints.size();
|
||||
|
||||
if (*accumulatedTime<0)
|
||||
*accumulatedTime += ControlPoints.size();
|
||||
|
||||
|
||||
libnum::num t = libnum::num( *accumulatedTime - (int) *accumulatedTime );
|
||||
|
||||
|
@ -72,4 +80,6 @@ void Trajectory::CalculatePosition( float *accumulatedTime, float time, uint16_t
|
|||
|
||||
*xreturn = tx;
|
||||
*yreturn = ty;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Trajectory
|
|||
void AddPoint( Vector2D *p );
|
||||
void AddRegistry( void );
|
||||
void DeleteRegistry( void );
|
||||
void CalculatePosition( float *accumulatedTime, float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn );
|
||||
int8_t CalculatePosition( float *accumulatedTime, float time, uint16_t speed, bool looped, libnum::num *xreturn, libnum::num *yreturn );
|
||||
|
||||
std::vector<Vector2D*> ControlPoints;
|
||||
bool isLoop;
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <fxlibc/printf.h>
|
||||
#include <sys/types.h>
|
||||
#include "vector2D.h"
|
||||
#include <num/num.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
extern font_t milifont_prop;
|
||||
extern font_t font_shmup;
|
||||
|
||||
void Azur_draw_text(int x, int y, char const *fmt, ...)
|
||||
{
|
||||
|
@ -27,16 +31,35 @@ void Azur_draw_text(int x, int y, char const *fmt, ...)
|
|||
azrp_text( x, y, C_WHITE, str );
|
||||
}
|
||||
|
||||
void Azur_draw_text_shmup(int x, int y, char const *fmt, ...)
|
||||
{
|
||||
char str[128];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(str, 128, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
dfont( &font_shmup );
|
||||
|
||||
azrp_text( x+1, y+1, C_RED, str );
|
||||
azrp_text( x, y, C_WHITE, str );
|
||||
}
|
||||
|
||||
bool AABB_Collision( SpriteLocator image1, SpriteLocator image2 )
|
||||
{
|
||||
if( (image2.x >= image1.x + image1.image->width)
|
||||
|| (image2.x + image2.image->width <= image1.x)
|
||||
|| (image2.y >= image1.y + image1.image->height)
|
||||
|| (image2.y + image2.image->height <= image1.y) )
|
||||
return false;
|
||||
if( (image2.x >= image1.x + image1.image->width) ) return false;
|
||||
if( (image2.x + image2.image->width <= image1.x) ) return false;
|
||||
if( (image2.y >= image1.y + image1.image->height) ) return false;
|
||||
if( (image2.y + image2.image->height <= image1.y) ) return false;
|
||||
|
||||
|
||||
// if( (image2.x >= image1.x + image1.image->width)
|
||||
// || (image2.x + image2.image->width <= image1.x)
|
||||
// || (image2.y >= image1.y + image1.image->height)
|
||||
// || (image2.y + image2.image->height <= image1.y) )
|
||||
// return false;
|
||||
|
||||
|
||||
// no need to do pixel perfect detection
|
||||
return true;
|
||||
}
|
||||
|
@ -62,17 +85,8 @@ bool Pixel_Perfect_Collision( SpriteLocator image1, SpriteLocator image2 )
|
|||
if ( IMAGE_IS_P4(image1.image->format) || IMAGE_IS_P4(image2.image->format) )
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
|
||||
int astartx, aendx;
|
||||
int astarty, aendy;
|
||||
int adeltax, adeltay;
|
||||
|
||||
int bstartx, bendx;
|
||||
int bstarty, bendy;
|
||||
int bdeltax, bdeltay;
|
||||
|
||||
int rows, columns;
|
||||
|
||||
if (image1.x <= image2.x)
|
||||
|
@ -191,13 +205,15 @@ bool Pixel_Perfect_Collision( SpriteLocator image1, SpriteLocator image2 )
|
|||
d1 = data_u16_1[ adeltax + i ] == transp1 ? 0 : 1;
|
||||
else if (im1_P8)
|
||||
d1 = data_u8_1[ adeltax + i ] == transp1 ? 0 : 1;
|
||||
|
||||
else d1 = 0;
|
||||
|
||||
/* d2 is set to 1 if pixel of image2 is not transparent and to 0 if transparent */
|
||||
/* need to be format dependant here so quite time consumming test at each loop :( )*/
|
||||
if (im2_P16)
|
||||
d2 = data_u16_2[ bdeltax + i ] == transp2 ? 0 : 1;
|
||||
else if (im2_P8)
|
||||
d2 = data_u8_2[ bdeltax + i ] == transp2 ? 0 : 1;
|
||||
else d2 = 0;
|
||||
|
||||
/* if d1 + d2 = 2 means that both coincident pixels are not transparent and then we have collision*/
|
||||
if (d1 + d2 == 2) return true;
|
||||
|
@ -211,4 +227,115 @@ bool Pixel_Perfect_Collision( SpriteLocator image1, SpriteLocator image2 )
|
|||
data_u16_2 = (uint16_t *) data2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* NEW IMPLEMENTATION - TO TEST */
|
||||
|
||||
#include <num/vec.h>
|
||||
bool get_line_intersection( Vector2D p0_n, Vector2D p1_n, Vector2D p2_n, Vector2D p3_n, Vector2D *pr)
|
||||
{
|
||||
libnum::vec<float,2> p0((float)p0_n.x, (float)p0_n.y);
|
||||
libnum::vec<float,2> p1((float)p1_n.x, (float)p1_n.y);
|
||||
libnum::vec<float,2> p2((float)p2_n.x, (float)p2_n.y);
|
||||
libnum::vec<float,2> p3((float)p3_n.x, (float)p3_n.y);
|
||||
|
||||
libnum::vec<float,2> s1, s2;
|
||||
s1 = p1 - p0;
|
||||
s2 = p3 - p2;
|
||||
|
||||
float s, t, u;
|
||||
u = 1 / (-s2.x * s1.y + s1.x * s2.y);
|
||||
s = (-s1.y * (p0.x - p2.x) + s1.x * (p0.y - p2.y)) * u;
|
||||
if (s<0) return false;
|
||||
if (s>1) return false;
|
||||
|
||||
t = ( s2.x * (p0.y - p2.y) - s2.y * (p0.x - p2.x)) * u;
|
||||
if (t<0) return false;
|
||||
if (t>1) return false;
|
||||
|
||||
// Collision detected
|
||||
if (pr != NULL)
|
||||
{
|
||||
(*pr).x = p0.x + (t * s1.x);
|
||||
(*pr).y = p0.y + (t * s1.y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* FIRST IMPLEMENTATION USING THE VECTOR2D.H CLASS */
|
||||
|
||||
/* O is the origin, dir is the direction of the half line, A and B are the locations of the segment ends*/
|
||||
bool LineSegment_Collision( Vector2D O, Vector2D dir, Vector2D A, Vector2D B )
|
||||
{
|
||||
|
||||
Vector2D OA = A - O;
|
||||
|
||||
/* create the point P corresponding to the "end" of the infinite side of the half line */
|
||||
/* line length chosen to 1000 units as is it bigger than the diagonal of the screen in pixels*/
|
||||
Vector2D P = O.Clone();
|
||||
P.Add(dir, libnum::num(1000));
|
||||
|
||||
Vector2D OP = P - O;
|
||||
Vector2D OB = B - O;
|
||||
|
||||
/* if the products of determinants is <0, it means A and B are one on each side of the half line, so there is intersection*/
|
||||
libnum::num res1 = (OP.Det(OA) * OP.Det(OB));
|
||||
|
||||
Vector2D AP = P - A;
|
||||
Vector2D AB = B - A;
|
||||
Vector2D AO = O - A;
|
||||
|
||||
libnum::num res2 = (AB.Det(AP) * AB.Det(AO));
|
||||
|
||||
if (res1<0 && res2<0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool LineRectangle_Collision( Vector2D Start, Vector2D Direction, Vector2D Min, Vector2D Max )
|
||||
{
|
||||
Vector2D End = Start.Clone();
|
||||
End.Add( Direction, libnum::num(1000));
|
||||
|
||||
/* kind of quick AABB to quickly limit case where accurate check is done */
|
||||
if(Start.x < Min.x && End.x < Min.x ) return false;
|
||||
if(Start.x > Max.x && End.x > Max.x ) return false;
|
||||
if(Start.y < Min.y && End.y < Min.y ) return false;
|
||||
if(Start.y > Max.y && End.y > Max.y ) return false;
|
||||
|
||||
Vector2D P1(Min.x, Min.y);
|
||||
Vector2D P2(Max.x, Min.y);
|
||||
Vector2D P3(Max.x, Max.y);
|
||||
Vector2D P4(Min.x, Max.y);
|
||||
|
||||
if (get_line_intersection(Start, End, P1, P2, NULL) ) return true;
|
||||
if (get_line_intersection(Start, End, P2, P3, NULL) ) return true;
|
||||
if (get_line_intersection(Start, End, P3, P4, NULL) ) return true;
|
||||
if (get_line_intersection(Start, End, P4, P1, NULL) ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool LineTriangle_Collision( Vector2D Start, Vector2D Direction, Vector2D A, Vector2D B, Vector2D C )
|
||||
{
|
||||
Vector2D End = Start.Clone();
|
||||
End.Add( Direction, libnum::num(1000));
|
||||
|
||||
/* kind of quick AABB to quickly limit case where accurate check is done */
|
||||
Vector2D Min( std::min(A.x, std::min(B.x, C.x)), std::min(A.y, std::min(B.y, C.y)) );
|
||||
Vector2D Max( std::max(A.x, std::max(B.x, C.x)), std::max(A.y, std::max(B.y, C.y)) );
|
||||
|
||||
if(Start.x < Min.x && End.x < Min.x ) return false;
|
||||
if(Start.x > Max.x && End.x > Max.x ) return false;
|
||||
if(Start.y < Min.y && End.y < Min.y ) return false;
|
||||
if(Start.y > Max.y && End.y > Max.y ) return false;
|
||||
|
||||
if (get_line_intersection(Start, End, A, B, NULL) ) return true;
|
||||
if (get_line_intersection(Start, End, B, C, NULL) ) return true;
|
||||
if (get_line_intersection(Start, End, C, A, NULL) ) return true;
|
||||
return false;
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include "gint/image.h"
|
||||
#include "vector2D.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
|
@ -27,8 +28,13 @@ bool AABB_Collision( SpriteLocator image1, SpriteLocator image2 );
|
|||
|
||||
bool Pixel_Perfect_Collision( SpriteLocator image1, SpriteLocator image2 );
|
||||
|
||||
bool LineRectangle_Collision( Vector2D Start, Vector2D Direction, Vector2D Min, Vector2D Max );
|
||||
|
||||
bool LineSegment_Collision( Vector2D Start, Vector2D Direction, Vector2D A, Vector2D B );
|
||||
|
||||
bool LineTriangle_Collision( Vector2D Start, Vector2D Direction, Vector2D A, Vector2D B, Vector2D C );
|
||||
|
||||
void Azur_draw_text(int x, int y, char const *fmt, ...);
|
||||
|
||||
void Azur_draw_text_shmup(int x, int y, char const *fmt, ...);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue