Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
openjazz
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
openjazz
Commits
0faba79b
Commit
0faba79b
authored
Jul 01, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Alireza Nejati's menu plasma effect.
parent
588abf12
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
155 additions
and
4 deletions
+155
-4
Makefile
Makefile
+1
-1
Makefile.arm
Makefile.arm
+1
-1
Makefile.debian
Makefile.debian
+1
-1
mainmenu.cpp
src/menu/mainmenu.cpp
+9
-1
plasma.cpp
src/menu/plasma.cpp
+103
-0
plasma.h
src/menu/plasma.h
+40
-0
No files found.
Makefile
View file @
0faba79b
...
...
@@ -16,7 +16,7 @@ objects = src/bonus/bonus.o \
src/level/bullet.o src/level/demolevel.o src/level/level.o
\
src/level/levelframe.o src/level/levelload.o src/level/movable.o
\
src/menu/gamemenu.o src/menu/mainmenu.o src/menu/menu.o
\
src/menu/setupmenu.o
\
src/menu/
plasma.o src/menu/
setupmenu.o
\
src/planet/planet.o
\
src/player/bird.o src/player/bonusplayer.o src/player/jj2levelplayer.o
\
src/player/jj2levelplayerframe.o src/player/levelplayer.o
\
...
...
Makefile.arm
View file @
0faba79b
...
...
@@ -40,7 +40,7 @@ OBJS = src/bonus/bonus.o \
src/level/bullet.o src/level/demolevel.o src/level/level.o
\
src/level/levelframe.o src/level/levelload.o src/level/movable.o
\
src/menu/gamemenu.o src/menu/mainmenu.o src/menu/menu.o
\
src/menu/setupmenu.o
\
src/menu/
plasma.o src/menu/
setupmenu.o
\
src/planet/planet.o
\
src/player/bird.o src/player/bonusplayer.o src/player/jj2levelplayer.o
\
src/player/jj2levelplayerframe.o src/player/levelplayer.o
\
...
...
Makefile.debian
View file @
0faba79b
...
...
@@ -16,7 +16,7 @@ objects = src/bonus/bonus.o \
src/level/bullet.o src/level/demolevel.o src/level/level.o
\
src/level/levelframe.o src/level/levelload.o src/level/movable.o
\
src/menu/gamemenu.o src/menu/mainmenu.o src/menu/menu.o
\
src/menu/setupmenu.o
\
src/menu/
plasma.o src/menu/
setupmenu.o
\
src/planet/planet.o
\
src/player/bird.o src/player/bonusplayer.o src/player/jj2levelplayer.o
\
src/player/jj2levelplayerframe.o src/player/levelplayer.o
\
...
...
src/menu/mainmenu.cpp
View file @
0faba79b
...
...
@@ -27,6 +27,7 @@
#include "menu.h"
#include "plasma.h"
#include "game/game.h"
#include "game/gamemode.h"
...
...
@@ -116,6 +117,7 @@ MainMenu::MainMenu () {
SDL_SetColorKey
(
background
,
SDL_SRCCOLORKEY
,
0
);
SDL_SetColorKey
(
highlight
,
SDL_SRCCOLORKEY
,
0
);
SDL_SetColorKey
(
logo
,
SDL_SRCCOLORKEY
,
28
);
gameMenu
=
new
GameMenu
(
file
);
...
...
@@ -142,6 +144,7 @@ MainMenu::~MainMenu () {
int
MainMenu
::
main
()
{
Scene
*
scene
;
Plasma
plasma
;
SetupMenu
setupMenu
;
SDL_Rect
src
,
dst
;
int
option
;
...
...
@@ -310,7 +313,12 @@ int MainMenu::main () {
SDL_Delay
(
T_FRAME
);
clearScreen
(
28
);
//as long as we're drawing plasma, we don't need to clear the screen.
//clearScreen(28);
plasma
.
draw
();
dst
.
x
=
(
canvasW
>>
2
)
-
72
;
dst
.
y
=
canvasH
-
(
canvasH
>>
2
);
...
...
src/menu/plasma.cpp
0 → 100644
View file @
0faba79b
/*
*
* plasma.cpp
*
* 23rd June 2010: Created plasma.c
*
* Part of the OpenJazz project
*
*
* Copyright (c) 2010 Alireza Nejati
*
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* Cool plasma effects for the main menu.
*/
#include "plasma.h"
#include "baselevel.h"
#include "util.h"
#include "io/gfx/video.h"
#include <SDL/SDL.h>
#ifdef SCALE
#include "io/gfx/scale2x/scalebit.h"
#endif
// Precalculate buffers
Plasma
::
Plasma
(){
p0
=
0
;
p1
=
0
;
p2
=
0
;
p3
=
0
;
//fSin, fCos: pi = 512
// -1024 < out < 1024
}
// TODO: this code is awful in so many ways
// Draws plasma onto canvas
int
Plasma
::
draw
(){
int
x
,
y
;
int
t1
,
t2
,
t3
,
t4
;
int
w
,
h
,
pitch
;
unsigned
char
*
px
;
unsigned
char
colour
;
unsigned
int
colb
;
// draw plasma
SDL_LockSurface
(
canvas
);
w
=
canvas
->
w
;
h
=
canvas
->
h
;
pitch
=
canvas
->
pitch
;
px
=
(
unsigned
char
*
)
canvas
->
pixels
;
t1
=
p0
;
t2
=
p1
;
for
(
y
=
0
;
y
<
h
;
y
++
){
t3
=
p2
;
t4
=
p3
;
colb
=
(
fCos
(
t1
*
4
)
<<
3
)
+
(
fCos
(
t2
*
4
)
<<
3
)
+
(
32
<<
10
);
for
(
x
=
0
;
x
<
w
;
x
++
){
colour
=
((
colb
+
(
fCos
(
t3
*
4
)
<<
3
)
+
(
fCos
(
t4
*
4
)
<<
3
))
>>
10
)
&
0xF
;
t3
+=
3
;
t4
+=
2
;
px
[
x
]
=
colour
;
}
// go to next row
px
+=
pitch
;
t1
+=
2
;
t2
+=
1
;
}
p0
=
p0
<
256
?
p0
+
1
:
1
;
p1
=
p1
<
256
?
p1
+
2
:
2
;
p2
=
p2
<
256
?
p2
+
3
:
3
;
p3
=
p3
<
256
?
p3
+
4
:
4
;
SDL_UnlockSurface
(
canvas
);
return
E_NONE
;
}
src/menu/plasma.h
0 → 100644
View file @
0faba79b
/*
*
* plasma.h
*
* 23rd June 2010: Created plasma.h
*
* Part of the OpenJazz project
*
*
* Copyright (c) 2010 Alireza Nejati
*
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _PLASMA_H
#define _PLASMA_H
#include <SDL/SDL.h>
class
Plasma
{
private
:
int
p0
,
p1
,
p2
,
p3
;
public
:
Plasma
();
int
draw
();
};
#endif
Write
Preview
Markdown
is supported
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