Code Monkey home page Code Monkey logo

wip's Introduction

WIP

简介[已经重构,请转移到WIPReborn]

一个简陋的2D游戏引擎原型。

功能

  • 基本的系统
  • 基于lua的数据驱动游戏对象系统
  • 基本刚体物理

用途

我在更多时候是在学习的时候使用他来做一些demo。

一些截图:

骨骼动画

关节动画

AI寻路

Transform

刚体物理

一个场景

UI和音乐

Spine骨骼动画

编译

  • 下载依赖项Deps解压覆盖到./
  • 用VS2012打开./src/wip/wip.sln
  • 生成即可。

如果使用其他版本的VS需要从新编译lib。

使用

游戏范例

1、具体使用见文档 https://github.com/wubugui/WIP/wiki

现在实现的xml格式比较冗长,下面的好一些:

<?xml version="1.0" encoding="UTF-8" ?>
<wip version="0.125">
  <scene sceneName="XXXScene">
    <object objectName="XXName" active="false" assets="resources/bg.jpg">
      <transform active="true">
        <position x="1.111" y="2.222" z="3.333"/>
        <rotation rad="10.1"/>
        <scale x="1" y="1"/>
      </transform>
      <components>
        <componentName active="true">
          <property1 value1="v1" value2="v2"/>
          <property2 value1="v1" value2="v2"/>
        </componentName>
      </components>
    </object>

    <ui uiName="XXName" active="true" type="Button">
      <transform active="true">
        <position x="1.111" y="2.222" z="3.333"/>
        <rotation rad="10.1"/>
        <scale x="1" y="1"/>
      </transform>
      <resources r1="resources/UI/Btn_Back_Down.png" r2="resources/UI/Btn_Back_Normal.png" r3="resources/UI/Btn_Back_Move.png"/>
      <events>
      </events>
    </ui>

  </scene>
</wip>

2、参考API手册,为对象编使用Lua写自定义组件,例如上面的UIDemo组件,下面是一个简单的Drag组件的代码

local BaseComponent = require "BaseComponent"
local app = require "lib"
local Input = require "Input"
local Utilities = require "Utilities"
local System = require "System"
local Drag = BaseComponent:new()

function Drag:new()
    local o = {}
	setmetatable(o,self)
	self.__index = self

	--add data member here
	o.camera = nil
	o.px = 0
	o.py = 0
	return o
end

function Drag:init()

end

function Drag:game_init()
	self.camera = camera
	--app.sprite_set_position(self.host_obj.sprite_ptr,0,0)
	app.collider_set_density(self.host_obj.Collider.collider_ptr,0.001)
end

function Drag:update(dt)

end

function Drag:game_exit()

end

function Drag:exit()

end

return Drag

3、安装./bin中的oalinst.exe文件,这是OpenAL。

4、运行./bin/wip.exe,查看效果.

5、可以通过修改源代码,来修改或者添加LuaAPI,方法如下:

LuaAPI修改方法

具体请参考:

使用方法

文件结构

./bin/:可执行文件是可以独立运行。

./bin/engine/script/:存放引擎自带的脚本文件,这些文件一般不需要修改,自定义的脚本都在./bin/script/中,其中只有config.lua是必须的文件,这个文件确定了一些初试化参数。

./bin/resources/:存放资源

./bin/resources/UI/:默认的UI素材,自定义UI可修改。

其他下载

Demo下载

组件生成器

Any More

OSC镜像 -- 已停止更新

wip's People

Contributors

wubugui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.