mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Moved most constants into relevant classes.
This commit is contained in:
@@ -18,7 +18,14 @@ LOVE 0.6.0
|
||||
* Changed love.filesystem.open to accept mode (removed from love.filesystem.newFile).
|
||||
* Changed love.filesystem.read() which now returns two parameters (data, length).
|
||||
* Changed love.filesystem.write() which now takes up to four parameters (file, data, length, mode).
|
||||
* Changed default color mode to love.color_modulate.
|
||||
* Changed named of love.color_normal to love.color_replace.
|
||||
* Changed name of love.blend_normal to love.blend_alpha.
|
||||
|
||||
* Removed Color object.
|
||||
* Removed Animation.
|
||||
* Removed ParticleSystem (!)
|
||||
* Removed several constants.
|
||||
* Removed love.graphics.draw() for strings.
|
||||
* Removed love.system.
|
||||
* Removed conf files.
|
||||
|
||||
+28
-240
@@ -782,6 +782,10 @@
|
||||
RelativePath="..\..\src\modules\graphics\Drawable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\Graphics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\Image.h"
|
||||
>
|
||||
@@ -813,54 +817,6 @@
|
||||
<Filter
|
||||
Name="opengl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\Animation.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\Animation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\Color.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\Color.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\Font.cpp"
|
||||
>
|
||||
@@ -1005,54 +961,6 @@
|
||||
RelativePath="..\..\src\modules\graphics\opengl\ImageFont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\ParticleSystem.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\ParticleSystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\SpriteBatch.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\SpriteBatch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\TrueTypeFont.cpp"
|
||||
>
|
||||
@@ -1077,78 +985,6 @@
|
||||
RelativePath="..\..\src\modules\graphics\opengl\TrueTypeFont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\VertexBuffer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\VertexBuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_Animation.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_Animation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_Color.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_Color.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_Font.cpp"
|
||||
>
|
||||
@@ -1245,78 +1081,6 @@
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_Image.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_VertexBuffer.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\graphics\opengl\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\graphics\opengl\wrap_VertexBuffer.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
@@ -1454,6 +1218,10 @@
|
||||
<Filter
|
||||
Name="joystick"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\joystick\Joystick.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="sdl"
|
||||
>
|
||||
@@ -1510,6 +1278,10 @@
|
||||
<Filter
|
||||
Name="keyboard"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\keyboard\Keyboard.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="sdl"
|
||||
>
|
||||
@@ -1566,6 +1338,10 @@
|
||||
<Filter
|
||||
Name="mouse"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\mouse\Mouse.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="sdl"
|
||||
>
|
||||
@@ -1622,6 +1398,14 @@
|
||||
<Filter
|
||||
Name="physics"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\physics\Joint.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\modules\physics\Shape.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="box2d"
|
||||
>
|
||||
@@ -3369,6 +3153,10 @@
|
||||
RelativePath="..\..\src\common\constants.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\common\constants.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\common\Data.h"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include <filesystem/File.h>
|
||||
#include <event/Event.h>
|
||||
#include <mouse/Mouse.h>
|
||||
#include <keyboard/Keyboard.h>
|
||||
#include <joystick/Joystick.h>
|
||||
#include <graphics/Graphics.h>
|
||||
#include <graphics/Image.h>
|
||||
#include <physics/Shape.h>
|
||||
#include <physics/Joint.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
// Constants.
|
||||
const lua_constant_entry lua_constants[] =
|
||||
{
|
||||
{ "key_unknown", 0 },
|
||||
{ "key_first", 0 },
|
||||
{ "key_backspace", 8 },
|
||||
{ "key_tab", 9 },
|
||||
{ "key_clear", 12 },
|
||||
{ "key_return", 13 },
|
||||
{ "key_pause", 19 },
|
||||
{ "key_escape", 27 },
|
||||
{ "key_space", 32 },
|
||||
{ "key_exclaim", 33 },
|
||||
{ "key_quotedbl", 34 },
|
||||
{ "key_hash", 35 },
|
||||
{ "key_dollar", 36 },
|
||||
{ "key_ampersand", 38 },
|
||||
{ "key_quote", 39 },
|
||||
{ "key_leftparen", 40 },
|
||||
{ "key_rightparen", 41 },
|
||||
{ "key_asterisk", 42 },
|
||||
{ "key_plus", 43 },
|
||||
{ "key_comma", 44 },
|
||||
{ "key_minus", 45 },
|
||||
{ "key_period", 46 },
|
||||
{ "key_slash", 47 },
|
||||
|
||||
{ "key_0", 48 },
|
||||
{ "key_1", 49 },
|
||||
{ "key_2", 50 },
|
||||
{ "key_3", 51 },
|
||||
{ "key_4", 52 },
|
||||
{ "key_5", 53 },
|
||||
{ "key_6", 54 },
|
||||
{ "key_7", 55 },
|
||||
{ "key_8", 56 },
|
||||
{ "key_9", 57 },
|
||||
|
||||
{ "key_colon", 58 },
|
||||
{ "key_semicolon", 59 },
|
||||
{ "key_less", 60 },
|
||||
{ "key_equals", 61 },
|
||||
{ "key_greater", 62 },
|
||||
{ "key_question", 63 },
|
||||
{ "key_at", 64 },
|
||||
|
||||
{ "key_leftbracket", 91 },
|
||||
{ "key_backslash", 92 },
|
||||
{ "key_rightbracket", 93 },
|
||||
{ "key_caret", 94 },
|
||||
{ "key_underscore", 95 },
|
||||
{ "key_backquote", 96 },
|
||||
|
||||
{ "key_a", 97 },
|
||||
{ "key_b", 98 },
|
||||
{ "key_c", 99 },
|
||||
{ "key_d", 100 },
|
||||
{ "key_e", 101 },
|
||||
{ "key_f", 102 },
|
||||
{ "key_g", 103 },
|
||||
{ "key_h", 104 },
|
||||
{ "key_i", 105 },
|
||||
{ "key_j", 106 },
|
||||
{ "key_k", 107 },
|
||||
{ "key_l", 108 },
|
||||
{ "key_m", 109 },
|
||||
{ "key_n", 110 },
|
||||
{ "key_o", 111 },
|
||||
{ "key_p", 112 },
|
||||
{ "key_q", 113 },
|
||||
{ "key_r", 114 },
|
||||
{ "key_s", 115 },
|
||||
{ "key_t", 116 },
|
||||
{ "key_u", 117 },
|
||||
{ "key_v", 118 },
|
||||
{ "key_w", 119 },
|
||||
{ "key_x", 120 },
|
||||
{ "key_y", 121 },
|
||||
{ "key_z", 122 },
|
||||
{ "key_delete", 127 },
|
||||
|
||||
{ "key_kp0", 256 },
|
||||
{ "key_kp1", 257 },
|
||||
{ "key_kp2", 258 },
|
||||
{ "key_kp3", 259 },
|
||||
{ "key_kp4", 260 },
|
||||
{ "key_kp5", 261 },
|
||||
{ "key_kp6", 262 },
|
||||
{ "key_kp7", 263 },
|
||||
{ "key_kp8", 264 },
|
||||
{ "key_kp9", 265 },
|
||||
{ "key_kp_period", 266 },
|
||||
{ "key_kp_divide", 267 },
|
||||
{ "key_kp_multiply", 268 },
|
||||
{ "key_kp_minus", 269 },
|
||||
{ "key_kp_plus", 270 },
|
||||
{ "key_kp_enter", 271 },
|
||||
{ "key_kp_equals", 272 },
|
||||
|
||||
{ "key_up", 273 },
|
||||
{ "key_down", 274 },
|
||||
{ "key_right", 275 },
|
||||
{ "key_left", 276 },
|
||||
{ "key_insert", 277 },
|
||||
{ "key_home", 278 },
|
||||
{ "key_end", 279 },
|
||||
{ "key_pageup", 280 },
|
||||
{ "key_pagedown", 281 },
|
||||
|
||||
{ "key_f1", 282 },
|
||||
{ "key_f2", 283 },
|
||||
{ "key_f3", 284 },
|
||||
{ "key_f4", 285 },
|
||||
{ "key_f5", 286 },
|
||||
{ "key_f6", 287 },
|
||||
{ "key_f7", 288 },
|
||||
{ "key_f8", 289 },
|
||||
{ "key_f9", 290 },
|
||||
{ "key_f10", 291 },
|
||||
{ "key_f11", 292 },
|
||||
{ "key_f12", 293 },
|
||||
{ "key_f13", 294 },
|
||||
{ "key_f14", 295 },
|
||||
{ "key_f15", 296 },
|
||||
|
||||
{ "key_numlock", 300 },
|
||||
{ "key_capslock", 301 },
|
||||
{ "key_scrollock", 302 },
|
||||
{ "key_rshift", 303 },
|
||||
{ "key_lshift", 304 },
|
||||
{ "key_rctrl", 305 },
|
||||
{ "key_lctrl", 306 },
|
||||
{ "key_ralt", 307 },
|
||||
{ "key_lalt", 308 },
|
||||
{ "key_rmeta", 309 },
|
||||
{ "key_lmeta", 310 },
|
||||
{ "key_lsuper", 311 },
|
||||
{ "key_rsuper", 312 },
|
||||
{ "key_mode", 313 },
|
||||
{ "key_compose", 314 },
|
||||
|
||||
{ "key_help", 315 },
|
||||
{ "key_print", 316 },
|
||||
{ "key_sysreq", 317 },
|
||||
{ "key_break", 318 },
|
||||
{ "key_menu", 319 },
|
||||
{ "key_power", 320 },
|
||||
{ "key_euro", 321 },
|
||||
{ "key_undo", 322 },
|
||||
|
||||
{ "key_repeat_delay", keyboard::Keyboard::KEY_REPEAT_DELAY },
|
||||
{ "key_repeat_interval", keyboard::Keyboard::KEY_REPEAT_INTERVAL },
|
||||
|
||||
{ "mouse_left", mouse::Mouse::MOUSE_LEFT },
|
||||
{ "mouse_middle", mouse::Mouse::MOUSE_MIDDLE },
|
||||
{ "mouse_right", mouse::Mouse::MOUSE_RIGHT },
|
||||
{ "mouse_wheelup", mouse::Mouse::MOUSE_WHEELUP },
|
||||
{ "mouse_wheeldown", mouse::Mouse::MOUSE_WHEELDOWN },
|
||||
|
||||
{ "align_left", graphics::Graphics::ALIGN_LEFT },
|
||||
{ "align_right", graphics::Graphics::ALIGN_RIGHT },
|
||||
{ "align_center", graphics::Graphics::ALIGN_CENTER },
|
||||
|
||||
{ "blend_alpha", graphics::Graphics::BLEND_ALPHA },
|
||||
{ "blend_additive", graphics::Graphics::BLEND_ADDITIVE },
|
||||
{ "color_replace", graphics::Graphics::COLOR_REPLACE },
|
||||
{ "color_modulate", graphics::Graphics::COLOR_MODULATE },
|
||||
|
||||
{ "file_closed", filesystem::File::CLOSED },
|
||||
{ "file_read", filesystem::File::READ },
|
||||
{ "file_write", filesystem::File::WRITE },
|
||||
{ "file_append", filesystem::File::APPEND },
|
||||
|
||||
{ "draw_line", graphics::Graphics::DRAW_LINE },
|
||||
{ "draw_fill", graphics::Graphics::DRAW_FILL },
|
||||
|
||||
{ "line_smooth", graphics::Graphics::LINE_SMOOTH },
|
||||
{ "line_rough", graphics::Graphics::LINE_ROUGH },
|
||||
|
||||
{ "point_smooth", graphics::Graphics::POINT_SMOOTH },
|
||||
{ "point_rough", graphics::Graphics::POINT_ROUGH },
|
||||
|
||||
{ "shape_circle", physics::Shape::SHAPE_CIRCLE },
|
||||
{ "shape_polygon", physics::Shape::SHAPE_POLYGON },
|
||||
|
||||
{ "joint_distance", physics::Joint::JOINT_DISTANCE },
|
||||
{ "joint_revolute", physics::Joint::JOINT_REVOLUTE },
|
||||
{ "joint_prismatic", physics::Joint::JOINT_PRISMATIC },
|
||||
{ "joint_mouse", physics::Joint::JOINT_MOUSE },
|
||||
{ "joint_pulley", physics::Joint::JOINT_PULLEY },
|
||||
{ "joint_gear", physics::Joint::JOINT_GEAR },
|
||||
|
||||
{ "joystick_axis_horizontal", joystick::Joystick::JOYSTICK_AXIS_HORIZONTAL },
|
||||
{ "joystick_axis_vertical", joystick::Joystick::JOYSTICK_AXIS_VERITCAL },
|
||||
|
||||
{ "joystick_hat_centered", joystick::Joystick::JOYSTICK_HAT_CENTERED },
|
||||
{ "joystick_hat_up", joystick::Joystick::JOYSTICK_HAT_UP },
|
||||
{ "joystick_hat_right", joystick::Joystick::JOYSTICK_HAT_RIGHT },
|
||||
{ "joystick_hat_down", joystick::Joystick::JOYSTICK_HAT_DOWN },
|
||||
{ "joystick_hat_left", joystick::Joystick::JOYSTICK_HAT_LEFT },
|
||||
{ "joystick_hat_rightup", joystick::Joystick::JOYSTICK_HAT_RIGHTUP },
|
||||
{ "joystick_hat_rightdown", joystick::Joystick::JOYSTICK_HAT_RIGHTDOWN },
|
||||
{ "joystick_hat_leftup", joystick::Joystick::JOYSTICK_HAT_LEFTUP },
|
||||
{ "joystick_hat_leftdown", joystick::Joystick::JOYSTICK_HAT_LEFTDOWN },
|
||||
|
||||
{ "event_keypressed", event::Event::EVENT_KEYDOWN },
|
||||
{ "event_keyreleased", event::Event::EVENT_KEYUP },
|
||||
{ "event_mousepressed", event::Event::EVENT_MOUSEBUTTONDOWN },
|
||||
{ "event_mousereleased", event::Event::EVENT_MOUSEBUTTONUP },
|
||||
{ "event_joystickpressed", event::Event::EVENT_JOYBUTTONDOWN },
|
||||
{ "event_joystickreleased", event::Event::EVENT_JOYBUTTONUP },
|
||||
{ "event_quit", event::Event::EVENT_QUIT },
|
||||
|
||||
{ "filter_linear", graphics::Image::FILTER_LINEAR },
|
||||
{ "filter_nearest", graphics::Image::FILTER_NEAREST },
|
||||
|
||||
{ "wrap_clamp", graphics::Image::WRAP_CLAMP },
|
||||
{ "wrap_repeat", graphics::Image::WRAP_REPEAT },
|
||||
|
||||
/**
|
||||
|
||||
// Vertex buffer geometry types.
|
||||
|
||||
{ "type_points", TYPE_POINTS },
|
||||
{ "type_lines", TYPE_LINES },
|
||||
{ "type_line_strip", TYPE_LINE_STRIP },
|
||||
{ "type_triangles", TYPE_TRIANGLES },
|
||||
{ "type_triangle_strip", TYPE_TRIANGLE_STRIP },
|
||||
{ "type_triangle_fan", TYPE_TRIANGLE_FAN },
|
||||
{ "type_num", TYPE_NUM },
|
||||
|
||||
// Vertex buffer usage hints.
|
||||
|
||||
{ "usage_array", USAGE_ARRAY },
|
||||
{ "usage_dynamic", USAGE_DYNAMIC },
|
||||
{ "usage_static", USAGE_STATIC },
|
||||
{ "usage_stream", USAGE_STREAM },
|
||||
{ "usage_num", USAGE_NUM },
|
||||
**/
|
||||
|
||||
{0, 0}, // Indicates the end
|
||||
|
||||
}; // lua constants
|
||||
|
||||
} // love
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_CONSTANTS_H
|
||||
#define LOVE_CONSTANTS_H
|
||||
|
||||
namespace love
|
||||
{
|
||||
// Type used for storing constants
|
||||
// in an array.
|
||||
typedef struct lua_constant_entry
|
||||
{
|
||||
const char * name;
|
||||
int value;
|
||||
} lua_constant_entry;
|
||||
|
||||
extern const lua_constant_entry lua_constants[];
|
||||
|
||||
} // love
|
||||
|
||||
#endif // LOVE_CONSTANTS_H
|
||||
@@ -33,15 +33,6 @@ extern "C" {
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
// Type used for storing constants
|
||||
// in an array.
|
||||
typedef struct lua_constant_entry
|
||||
{
|
||||
const char * name;
|
||||
int value;
|
||||
} lua_constant_entry;
|
||||
|
||||
class Module;
|
||||
|
||||
void luax_printstack(lua_State * L);
|
||||
|
||||
@@ -29,11 +29,7 @@
|
||||
#include <common/constants.h>
|
||||
|
||||
// Modules
|
||||
|
||||
#include <audio/wrap_Audio.h>
|
||||
#include <audio/openal/Audio.h>
|
||||
#include <audio/null/Audio.h>
|
||||
|
||||
#include <event/sdl/wrap_Event.h>
|
||||
#include <filesystem/physfs/wrap_Filesystem.h>
|
||||
#include <graphics/opengl/wrap_Graphics.h>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_GRAPHICS_GRAPHICS_H
|
||||
#define LOVE_GRAPHICS_GRAPHICS_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace graphics
|
||||
{
|
||||
class Graphics : public Module
|
||||
{
|
||||
public:
|
||||
|
||||
enum DrawMode
|
||||
{
|
||||
DRAW_LINE,
|
||||
DRAW_FILL
|
||||
};
|
||||
|
||||
enum AlignMode
|
||||
{
|
||||
ALIGN_LEFT,
|
||||
ALIGN_CENTER,
|
||||
ALIGN_RIGHT
|
||||
};
|
||||
|
||||
enum BlendMode
|
||||
{
|
||||
BLEND_ALPHA,
|
||||
BLEND_ADDITIVE
|
||||
};
|
||||
|
||||
enum ColorMode
|
||||
{
|
||||
COLOR_MODULATE,
|
||||
COLOR_REPLACE
|
||||
};
|
||||
|
||||
enum LineStyle
|
||||
{
|
||||
LINE_ROUGH,
|
||||
LINE_SMOOTH
|
||||
};
|
||||
|
||||
enum PointStyle
|
||||
{
|
||||
POINT_ROUGH,
|
||||
POINT_SMOOTH
|
||||
};
|
||||
|
||||
virtual ~Graphics(){};
|
||||
|
||||
}; // Graphics
|
||||
|
||||
} // graphics
|
||||
} // love
|
||||
|
||||
#endif // LOVE_GRAPHICS_GRAPHICS_H
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_GRAPHICS_IMAGE_H
|
||||
#define LOVE_GRAPHICS_IMAGE_H
|
||||
|
||||
// LOVE
|
||||
#include <graphics/Volatile.h>
|
||||
#include <graphics/Drawable.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
class Image : public Drawable, public Volatile
|
||||
{
|
||||
public:
|
||||
|
||||
enum WrapMode
|
||||
{
|
||||
WRAP_CLAMP,
|
||||
WRAP_REPEAT
|
||||
};
|
||||
|
||||
enum FilterMode
|
||||
{
|
||||
FILTER_LINEAR,
|
||||
FILTER_NEAREST
|
||||
};
|
||||
|
||||
struct Filter
|
||||
{
|
||||
FilterMode min;
|
||||
FilterMode mag;
|
||||
};
|
||||
|
||||
struct Wrap
|
||||
{
|
||||
WrapMode s;
|
||||
WrapMode t;
|
||||
};
|
||||
|
||||
virtual ~Image(){};
|
||||
|
||||
}; // Image
|
||||
|
||||
} // graphics
|
||||
} // love
|
||||
|
||||
#endif // LOVE_GRAPHICS_IMAGE_H
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
// LOVE
|
||||
#include <common/config.h>
|
||||
#include <common/constants.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -76,29 +75,29 @@ namespace opengl
|
||||
float color[4];
|
||||
//get the color
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
s.color[0] = (GLubyte)(color[0]*255.0f);
|
||||
s.color[1] = (GLubyte)(color[1]*255.0f);
|
||||
s.color[2] = (GLubyte)(color[2]*255.0f);
|
||||
s.color[3] = (GLubyte)(color[3]*255.0f);
|
||||
s.color.r = (GLubyte)(color[0]*255.0f);
|
||||
s.color.g = (GLubyte)(color[1]*255.0f);
|
||||
s.color.b = (GLubyte)(color[2]*255.0f);
|
||||
s.color.a = (GLubyte)(color[3]*255.0f);
|
||||
//get the background color
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, color);
|
||||
s.backgroundColor[0] = (GLubyte)(color[0]*255.0f);
|
||||
s.backgroundColor[1] = (GLubyte)(color[1]*255.0f);
|
||||
s.backgroundColor[2] = (GLubyte)(color[2]*255.0f);
|
||||
s.backgroundColor[3] = (GLubyte)(color[3]*255.0f);
|
||||
s.backgroundColor.r = (GLubyte)(color[0]*255.0f);
|
||||
s.backgroundColor.g = (GLubyte)(color[1]*255.0f);
|
||||
s.backgroundColor.b = (GLubyte)(color[2]*255.0f);
|
||||
s.backgroundColor.a = (GLubyte)(color[3]*255.0f);
|
||||
//store modes here
|
||||
int mode;
|
||||
//get blend mode
|
||||
glGetIntegerv(GL_BLEND_DST, &mode);
|
||||
//following syntax seems better than if-else every time
|
||||
s.blendMode = (mode == GL_ONE) ? BLEND_ADDITIVE : BLEND_NORMAL;
|
||||
s.blendMode = (mode == GL_ONE) ? Graphics::BLEND_ADDITIVE : Graphics::BLEND_ALPHA;
|
||||
//get color mode
|
||||
glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &mode);
|
||||
s.colorMode = (mode == GL_MODULATE) ? COLOR_MODULATE : COLOR_NORMAL;
|
||||
s.colorMode = (mode == GL_MODULATE) ? Graphics::COLOR_MODULATE : Graphics::COLOR_REPLACE;
|
||||
//get the line width (directly to corresponding variable)
|
||||
glGetFloatv(GL_LINE_WIDTH, &s.lineWidth);
|
||||
//get line style
|
||||
s.lineStyle = (glIsEnabled(GL_LINE_SMOOTH) == GL_TRUE) ? LINE_SMOOTH : LINE_ROUGH;
|
||||
s.lineStyle = (glIsEnabled(GL_LINE_SMOOTH) == GL_TRUE) ? Graphics::LINE_SMOOTH : Graphics::LINE_ROUGH;
|
||||
//get line stipple
|
||||
s.stipple = (glIsEnabled(GL_LINE_SMOOTH) == GL_TRUE) ? true : false;
|
||||
if (s.stipple)
|
||||
@@ -111,7 +110,7 @@ namespace opengl
|
||||
//get the point size
|
||||
glGetFloatv(GL_POINT_SIZE, &s.pointSize);
|
||||
//get point style
|
||||
s.pointStyle = (glIsEnabled(GL_POINT_SMOOTH) == GL_TRUE) ? POINT_SMOOTH : POINT_ROUGH;
|
||||
s.pointStyle = (glIsEnabled(GL_POINT_SMOOTH) == GL_TRUE) ? Graphics::POINT_SMOOTH : Graphics::POINT_ROUGH;
|
||||
//get scissor status
|
||||
s.scissor = (glIsEnabled(GL_SCISSOR_TEST) == GL_TRUE) ? true : false;
|
||||
//do we have scissor, if so, store the box
|
||||
@@ -122,8 +121,8 @@ namespace opengl
|
||||
|
||||
void Graphics::restoreState(const DisplayState & s)
|
||||
{
|
||||
setColor(s.color[0], s.color[1], s.color[2], s.color[3]);
|
||||
setBackgroundColor(s.backgroundColor[0], s.backgroundColor[1], s.backgroundColor[2]);
|
||||
setColor(s.color);
|
||||
setBackgroundColor(s.backgroundColor);
|
||||
setBlendMode(s.blendMode);
|
||||
setColorMode(s.colorMode);
|
||||
setLine(s.lineWidth, s.lineStyle);
|
||||
@@ -401,11 +400,6 @@ namespace opengl
|
||||
return new Frame(x, y, w, h, sw, sh);
|
||||
}
|
||||
|
||||
Color * Graphics::newColor(int r, int g, int b, int a)
|
||||
{
|
||||
return new Color(r, g, b, a);
|
||||
}
|
||||
|
||||
Font * Graphics::newFont(love::filesystem::File * file, int size)
|
||||
{
|
||||
Font * font = new TrueTypeFont(file, size);
|
||||
@@ -434,58 +428,49 @@ namespace opengl
|
||||
return font;
|
||||
}
|
||||
|
||||
Animation * Graphics::newAnimation(Image * image)
|
||||
{
|
||||
return new Animation(image);
|
||||
}
|
||||
|
||||
Animation * Graphics::newAnimation(Image * image, float fw, float fh, float delay, int num)
|
||||
{
|
||||
return new Animation(image, fw, fh, delay, num);
|
||||
}
|
||||
|
||||
/*
|
||||
SpriteBatch * Graphics::newSpriteBatch(Image * image, int size, int usage)
|
||||
{
|
||||
return new SpriteBatch(image, size, usage);
|
||||
}
|
||||
*/
|
||||
|
||||
VertexBuffer * Graphics::newVertexBuffer(Image * image, int size, int type, int usage)
|
||||
{
|
||||
return new VertexBuffer(image, size, type, usage);
|
||||
}
|
||||
|
||||
void Graphics::setColor( int r, int g, int b, int a)
|
||||
void Graphics::setColor(Color c)
|
||||
{
|
||||
glColor4ub(r, g, b, a);
|
||||
glColor4ubv(&c.r);
|
||||
}
|
||||
|
||||
void Graphics::setColor( Color * color )
|
||||
{
|
||||
glColor4ub(color->getRed(), color->getGreen(), color->getBlue(), color->getAlpha());
|
||||
}
|
||||
|
||||
Color * Graphics::getColor()
|
||||
Color Graphics::getColor()
|
||||
{
|
||||
float c[4];
|
||||
glGetFloatv(GL_CURRENT_COLOR, c);
|
||||
return new Color((int)(255.0f*c[0]), (int)(255.0f*c[1]), (int)(255.0f*c[2]), (int)(255.0f*c[3]));
|
||||
|
||||
Color t;
|
||||
t.r = (unsigned char)(255.0f*c[0]);
|
||||
t.g = (unsigned char)(255.0f*c[1]);
|
||||
t.b = (unsigned char)(255.0f*c[2]);
|
||||
t.a = (unsigned char)(255.0f*c[3]);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
void Graphics::setBackgroundColor( int r, int g, int b )
|
||||
void Graphics::setBackgroundColor(Color c)
|
||||
{
|
||||
glClearColor( (float)r/255.0f, (float)g/255.0f, (float)b/255.0f, 1.0f);
|
||||
glClearColor((float)c.r/255.0f, (float)c.g/255.0f, (float)c.b/255.0f, 1.0f);
|
||||
}
|
||||
|
||||
void Graphics::setBackgroundColor( Color * color )
|
||||
{
|
||||
glClearColor( (float)color->getRed()/255.0f, (float)color->getGreen()/255.0f, (float)color->getBlue()/255.0f, 1.0f);
|
||||
}
|
||||
|
||||
Color * Graphics::getBackgroundColor()
|
||||
Color Graphics::getBackgroundColor()
|
||||
{
|
||||
float c[4];
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, c);
|
||||
return new Color((int)(255.0f*c[0]), (int)(255.0f*c[1]), (int)(255.0f*c[2]), (int)(255.0f*c[3]));
|
||||
|
||||
Color t;
|
||||
t.r = (unsigned char)(255.0f*c[0]);
|
||||
t.g = (unsigned char)(255.0f*c[1]);
|
||||
t.b = (unsigned char)(255.0f*c[2]);
|
||||
t.a = (unsigned char)(255.0f*c[3]);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
void Graphics::setFont( Font * font )
|
||||
@@ -517,7 +502,7 @@ namespace opengl
|
||||
{
|
||||
if(mode == BLEND_ADDITIVE)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
else // mode == BLEND_NORMAL
|
||||
else // mode == BLEND_ALPHA
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
@@ -525,7 +510,7 @@ namespace opengl
|
||||
{
|
||||
if(mode == COLOR_MODULATE)
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
else // mode = COLOR_NORMAL
|
||||
else // mode = COLOR_REPLACE
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
}
|
||||
|
||||
@@ -538,7 +523,7 @@ namespace opengl
|
||||
if(src == GL_SRC_ALPHA && dst == GL_ONE)
|
||||
return BLEND_ADDITIVE;
|
||||
else // src == GL_SRC_ALPHA && dst == GL_ONE_MINUS_SRC_ALPHA
|
||||
return BLEND_NORMAL;
|
||||
return BLEND_ALPHA;
|
||||
}
|
||||
|
||||
int Graphics::getColorMode()
|
||||
@@ -549,7 +534,7 @@ namespace opengl
|
||||
if(mode == GL_MODULATE)
|
||||
return COLOR_MODULATE;
|
||||
else // // mode == GL_REPLACE
|
||||
return COLOR_NORMAL;
|
||||
return COLOR_REPLACE;
|
||||
}
|
||||
|
||||
void Graphics::setLineWidth( float width )
|
||||
@@ -856,7 +841,7 @@ namespace opengl
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case love::DRAW_LINE:
|
||||
case DRAW_LINE:
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f(x1, y1);
|
||||
glVertex2f(x2, y2);
|
||||
@@ -865,7 +850,7 @@ namespace opengl
|
||||
break;
|
||||
|
||||
default:
|
||||
case love::DRAW_FILL:
|
||||
case DRAW_FILL:
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex2f(x1, y1);
|
||||
glVertex2f(x2, y2);
|
||||
@@ -886,7 +871,7 @@ namespace opengl
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case love::DRAW_LINE:
|
||||
case DRAW_LINE:
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f(x, y);
|
||||
glVertex2f(x, y+h);
|
||||
@@ -896,7 +881,7 @@ namespace opengl
|
||||
break;
|
||||
|
||||
default:
|
||||
case love::DRAW_FILL:
|
||||
case DRAW_FILL:
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(x, y);
|
||||
glVertex2f(x, y+h);
|
||||
@@ -918,7 +903,7 @@ namespace opengl
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case love::DRAW_LINE:
|
||||
case DRAW_LINE:
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2f(x1, y1);
|
||||
glVertex2f(x2, y2);
|
||||
@@ -928,7 +913,7 @@ namespace opengl
|
||||
break;
|
||||
|
||||
default:
|
||||
case love::DRAW_FILL:
|
||||
case DRAW_FILL:
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(x1, y1);
|
||||
glVertex2f(x2, y2);
|
||||
@@ -956,7 +941,7 @@ namespace opengl
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case love::DRAW_LINE:
|
||||
case DRAW_LINE:
|
||||
glBegin(GL_LINE_LOOP);
|
||||
|
||||
for(float i = 0; i < two_pi; i+= angle_shift)
|
||||
@@ -966,7 +951,7 @@ namespace opengl
|
||||
break;
|
||||
|
||||
default:
|
||||
case love::DRAW_FILL:
|
||||
case DRAW_FILL:
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
|
||||
for(float i = 0; i < two_pi; i+= angle_shift)
|
||||
@@ -1017,7 +1002,7 @@ namespace opengl
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glBegin((mode==love::DRAW_LINE) ? GL_LINE_LOOP : GL_POLYGON);
|
||||
glBegin((mode==DRAW_LINE) ? GL_LINE_LOOP : GL_POLYGON);
|
||||
|
||||
switch(luatype)
|
||||
{
|
||||
@@ -1075,7 +1060,7 @@ namespace opengl
|
||||
|
||||
// Get rendering mode. (line/fill)
|
||||
int mode = (int)lua_tonumber(L, 1);
|
||||
GLenum glmode = (mode==love::DRAW_LINE) ? GL_LINE_LOOP : GL_POLYGON;
|
||||
GLenum glmode = (mode==DRAW_LINE) ? GL_LINE_LOOP : GL_POLYGON;
|
||||
|
||||
// Get the type of the second argument.
|
||||
int luatype = lua_type(L, 2);
|
||||
|
||||
@@ -31,15 +31,11 @@
|
||||
#include <SDL_opengl.h>
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
#include <graphics/Graphics.h>
|
||||
|
||||
#include "Image.h"
|
||||
#include "Animation.h"
|
||||
#include "Color.h"
|
||||
#include "TrueTypeFont.h"
|
||||
#include "ImageFont.h"
|
||||
#include "ParticleSystem.h"
|
||||
#include "SpriteBatch.h"
|
||||
#include "VertexBuffer.h"
|
||||
#include "ImageFont.h"
|
||||
#include "Frame.h"
|
||||
|
||||
namespace love
|
||||
@@ -48,6 +44,11 @@ namespace graphics
|
||||
{
|
||||
namespace opengl
|
||||
{
|
||||
struct Color
|
||||
{
|
||||
unsigned char r, b, g, a;
|
||||
};
|
||||
|
||||
struct DisplayMode
|
||||
{
|
||||
int width, height; // The size of the screen.
|
||||
@@ -63,22 +64,23 @@ namespace opengl
|
||||
struct DisplayState
|
||||
{
|
||||
// Colors.
|
||||
GLubyte color[4];
|
||||
GLubyte backgroundColor[4];
|
||||
Color color;
|
||||
Color backgroundColor;
|
||||
|
||||
// Blend and color modes.
|
||||
int blendMode, colorMode;
|
||||
Graphics::BlendMode blendMode;
|
||||
Graphics::ColorMode colorMode;
|
||||
|
||||
// Line.
|
||||
float lineWidth;
|
||||
int lineStyle;
|
||||
Graphics::LineStyle lineStyle;
|
||||
bool stipple;
|
||||
int stippleRepeat;
|
||||
int stipplePattern;
|
||||
|
||||
// Point.
|
||||
float pointSize;
|
||||
int pointStyle;
|
||||
Graphics::PointStyle pointStyle;
|
||||
|
||||
// Scissor.
|
||||
bool scissor;
|
||||
@@ -87,27 +89,27 @@ namespace opengl
|
||||
// Default values.
|
||||
DisplayState()
|
||||
{
|
||||
color[0] = 255;
|
||||
color[1] = 255;
|
||||
color[2] = 255;
|
||||
color[3] = 255;
|
||||
backgroundColor[0] = 0;
|
||||
backgroundColor[1] = 0;
|
||||
backgroundColor[2] = 0;
|
||||
backgroundColor[3] = 255;
|
||||
blendMode = BLEND_NORMAL;
|
||||
colorMode = COLOR_NORMAL;
|
||||
color.r = 255;
|
||||
color.g = 255;
|
||||
color.b = 255;
|
||||
color.a = 255;
|
||||
backgroundColor.r = 0;
|
||||
backgroundColor.g = 0;
|
||||
backgroundColor.b = 0;
|
||||
backgroundColor.a = 255;
|
||||
blendMode = Graphics::BLEND_ALPHA;
|
||||
colorMode = Graphics::COLOR_MODULATE;
|
||||
lineWidth = 1.0f;
|
||||
lineStyle = LINE_SMOOTH;
|
||||
lineStyle = Graphics::LINE_SMOOTH;
|
||||
stipple = false;
|
||||
pointSize = 1.0f;
|
||||
pointStyle = POINT_SMOOTH;
|
||||
pointStyle = Graphics::POINT_SMOOTH;
|
||||
scissor = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class Graphics : public Module
|
||||
class Graphics : public love::graphics::Graphics
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -115,8 +117,9 @@ namespace opengl
|
||||
DisplayMode currentMode;
|
||||
|
||||
public:
|
||||
|
||||
Graphics();
|
||||
~Graphics();
|
||||
virtual ~Graphics();
|
||||
|
||||
// Implements Module.
|
||||
const char * getName() const;
|
||||
@@ -129,7 +132,6 @@ namespace opengl
|
||||
* @param height The window height.
|
||||
**/
|
||||
bool checkMode(int width, int height, bool fullscreen);
|
||||
|
||||
|
||||
DisplayState saveState();
|
||||
|
||||
@@ -227,11 +229,6 @@ namespace opengl
|
||||
**/
|
||||
int getScissor(lua_State * L);
|
||||
|
||||
/**
|
||||
* Creates a new Color object.
|
||||
**/
|
||||
Color * newColor( int r, int g, int b, int a );
|
||||
|
||||
/**
|
||||
* Creates an Image object with padding and/or optimization.
|
||||
**/
|
||||
@@ -253,59 +250,28 @@ namespace opengl
|
||||
**/
|
||||
Font * newImageFont(Image * image, const char * glyphs, float spacing = 1);
|
||||
|
||||
/**
|
||||
* Creates an Animation object with no frames.
|
||||
**/
|
||||
Animation * newAnimation(Image * image);
|
||||
|
||||
/**
|
||||
* Creates an Animation object with generated frames in a grid.
|
||||
**/
|
||||
Animation * newAnimation(Image * image, float fw, float fh, float delay, int num = 0);
|
||||
|
||||
/**
|
||||
* Creates a ParticleSystem object with the specified buffer size and using the specified sprite.
|
||||
**/
|
||||
//pParticleSystem newParticleSystem(Image * image, unsigned int size);
|
||||
|
||||
/**
|
||||
* Creates a PointParticleSystem object with the specified buffer size and sprite.
|
||||
* @param mode This should be love::POINT_SPRITE.
|
||||
**/
|
||||
//pParticleSystem newParticleSystem(Image * image, unsigned int size, int mode);
|
||||
|
||||
SpriteBatch * newSpriteBatch(Image * image, int size, int usage);
|
||||
VertexBuffer * newVertexBuffer(Image * image, int size, int type, int usage);
|
||||
//SpriteBatch * newSpriteBatch(Image * image, int size, int usage);
|
||||
|
||||
/**
|
||||
* Sets the foreground color.
|
||||
**/
|
||||
void setColor(Color * color);
|
||||
|
||||
/**
|
||||
* Sets the foreground color.
|
||||
**/
|
||||
void setColor( int r, int g, int b, int a = 255);
|
||||
void setColor(Color c);
|
||||
|
||||
/**
|
||||
* Gets current color.
|
||||
**/
|
||||
Color * getColor();
|
||||
Color getColor();
|
||||
|
||||
/**
|
||||
* Sets the background Color.
|
||||
**/
|
||||
void setBackgroundColor( Color * color );
|
||||
|
||||
/**
|
||||
* Sets the background Color.
|
||||
**/
|
||||
void setBackgroundColor( int r, int g, int b );
|
||||
void setBackgroundColor(Color c);
|
||||
|
||||
/**
|
||||
* Gets the current background color.
|
||||
* @param c Array of size 3 (r,g,b).
|
||||
**/
|
||||
Color * getBackgroundColor();
|
||||
Color getBackgroundColor();
|
||||
|
||||
/**
|
||||
* Sets the current font.
|
||||
@@ -473,17 +439,6 @@ namespace opengl
|
||||
**/
|
||||
void printf( const char * str, float x, float y, float wrap, int align = 0 );
|
||||
|
||||
/**
|
||||
* Draws an Image at the specified coordinates, with rotation and
|
||||
* scaling along both axes.
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param angle The amount of rotation.
|
||||
* @param sx The scale factor along the x-axis. (1 = normal).
|
||||
* @param sy The scale factor along the y-axis. (1 = normal).
|
||||
**/
|
||||
//void draw(Drawable * drawable, float x, float y, float angle, float sx, float sy);
|
||||
|
||||
/**
|
||||
* Draws a point at (x,y).
|
||||
* @param x Point along x-axis.
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <common/math.h>
|
||||
|
||||
// OpenGL
|
||||
#include "GLee.h"
|
||||
#include <SDL/SDL_opengl.h>
|
||||
|
||||
namespace love
|
||||
|
||||
@@ -128,20 +128,6 @@ namespace opengl
|
||||
return instance->getScissor(L);
|
||||
}
|
||||
|
||||
int _wrap_newColor(lua_State * L)
|
||||
{
|
||||
int r = luaL_checkinteger(L, 1);
|
||||
int g = luaL_checkinteger(L, 2);
|
||||
int b = luaL_checkinteger(L, 3);
|
||||
int a = luaL_optint(L, 4, 255);
|
||||
|
||||
Color * t = instance->newColor(r, g, b, a);
|
||||
|
||||
luax_newtype(L, "Color", LOVE_GRAPHICS_COLOR_BITS, (void*)t);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _wrap_newImage(lua_State * L)
|
||||
{
|
||||
// Convert to File, if necessary.
|
||||
@@ -185,45 +171,6 @@ namespace opengl
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _wrap_newAnimation(lua_State * L)
|
||||
{
|
||||
// If string -> file
|
||||
if(lua_isstring(L, 1))
|
||||
luax_strtofile(L, 1);
|
||||
|
||||
// file -> imagedata
|
||||
if(luax_istype(L, 1, LOVE_FILESYSTEM_FILE_BITS))
|
||||
luax_convobj(L, 1, "image", "newImageData");
|
||||
|
||||
// imagedata -> image
|
||||
if(luax_istype(L, 1, LOVE_IMAGE_IMAGE_DATA_BITS))
|
||||
luax_convobj(L, 1, "graphics", "newImage");
|
||||
|
||||
// Check the value.
|
||||
Image * image = luax_checktype<Image>(L, 1, "Image", LOVE_GRAPHICS_IMAGE_BITS);
|
||||
|
||||
Animation * animation = 0;
|
||||
|
||||
if(lua_gettop(L) == 1)
|
||||
{
|
||||
animation = instance->newAnimation(image);
|
||||
}
|
||||
else
|
||||
{
|
||||
float fw = (float)luaL_checknumber(L, 2);
|
||||
float fh = (float)luaL_checknumber(L, 3);
|
||||
float delay = (float)luaL_checknumber(L, 4);
|
||||
int num = luaL_optint(L, 5, 0);
|
||||
animation = instance->newAnimation(image, fw, fh, delay, num);
|
||||
}
|
||||
|
||||
if(animation == 0)
|
||||
return luaL_error(L, "Could not load the Animation");
|
||||
|
||||
luax_newtype(L, "Animation", LOVE_GRAPHICS_ANIMATION_BITS, (void*)animation);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _wrap_newFont(lua_State * L)
|
||||
{
|
||||
// Convert to File, if necessary.
|
||||
@@ -271,6 +218,7 @@ namespace opengl
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
int _wrap_newSpriteBatch(lua_State * L)
|
||||
{
|
||||
Image * image = luax_checktype<Image>(L, 1, "Image", LOVE_GRAPHICS_IMAGE_BITS);
|
||||
@@ -280,83 +228,48 @@ namespace opengl
|
||||
luax_newtype(L, "SpriteBatch", LOVE_GRAPHICS_SPRITE_BATCH_BITS, (void*)t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _wrap_newVertexBuffer(lua_State * L)
|
||||
{
|
||||
|
||||
Image * image;
|
||||
int type, usage, size;
|
||||
|
||||
if(luax_istype(L, 1, LOVE_GRAPHICS_IMAGE_BITS))
|
||||
{
|
||||
image = luax_checktype<Image>(L, 1, "Image", LOVE_GRAPHICS_IMAGE_BITS);
|
||||
size = luaL_optint(L, 2, 100);
|
||||
type = luaL_optint(L, 3, TYPE_TRIANGLES);
|
||||
usage = luaL_optint(L, 4, USAGE_ARRAY);
|
||||
}
|
||||
else if(lua_isnumber(L, 1))
|
||||
{
|
||||
image = 0;
|
||||
size = luaL_optint(L, 1, 100);
|
||||
type = luaL_optint(L, 2, TYPE_TRIANGLES);
|
||||
usage = luaL_optint(L, 3, USAGE_ARRAY);
|
||||
}
|
||||
else return luaL_error(L, "Expected type image or number");
|
||||
|
||||
VertexBuffer * t = instance->newVertexBuffer(image, size, type, usage);
|
||||
luax_newtype(L, "VertexBuffer", LOVE_GRAPHICS_VERTEX_BUFFER_BITS, (void*)t);
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int _wrap_setColor(lua_State * L)
|
||||
{
|
||||
if(luax_istype(L, 1, LOVE_GRAPHICS_COLOR_BITS))
|
||||
{
|
||||
Color * color = luax_checktype<Color>(L, 1, "Color", LOVE_GRAPHICS_COLOR_BITS);
|
||||
instance->setColor(color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int r = luaL_checkint(L, 1);
|
||||
int g = luaL_checkint(L, 2);
|
||||
int b = luaL_checkint(L, 3);
|
||||
int a = luaL_optint(L, 4, 255);
|
||||
|
||||
instance->setColor(r, g, b, a);
|
||||
|
||||
return 1;
|
||||
Color c;
|
||||
c.r = (unsigned char)luaL_checkint(L, 1);
|
||||
c.g = (unsigned char)luaL_checkint(L, 2);
|
||||
c.b = (unsigned char)luaL_checkint(L, 3);
|
||||
c.a = (unsigned char)luaL_optint(L, 4, 255);
|
||||
instance->setColor(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _wrap_getColor(lua_State * L)
|
||||
{
|
||||
Color * color = instance->getColor();
|
||||
luax_newtype(L, "Color", LOVE_GRAPHICS_COLOR_BITS, (void*)color);
|
||||
return 1;
|
||||
Color c = instance->getColor();
|
||||
lua_pushinteger(L, c.r);
|
||||
lua_pushinteger(L, c.g);
|
||||
lua_pushinteger(L, c.b);
|
||||
lua_pushinteger(L, c.a);
|
||||
return 4;
|
||||
}
|
||||
|
||||
int _wrap_setBackgroundColor(lua_State * L)
|
||||
{
|
||||
if(luax_istype(L, 1, LOVE_GRAPHICS_COLOR_BITS))
|
||||
{
|
||||
Color * color = luax_checktype<Color>(L, 1, "Color", LOVE_GRAPHICS_COLOR_BITS);
|
||||
instance->setBackgroundColor(color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int r = luaL_checkint(L, 1);
|
||||
int g = luaL_checkint(L, 1);
|
||||
int b = luaL_checkint(L, 1);
|
||||
|
||||
instance->setBackgroundColor(r, g, b);
|
||||
|
||||
return 1;
|
||||
Color c;
|
||||
c.r = (unsigned char)luaL_checkint(L, 1);
|
||||
c.g = (unsigned char)luaL_checkint(L, 2);
|
||||
c.b = (unsigned char)luaL_checkint(L, 3);
|
||||
c.a = 255;
|
||||
instance->setBackgroundColor(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _wrap_getBackgroundColor(lua_State * L)
|
||||
{
|
||||
Color * color = instance->getBackgroundColor();
|
||||
luax_newtype(L, "Color", LOVE_GRAPHICS_COLOR_BITS, (void*)color);
|
||||
return 1;
|
||||
Color c = instance->getBackgroundColor();
|
||||
lua_pushinteger(L, c.r);
|
||||
lua_pushinteger(L, c.g);
|
||||
lua_pushinteger(L, c.b);
|
||||
lua_pushinteger(L, c.a);
|
||||
return 4;
|
||||
}
|
||||
|
||||
int _wrap_setFont(lua_State * L)
|
||||
@@ -436,7 +349,7 @@ namespace opengl
|
||||
int _wrap_setLine(lua_State * L)
|
||||
{
|
||||
float width = (float)luaL_checknumber(L, 1);
|
||||
int style = luaL_optint(L, 2, LINE_SMOOTH);
|
||||
int style = luaL_optint(L, 2, Graphics::LINE_SMOOTH);
|
||||
instance->setLine(width, style);
|
||||
return 0;
|
||||
}
|
||||
@@ -489,7 +402,7 @@ namespace opengl
|
||||
int _wrap_setPoint(lua_State * L)
|
||||
{
|
||||
float size = (float)luaL_checknumber(L, 1);
|
||||
int style = luaL_optint(L, 2, POINT_SMOOTH);
|
||||
int style = luaL_optint(L, 2, Graphics::POINT_SMOOTH);
|
||||
instance->setPoint(size, style);
|
||||
return 0;
|
||||
}
|
||||
@@ -741,14 +654,11 @@ namespace opengl
|
||||
{ "clear", _wrap_clear },
|
||||
{ "present", _wrap_present },
|
||||
|
||||
{ "newColor", _wrap_newColor },
|
||||
{ "newImage", _wrap_newImage },
|
||||
{ "newFrame", _wrap_newFrame },
|
||||
{ "newAnimation", _wrap_newAnimation },
|
||||
{ "newFont", _wrap_newFont },
|
||||
{ "newImageFont", _wrap_newImageFont },
|
||||
{ "newSpriteBatch", _wrap_newSpriteBatch },
|
||||
{ "newVertexBuffer", _wrap_newVertexBuffer },
|
||||
//{ "newSpriteBatch", _wrap_newSpriteBatch },
|
||||
|
||||
{ "setColor", _wrap_setColor },
|
||||
{ "getColor", _wrap_getColor },
|
||||
@@ -815,14 +725,14 @@ namespace opengl
|
||||
|
||||
// Types for this module.
|
||||
const lua_CFunction wrap_Graphics_types[] = {
|
||||
wrap_Color_open,
|
||||
//wrap_Color_open,
|
||||
wrap_Font_open,
|
||||
wrap_Image_open,
|
||||
wrap_Frame_open,
|
||||
wrap_Animation_open,
|
||||
wrap_ParticleSystem_open,
|
||||
wrap_SpriteBatch_open,
|
||||
wrap_VertexBuffer_open,
|
||||
//wrap_Animation_open,
|
||||
//wrap_ParticleSystem_open,
|
||||
//wrap_SpriteBatch_open,
|
||||
//wrap_VertexBuffer_open,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
@@ -22,13 +22,8 @@
|
||||
#define LOVE_GRAPHICS_OPENGL_WRAP_GRAPHICS_H
|
||||
|
||||
// LOVE
|
||||
#include "wrap_Color.h"
|
||||
#include "wrap_Font.h"
|
||||
#include "wrap_Image.h"
|
||||
#include "wrap_Animation.h"
|
||||
#include "wrap_ParticleSystem.h"
|
||||
#include "wrap_SpriteBatch.h"
|
||||
#include "wrap_VertexBuffer.h"
|
||||
#include "wrap_Frame.h"
|
||||
#include "Graphics.h"
|
||||
|
||||
|
||||
@@ -48,10 +48,11 @@ namespace opengl
|
||||
|
||||
int _wrap_Image_setFilter(lua_State * L)
|
||||
{
|
||||
Image * t = luax_checkimage(L, 1);
|
||||
int min = luaL_checkint(L, 2);
|
||||
int mag = luaL_checkint(L, 3);
|
||||
t->setFilter(min, mag);
|
||||
Image * t = luax_checkimage(L, 1);
|
||||
Image::Filter f;
|
||||
f.min = (Image::FilterMode)luaL_checkint(L, 2);
|
||||
f.mag = (Image::FilterMode)luaL_checkint(L, 3);
|
||||
t->setFilter(f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_JOYSTICK_JOYSTICK_H
|
||||
#define LOVE_JOYSTICK_JOYSTICK_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace joystick
|
||||
{
|
||||
class Joystick : public Module
|
||||
{
|
||||
public:
|
||||
|
||||
enum JoystickAxis
|
||||
{
|
||||
JOYSTICK_AXIS_HORIZONTAL = 0,
|
||||
JOYSTICK_AXIS_VERITCAL = 1,
|
||||
};
|
||||
|
||||
enum JoystickHat
|
||||
{
|
||||
JOYSTICK_HAT_CENTERED = 0,
|
||||
JOYSTICK_HAT_UP = 1,
|
||||
JOYSTICK_HAT_RIGHT = 2,
|
||||
JOYSTICK_HAT_DOWN = 4,
|
||||
JOYSTICK_HAT_LEFT = 8,
|
||||
JOYSTICK_HAT_RIGHTUP = (2|1),
|
||||
JOYSTICK_HAT_RIGHTDOWN = (2|4),
|
||||
JOYSTICK_HAT_LEFTUP = (8|1),
|
||||
JOYSTICK_HAT_LEFTDOWN = (8|4)
|
||||
};
|
||||
|
||||
virtual ~Joystick(){};
|
||||
|
||||
}; // Joystick
|
||||
|
||||
} // joystick
|
||||
} // love
|
||||
|
||||
#endif // LOVE_JOYSTICK_JOYSTICK_H
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <SDL.h>
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
#include <joystick/Joystick.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -33,13 +33,13 @@ namespace joystick
|
||||
{
|
||||
namespace sdl
|
||||
{
|
||||
class Joystick : public Module
|
||||
class Joystick : public love::joystick::Joystick
|
||||
{
|
||||
private:
|
||||
SDL_Joystick ** joysticks;
|
||||
public:
|
||||
Joystick();
|
||||
~Joystick();
|
||||
virtual ~Joystick();
|
||||
|
||||
// Implements Module.
|
||||
const char * getName() const;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_KEYBOARD_KEYBOARD_H
|
||||
#define LOVE_KEYBOARD_KEYBOARD_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace keyboard
|
||||
{
|
||||
class Keyboard : public Module
|
||||
{
|
||||
public:
|
||||
|
||||
static const int KEY_REPEAT_DELAY = -1;
|
||||
static const int KEY_REPEAT_INTERVAL = -2;
|
||||
|
||||
virtual ~Keyboard(){}
|
||||
|
||||
}; // Keyboard
|
||||
|
||||
} // keyboard
|
||||
} // love
|
||||
|
||||
#endif // LOVE_KEYBOARD_KEYBOARD_H
|
||||
@@ -22,8 +22,7 @@
|
||||
#define LOVE_KEYBOARD_SDL_KEYBOARD_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
#include <common/constants.h>
|
||||
#include <keyboard/Keyboard.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -31,7 +30,7 @@ namespace keyboard
|
||||
{
|
||||
namespace sdl
|
||||
{
|
||||
class Keyboard : public Module
|
||||
class Keyboard : public love::keyboard::Keyboard
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_MOUSE_MOUSE_H
|
||||
#define LOVE_MOUSE_MOUSE_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace mouse
|
||||
{
|
||||
class Mouse : public Module
|
||||
{
|
||||
public:
|
||||
|
||||
enum MouseButton
|
||||
{
|
||||
MOUSE_LEFT = 1,
|
||||
MOUSE_MIDDLE,
|
||||
MOUSE_RIGHT,
|
||||
MOUSE_WHEELUP,
|
||||
MOUSE_WHEELDOWN
|
||||
};
|
||||
|
||||
virtual ~Mouse(){};
|
||||
|
||||
}; // Mouse
|
||||
|
||||
} // mouse
|
||||
} // love
|
||||
|
||||
#endif // LOVE_MOUSE_MOUSE_H
|
||||
@@ -22,7 +22,7 @@
|
||||
#define LOVE_MOUSE_SDL_MOUSE_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Module.h>
|
||||
#include <mouse/Mouse.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace mouse
|
||||
{
|
||||
namespace sdl
|
||||
{
|
||||
class Mouse : public Module
|
||||
class Mouse : public love::mouse::Mouse
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_PHYSICS_JOINT_H
|
||||
#define LOVE_PHYSICS_JOINT_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Object.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace physics
|
||||
{
|
||||
class Joint : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
enum JointType
|
||||
{
|
||||
JOINT_DISTANCE,
|
||||
JOINT_REVOLUTE,
|
||||
JOINT_PRISMATIC,
|
||||
JOINT_MOUSE,
|
||||
JOINT_PULLEY,
|
||||
JOINT_GEAR
|
||||
};
|
||||
|
||||
|
||||
virtual ~Joint(){}
|
||||
};
|
||||
|
||||
} // physics
|
||||
} // love
|
||||
|
||||
#endif // LOVE_PHYSICS_JOINT_H
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_PHYSICS_SHAPE_H
|
||||
#define LOVE_PHYSICS_SHAPE_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Object.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace physics
|
||||
{
|
||||
class Shape : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
enum ShapeType
|
||||
{
|
||||
SHAPE_CIRCLE,
|
||||
SHAPE_POLYGON,
|
||||
};
|
||||
|
||||
virtual ~Shape(){}
|
||||
};
|
||||
|
||||
} // physics
|
||||
} // love
|
||||
|
||||
#endif // LOVE_PHYSICS_SHAPE_H
|
||||
@@ -61,17 +61,17 @@ namespace box2d
|
||||
switch(joint->GetType())
|
||||
{
|
||||
case e_revoluteJoint:
|
||||
return love::JOINT_REVOLUTE;
|
||||
return JOINT_REVOLUTE;
|
||||
case e_prismaticJoint:
|
||||
return love::JOINT_PRISMATIC;
|
||||
return JOINT_PRISMATIC;
|
||||
case e_distanceJoint:
|
||||
return love::JOINT_DISTANCE;
|
||||
return JOINT_DISTANCE;
|
||||
case e_pulleyJoint:
|
||||
return love::JOINT_PULLEY;
|
||||
return JOINT_PULLEY;
|
||||
case e_mouseJoint:
|
||||
return love::JOINT_MOUSE;
|
||||
return JOINT_MOUSE;
|
||||
case e_gearJoint:
|
||||
return love::JOINT_GEAR;
|
||||
return JOINT_GEAR;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
// LOVE
|
||||
#include <common/runtime.h>
|
||||
#include <common/Object.h>
|
||||
#include <common/constants.h>
|
||||
#include <physics/Joint.h>
|
||||
|
||||
// Box2D
|
||||
#include "Include/Box2D.h"
|
||||
@@ -44,7 +43,7 @@ namespace box2d
|
||||
* A Joint can be used to prevent Bodies from going to
|
||||
* far apart, or coming too close together.
|
||||
**/
|
||||
class Joint : public Object
|
||||
class Joint : public love::physics::Joint
|
||||
{
|
||||
friend class GearJoint;
|
||||
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
#define LOVE_PHYSICS_BOX2D_SHAPE_H
|
||||
|
||||
// LOVE
|
||||
#include <common/Object.h>
|
||||
#include <physics/Shape.h>
|
||||
#include <common/Reference.h>
|
||||
#include <common/constants.h>
|
||||
|
||||
// Box2D
|
||||
#include "Include/Box2D.h"
|
||||
@@ -56,7 +55,7 @@ namespace box2d
|
||||
* a Shape's geometry will be affected by the parent
|
||||
* body's transformation.
|
||||
**/
|
||||
class Shape : public Object
|
||||
class Shape : public love::physics::Shape
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user